Types(C++ Programming ) Questions and Answers

Question 1.

Pick the odd one out.


  1.    integer, character, boolean, floating
  2.    enumeration, classes
  3.    integer, enum, void
  4.    arrays, pointer, classes
Explanation:-
Answer: Option C. -> integer, enum, void

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.



Question 2.

When a language has the capability to produce new data type mean, it can be called as


  1.    overloaded
  2.    extensible
  3.    encapsulated
  4.    reprehensible
Explanation:-
Answer: Option B. -> extensible

Extensible is used to add new features to C++.



Question 3.

The value 132.54 can represented using which data type?


  1.    double
  2.    void
  3.    int
  4.    bool
Explanation:-
Answer: Option A. -> double

The given value is with decimal points, so float or double can be used.



Question 4.

Which of the following statements are true?
 int f(float)


  1.    f is a function taking an argument of type int and retruning a floating point number
  2.    f is a function taking an argument of type float and returning a integer.
  3.    f is a function of type float
  4.    none of the mentioned
Explanation:-
Answer: Option B. -> f is a function taking an argument of type float and returning a integer.

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.



Question 5.

Identify the user-defined types from the following?


  1.    enumeration
  2.    classes
  3.    both a and b
  4.    int
Explanation:-
Answer: Option C. -> both a and b

They must be defined by the users before use unlike the other types which are readily available.



Question 6.

Which type is best suited to represent the logical values?


  1.    integer
  2.    boolean
  3.    character
  4.    all of the mentioned
Explanation:-
Answer: Option B. -> boolean

Logical values can be either true or false, so the boolean type is suited for it.



Question 7.

What does a escape code represent?


  1.    alert
  2.    backslash
  3.    tab
  4.    form feed
Explanation:-
Answer: Option A. -> alert

Because a is used to produce a beep sound.



Question 8.

Pick the odd one out


  1.    array type
  2.    character type
  3.    boolean type
  4.    integer type
Explanation:-
Answer: Option A. -> array type

Array type is not the basic type and it is constructed using the basic type.



Question 9.

Which datatype is used to represent the absence of parameters?


  1.    int
  2.    short
  3.    void
  4.    float
Explanation:-
Answer: Option C. -> void

void will not return anything.



Question 10.

What is the size of wchar_t in C++?


  1.    2
  2.    4
  3.    2 or 4
  4.    based on the number of bits in the system
Explanation:-
Answer: Option D. -> based on the number of bits in the system

Compiler wants to make CPU as more efficient in accessing the next value.