Here is a listing of C++ interview questions on “Types” along with answers, explanations and/or solutions:
1. 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
a) array type
b) character type
c) boolean type
d) integer type
a) int
b) short
c) void
d) float
a) alert
b) backslash
c) tab
d) form feed
a) integer
b) boolean
c) character
d) all of the mentioned
a) enumeration
b) classes
c) both a and b
d) int
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
a) double
b) void
c) int
d) bool
a) overloaded
b) extensible
c) encapsulated
d) reprehensible
a) integer, character, boolean, floating
b) enumeration, classes
c) integer, enum, void
d) arrays, pointer, classes
1. 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
Answer:d
Explanation:Compiler wants to make CPU as more efficient in accessing the next value.
2. Pick the odd one outa) array type
b) character type
c) boolean type
d) integer type
Answer:a
Explanation:array type is not the basic type and it is constructed using the basic type.
3. which datatype is used to represent the absence of paramaters?a) int
b) short
c) void
d) float
Answer:c
Explanation:void will not return anything.
4. What does a escape code represent?a) alert
b) backslash
c) tab
d) form feed
Answer:a
Explanation:Because a is used to produce a beep sound.
5. Which type is best suited to represent the logical values?a) integer
b) boolean
c) character
d) all of the mentioned
Answer:b
Explanation:Logical values can be either true or false, so the boolean type is suited for it.
6. Identify the user-defined types from the following?a) enumeration
b) classes
c) both a and b
d) int
Answer:c
Explanation:They must be defined by the users before use unlike the other types which are readily available.
7. Which of the following statements are true?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
Answer:b
Explanation:The argument that is passed to a function f is of float type
and the function finally retruns a value that id is of integer type.
8. The value 132.54 can represented using which data type?a) double
b) void
c) int
d) bool
Answer:a
Explanation:The given value is with decimal points, so float or double can be used.
9. When a language has the capability to produce new data type mean, it can be called asa) overloaded
b) extensible
c) encapsulated
d) reprehensible
Answer:b
Explanation:Extensible is used to add new features to C++.
10. Pick the odd one out.a) integer, character, boolean, floating
b) enumeration, classes
c) integer, enum, void
d) arrays, pointer, classes
Answer:c
Explanation:Option a consists of all fundamental types, option b
consists of user-definied types and option d consists of derived types
but option c is a mixture.
1 টি মন্তব্য: