C++ Multiple Choice Questions
101. What is the size of wchar_t in C++?
a) 2
b) 4
c) 2 or 4
d) depends on the number of bits in the system
102. Pick the odd one out
a) array type
b) character type
c) boolean type
d) integer type
103. Which datatype is used to represent the absence of parameters?
a) int
b) short
c) void
d) float
104. What does a escape code represent?
a) alert
b) backslash
c) tab
d) form feed
105. Which type is best suited to represent the logical values?
a) integer
b) boolean
c) character
d) all of above
106. Identify the user-defined types from the following?
a) enumeration
b) classes
c) both a and b
d) int
107. Which of the following statements are true for: int f(float)
a) f is a function taking an argument of type int and retruning a floating point number
b) f is a function taking an argument of type float and returning a integer.
c) f is a function of type float
d) none of the mentioned
108. The value 132.54 can represented using which data type?
a) double
b) void
c) int
d) bool
109. When a language has the capability to produce new data type mean, it can be called as
a) overloaded
b) extensible
c) encapsulated
d) reprehensible
110. Pick the odd one out.
a) integer, character, boolean, floating
b) enumeration, classes
c) integer, enum, void
d) arrays, pointer, classes
111. Is bool a fundamental datatype in C++?
a) Yes
b) No, it is a typedef of unsigned char
c) No, it is an enum of {false,true}
d) No, it is expanded from macros
112. Find the odd one out:
a) std::vector<int>
b) std::vector<short>
c) std::vector<long>
d) std::vector<bool>
113. What is the value of the bool? bool is_int(789.54)
a) True
b) False
c) 1
d) none of the mentioned
114. What happens when a null pointer is converted into bool?
a) An error is flagged
b) bool value evaluates to true
c) bool value evaluates to false
d) the statement is ignored
115. Which of the following statements are false?
a) bool can have two values and can be used to express logical expressions.
b) bool cannot be used as the type of the result of the function.
c) bool can be converted into integers implicitly
d) a bool value can be used in arithemetic expressions.
116. For what values of the expression is an if-statement block not executed?
a) 0 and all negative values
b) 0 and -1
c) 0
d) 0, all negative values, all positive values except 1
117. Which of the two operators ++ and — work for the bool datatype in C++?
a) None
b) ++
c) –
d) Both
118. Evaluate the following
(false && true) || false || true
a) 0
b) 1
c) false
d) none of the mentioned
119. Select the right option: Given the variables p, q are of char type and r, s, t are of int type (1) t = (r * s) / (r + s); (2) t = (p * q) / (r + s);
a) 1 is true but 2 is false
b) 1 is false and 2 is true
c) both 1 and 2 are true
d) both 1 and 2 are false
120. In C++, what is the sign of character data type by default?
a) Signed
b) Unsigned
c) Implementation dependent
d) None of these
Correct Answers to C++ MCQ Questions
101-d | 102-1 | 103-c | 104-a | 105-b | 106-C | 107-b | 108-a | 109-b | 110-c |
111-a | 112-d | 113-b | 114-c | 115-b | 116-c | 117-b | 118-b | 119-c | 120-c |
Please, let us know if you discover any error or mistake in these MCQ sets. Don’t hesitate to leave your comments.
Download MCQ Questions PDF File for C++
Please visit Downloads section to download the pdf file of these MCQs from C++.
Leave a Reply