Structure in C MCQs Exercise I

Ques 1 Structure


Can we pass the structure within a function ?

A Yes
B No
C N/A
D N/A

Ques 2 Structure


Which of the following is the correct syntax of passing structure variable in function?

A void sc(struct vari)
B void sc(struct *vari[])
C void sc(struct *vari)
D All of the above

Ques 3 Structure


What is the difference between union and structure?

A All members are used at a time in Union
B Union initialized all members same as structure
C Union cannot have more members
D Only one member can be used at a time in Union

Ques 4 Structure


What is the size of structure variable "student"?

struct student{
    char name[12];
    int roll[6];
    float percentage;
}

A 12
B 18
C 26
D 28

Ques 5 Structure


Which of the following is the correct way to define a structure in C?

A struct person { char name[50]; int age; };
B structure person { char name[50]; int age; };
C struct person { name[50] char; age int; };
D struct { char name[50]; int age; } person;

struct person { char name[50]; int age; };

Ques 6 Structure


How do you access a member of a structure using a pointer to the structure?

A ptr->member
B ptr.member
C *ptr.member
D ptr[member]

ptr->member

Ques 7 Structure


What is the size of a structure in C, if the structure is defined as follows? struct example { char a; int b; };

A 4 bytes
B 5 bytes
C 8 bytes
D 12 bytes

8 bytes

Ques 8 Structure


Which of the following correctly defines a structure with a member that is a pointer?

A struct data { int *ptr; };
B struct data { int ptr; };
C struct data { *int ptr; };
D struct data { int ptr[]; };

struct data { int *ptr; };

Ques 9 Structure


Which of the following statements is used to pass a structure by reference to a function in C?

A function(&structure);
B function(structure);
C function(*structure);
D function(struct *structure);

function(&structure);