C Programming Quiz : Structures in C
C Programming Quiz : Structures in C
1. A structure is a collection of elements that can be of ______ type.
- A) Different data
- B) Same data
- C) Both A & B
- D) None of these
Answer is C)
Description:
A structure is a collection of elements that can be of same data type or different data types.
2. Choose a correct statement about C structure elements?
- A) Structure elements are stored on random free memory locations.
- B) Structure elements are stored in contiguous memory locations.
- C) Structure elements are stored in register memory locations.
- D) None of these
Answer is B)
Description:
Structure elements are stored in contiguous memory locations.
3. What is the size of a C structure?
- A) Size of C structure is the total bytes of all elements of structure.
- B) Size of C structure is the size of largest element.
- C) C structure is always 128 bytes.
- D) None of these.
Answer is A)
Description:
Individually calculate the sizes of each member of a structure and make a total to get Full size of a structure.
4. What is the output of C Program?
- A) Empty string
- B) Taggers
- C) Coding
- D) Compiler Error
Answer is D)
Description:
Keyword used to declare a structure is STRUCT not structure in lowercase i.e struct.
5. A C Structure or User defined data type is also called?
- A) Aggregate data type
- B) Derived data type
- C) Secondary data type
- D) All the above
Answer is D)
Description:
Read all the above options.
6. Structure is used to implement _______ data structures.
- A) Queue
- B) Stack
- C) Linked Lists
- D) All of the above
Answer is D)
Description:
Yes. structure is used to implement Linked Lists, Stack and Queue data structures.
7. Choose a correct statement about C structures.
- A) A structure enables to detect and respond to mouse clicks.
- B) A structure enables erasing contents in a folder in OS.
- C) A structure enables display of folder structure in OS.
- D) All of these.
Answer is D)
Description:
Read all the options carefully.
8. What is the output of C program with structures?
- A) Height=0
- B) Height=10
- C) Height=
- D) Compiler Error
Answer is B)
Description:
Notice a missing semicolon at the end of structure definition.
9. What is actually passed if you pass a structure variable to a function?
- A) Starting address of structure variable
- B) Ending address of structure variable
- C) Reference of structure variable
- D) Copy of structure variable
Answer is D)
Description:
Yes. If you pass a structure variable by value without & operator, only a copy of the variable is passed. So changes made within that function do not reflect in the original variable.
10. What is the output of C program with structures?
- A) SAME
- B) DIFFERENT
- C) Compiler Error
- D) None of these
Answer is A)
Description:
Yes. Before and after initialization, size of a structure variable does not change.
Submit your Quiz Question
Submit your quiz question to us, We will feature your quiz question in our blog with your credits.
1 comment