Structures

Q1:
Which of the following is the correct way of setting values into the structure variable e defined below?
struct Emp
{
    public String name;
    public int age;
    public Single sal; 
}
Emp e = new Emp();

A
e.name = 'Amol'; 
e.age = 25; 
e.sal = 5500;

B
With e
{
    .name = 'Amol';
    .age = 25;
    .sal = 5500; 
}

C
With emp e
{
    .name = 'Amol';
    .age = 25;
    .sal = 5500; 
}

D
e -> name = 'Amol'; 
e -> age = 25;
e -> sal = 5500;

E
name = 'Amol'; 
age = 25;
sal = 5500;

ANS:A -

e.name = 'Amol'; 
e.age = 25; 
e.sal = 5500;

No answer description is available. Let's discuss.



img not found
img

For help Students Orientation
Mcqs Questions

One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.