Test Series - cpp

Test Number 9/102

Q: What is the size of wchar_t in C++?
A. 2
B. 4
C. 2 or 4
D. Based on the number of bits in the system
Solution: Compiler wants to make CPU as more efficient in accessing the next value.
Q: Pick the odd one out.
A. array type
B. character type
C. boolean type
D. integer type
Solution: Array type is not the basic type and it is constructed using the basic type.
Q: Which data type is used to represent the absence of parameters?
A. int
B. short
C. void
D. float
Solution: Because void specifies an empty set of values/parameters.
Q: What does ‘a’ escape code represent?
A. alert
B. backslash
C. tab
D. form feed
Solution: Because a is used to produce a beep sound.
Q: Which type is best suited to represent the logical values?
A. integer
B. boolean
C. character
D. float
Solution: Logical values can be either true or false, so the boolean type is suited for it.
Q: Identify the user-defined types from the following?
A. enumeration
B. classes
C. both enumeration and classes
D. int
Solution: They must be defined by the users before use, unlike the other types which are readily available.
Q: Which of the following statements are true?

int f(float)
A. f is a function taking an argument of type int and returning a floating point number
B. f is a function taking an argument of type float and returning an integer
C. f is a function of type float
D. f is a function of type int
Solution: The argument that is passed to a function f is of float type and the function finally returns a value that id is of integer type.
Q: The value 132.54 can be represented using which data type?
A. double
B. void
C. int
D. bool
Solution: The given value is with decimal points, so float or double can be used.
Q: 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
Solution: Extensible is used to add new features to C++.
Q: Pick the odd one out.
A. integer, character, boolean, floating
B. enumeration, classes
C. integer, enum, void
D. arrays, pointer, classes
Solution: integer, character, boolean & floating consists of all fundamental types, enumeration & classes consists of user-defined types and arrays, pointer & classes consists of derived types but integer, enum & void is a mixture.

You Have Score    /10