Here are the collections of solved multiple choice questions on fundamental of object oriented programming in C++, includes MCQ question on history of C++ language, C++ keywords and operators along with inline expressions and control structors. It also includes about procedure oriented programming along with object oriented programming.
1. C++ is an extension of C with a major addition of the class construct feature of ……………..
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.
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 ?
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.
D) Both A and B
11. Procedure oriented programming basically consists of writing a list of insturctions or actions for the computer to follow and organizing these instructions into groups known as ………………
12. State whether the following statements are true about object oriented programming in C++.
i) Data is hidden and cannot be accessed by external functions.
ii) Follows top-bottom approach in program design.
iii) Objects may communicate with each other through functions.
A) True, True, False
B) False, True, False
C) True, False, True
D) False, True, True
13. The wrapping up of data and functions into a single unit is known as ……………..
14. ……………… refers to the act of representing essential features without including the background details or explanations.
15. ……………. is the process by which objects of one class acquire the properties of objects of another class.
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
11. B) functions
12. C) True, False, True
13. D) encapsulation
14. A) abstraction
15. B) inheritance