Solved MCQ of C++ Set-1


1. C++ is an extension of C with a major addition of the class construct feature of ……………..
A) Simula67
B) Simula57
C) Simula47
D) Simula87

2. C++ has the name ………………….. before it was changed to C++.
A) Improved C  
B) Integrated C
C) C with classes
D) C with Simula

3. …………. Refer to the names of variables, functions, arrays, classes etc. created by the programmer.
A) Keywords
B) Identifiers
C) Constraints
D) Strings

4. In C++, the keyword void was used ………..
A) To specify the return type of function when it is not returning any value.
B) To indicate an empty argument list to a function.
C) To declare the generic pointers.
D) All of the above.

5. Match the following
a) : :                                       i) Pointer to member declarator
b) : :*                                    ii) Pointer to member operator
c) ->*                                    iii) Scope resolution operator
A) a-ii, b-iii, c-i
B) a-iii, b-i, c-ii
C) a-i b-ii, c-iii
D) a-iii, b-ii, c-i

6. If m and n are int type variables, what will be the result of the expression
m% n     when m=5 and n=2 ?
A) 0
B) 1
C) 2
D) None of the above

 7. Some of the C++ operators cannot overloaded which are
i) Member access operators (. And .*)                   ii) Conditional operator (? :)
iii) Scope resolution operator (: :)                             iv) Size operator (sizeof)
A) only i, ii and iii
B) only ii, iii and iv
C) only ii and iv
D) All i, ii, iii and iv

8. Some of the situations where inline expansion may not work are:
A) For functions returning values, if a loop, a switch or goto exists.
B) If functions contain static variables and they are re-cursive.
C) For functions not returning values, if return statement exist.
D) All of the above.

9. Which of the following control expressions are valid for an if statement?
A) an integer expression
B) a Boolean expression
C) either A or B
D) Neither A nor B

10. …………… is a way to bind the data and its associated functions together which allows the data and functions to be hidden.
A) Structure
B) Class
C) Enum
D) Both A and B

Answers

1. A) Simula67
2.   C) C with classes
3.   B) Identifiers
4.  D) All of the above.
5.   B) ii-False, ii-True
6.   B) 1
7.  D) All i, ii, iii and iv
8.  D) All of the above.
9.   B) a Boolean expression
10.  B) Class