C Programming - C Structures And Unions Questions and Answers

C Programming : C Structures And Unions

In the C language structures are used to group together different types of variables under the same name. Following question bank related to the MCQ questions about C structures and unions
1. What is the output of following C code?
main()
{
struct emp
{
char name[20];
int age;
float sal;
};
struct emp e ={"Tiger"}
printf("%d%d%f",e.age,e.sal);
}
[A] Error
[B] Garbage Collection
[C] 0 0.000000
[D] 1 0.000000
Loading...
2. Which of the following comment about the usage of structures in true?
[A] Storage class can be assigned to individual member
[B] Individual members can be initialized within a structure type declaration
[C] The scope of the member name is confined to the particular structure, within which it is defined
[D] None of above
Loading...
3. Which of the following comment about Union is false?
[A] Union is a structure whose members share same memory area
[B] The compiler will keep track of what type of information is currently stored
[C] Only one of the members of union can be assigned a value at particular time
[D] Size allocated for Union is the size of its member needing the maximum storage
Loading...
4. Which of the following is a collection of different data types?
[A] String
[B] Array
[C] Structure
[D] Files
Loading...
5. For accessing a structure element using a pointer,you must use?
[A] Pointer operator (&)
[B] Dot operators(.)
[C] Pointer operator(*)
[D] Arrow operator(->)
Loading...
6. Which operator is used to connect structure name to its member name?
[A] dot operator(.)
[B] logical operator(&&)
[C] pointer operator(&)
[D] Arrow operator(->)
Loading...
7. In C, structure values can be passed as arguments to function by?
[A] passing each member of the structure as an argument of function call
[B] passing copy of the entire structure to the called function
[C] passing structure as an argument using pointer
[D] All of above
Loading...
8. A -> B is syntactically correct if?
[A] a and b are structure
[B] a is a structure and b is a pointer to structure
[C] a is a pointer to structure and b is a structure
[D] a is a pointer to structure in which b is a field
Loading...

Are these questions helpful for you?



Comments: (Your feedback is valuable to us)

k.sai sandeep 3 weeks ago Reply

its awesome


Mital Patel 10 months ago Reply

Its really userful.


amit kumar saini 1 year ago Reply

nyc mcq
give more quize


Prafulla Vyas 2 years ago Reply

IT IS VERY INFORMATIVE