Site icon T4Tutorials.com

Data types and type modifiers — C++ MCQs

1. Which of the following is a fundamental data type in C++?

(A) int


(B) string


(C) vector


(D) class



2. Which type modifier can be used to increase the size of an integer?

(A) short


(B) long


(C) signed


(D) unsigned



3. Which of the following is a floating-point data type in C++?

(A) char


(B) double


(C) bool


(D) int



4. What is the size of a bool data type in most C++ implementations?

(A) 1 byte


(B) 2 bytes


(C) 4 bytes


(D) 8 bytes



5. Which of the following is not a valid type modifier in C++?

(A) signed


(B) volatile


(C) unsigned


(D) long



6. Which type would you use to store large positive integers only?

(A) signed int


(B) unsigned int


(C) float


(D) char



7. What is the default type of a floating-point literal like 3.14 in C++?

(A) float


(B) int


(C) long double


(D) double



8. Which of the following is a modifier used with char in C++?

(A) signed


(B) unsigned


(C) Both A and B


(D) long



9. Which type is used to store very large floating-point numbers in C++?

(A) float


(B) double


(C) long double


(D) int



10. Which of the following is not a valid data type in C++?

(A) short int


(B) long long int


(C) unsigned char


(D) long float



11. What is the size of the int data type in most C++ implementations?

(A) 1 byte


(B) 2 bytes


(C) 4 bytes


(D) 8 bytes



12. How many bytes does a char occupy in C++?

(A) 1 byte


(B) 2 bytes


(C) 4 bytes


(D) 8 bytes



13. What is the typical size of a float in C++?

(A) 2 bytes


(B) 16 bytes


(C) 8 bytes


(D) 4 bytes



14. How many bytes does a double usually occupy in C++?

(A) 4 bytes


(B) 8 bytes


(C) 12 bytes


(D) 16 bytes



15. What is the size of a long in most 64-bit systems?

(A) 4 bytes


(B) 8 bytes


(C) 2 bytes


(D) 16 bytes



16. How many bytes does a bool data type occupy in C++?

(A) 1 byte


(B) 2 bytes


(C) 4 bytes


(D) 8 bytes



17. What is the typical size of a short int in C++?

(A) 1 byte


(B) 2 bytes


(C) 4 bytes


(D) 8 bytes



18. How many bytes does a long double occupy in most compilers?

(A) 8 bytes


(B) 12 bytes


(C) 16 bytes


(D) 32 bytes



19. What is the size of an unsigned int in most 64-bit C++ systems?

(A) 2 bytes


(B) 1 byte


(C) 8 bytes


(D) 4 bytes



20. How many bytes does a long long int occupy in C++?

(A) 4 bytes


(B) 8 bytes


(C) 16 bytes


(D) 2 bytes



Exit mobile version