1. What is a structure in C++? A. A collection of functions B. A reserved keyword in C++ C. A user-defined data type containing variables of different data types D. A way to declare arrays of data Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option C No explanation is given for this question Let's Discuss on Board
2. Which keyword is used to define a structure in C++? A. typedef B. struct C. union D. None of the above Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option B No explanation is given for this question Let's Discuss on Board
3. What is the correct way to access members of a structure in C++? A. Using the star operator B. Using the double colon operator C. Using the dot operator D. Using the arrow operator Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option C No explanation is given for this question Let's Discuss on Board
4. What is the purpose of typedef in C++ structures? A. To define a new structure B. To initialize structure members C. To create a pointer to a structure D. To create an alias for data types Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option D No explanation is given for this question Let's Discuss on Board
5. How do you declare a structure variable in C++? A. structName variableName; B. struct variableName; C. variableName structName; D. variableName = structName; Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option A No explanation is given for this question Let's Discuss on Board
6. What is the output of the following code: struct Student { int roll; }; Student s1; s1.roll = 101; cout << s1.roll; in C++? A. Undefined behavior B. 0 C. Compilation error D. 101 Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option D No explanation is given for this question Let's Discuss on Board
7. What is the purpose of using structures in C++? A. To perform mathematical operations B. To define loops in the program C. To group related data together D. To represent true/false values Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option C No explanation is given for this question Let's Discuss on Board
8. What is the correct way to pass a structure to a function in C++? A. By value B. By reference C. By pointer D. All of the above Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option D No explanation is given for this question Let's Discuss on Board
9. What is a union in C++? A. A reserved keyword in C++ B. A user-defined data type that allows storing different data types in the same memory location C. A way to declare arrays of data D. None of the above Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option B No explanation is given for this question Let's Discuss on Board
10. What is the difference between a structure and a union in C++? A. Structures cannot contain member functions B. Unions are used for mathematical operations C. In a structure, each member has its own memory space, while in a union, all members share the same memory space D. Structures are used for data organization Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option C No explanation is given for this question Let's Discuss on Board