Important C++ MCQS – Introduction, Loop, and Programming Free Practice
C++ Mcqs covering all the concepts including introduction, loop, programming statements, etc. These C++ MCQs with answers are important to qualify any academic as well as competitive examinations.
C++ Mcqs with answers – Set I
- The wrapping up of data and functions into a single unit is called ————
a. Encapsulation
b. Abstraction
c. Polymorphism
d. Classification
Answer a
2. The process by which objects of one class acquire the attributes of object of another class is known as ——————-
a. Classification
b. Data hiding
c. Abstraction
d. Inheritance
Answer d
3. The insulation of data from direct access by unauthorized function is called ————-
a. Data hiding
b. Abstraction
c. Data security
d. All of the above
Answer a
4. —————— means the ability that one thing can take several distinct forms.
a. Function overloading
b. Function overriding
c. Operator overloading
d. Polymorphism
Answer d
5. —————- are used to document a program
a. Comments
b. Curly brackets
c. Header file
d. Dictionary
Answer a
6. The object used to display information on the screen ———
a. cin
b. cout
c. fcin
d. fcout
Answer b
7. Every C++ program begins execution at the function —–
a. void
b. main
c. new
d. None of the above
Answer b
8. Every C++ statement end with a ——-
a. :
b. ;
c. }
d.!
Answer b
9. The ————– operator can be used only with two integer operands.
a. Modulus operator or %
b. Increment operator
c. Decrement operator
d. None of the above
Answer a
10. Objects communicate with each other by sending ——-
a. Object
b. Parameter
c. Message
d. All of the above
Answer c
C++ Mcqs with answers – Set II
11. Relational operators have precedence ———— arithmetic operators
a. Equal to
b. After
c. Before
d. None of the above
Answer c
12. The && operator combines two ———— to produce Boolean type values
a. Conditions
b. Boolean expressions
c. Binary expressions
d. Statements
Answer b
13. The —————– statement causes an exit from the innermost loop or switch.
a. Break
b. Exit
c. Quit
d. EOF
Answer a
14. The continue statement inside a loop causes the control to go to —————
a. Beginning of the loop
b. Skipping statements inside a loop for the current iteration
c. Both a and b
d. None of the above
Answer c
15. A relational operator combines two operands and yields ———— type expressions.
a. Boolean
b. Arithmetic
c. Relational
d. Void
Answer a
16. —————— are used to change the order of precedence in the evaluation of expressions.
a. Parenthesis
b. Curly brackets
c. Box bracketed
d. All of the above
Answer d
17. A function prototype tells the compiler the return type, name and ———–
a. Parameters
d. Definition
c. Function output
d. None of the above
Answer a
18. Global variables exist for the life of the ———
a. Program
b. Function
c. Variable
d. Object
Answer a
19. A function cannot modify its argument that has been declared as ————-
a. Final
b. Constant
c. Default
d. Global
Answer c
20. If we want a function to work on the original argument in the calling function, we must pass the argument as by ————
a. Parameter
b. Call by value
c. Call by reference
d. None of the above
Answer c
C++ Mcqs with answers – Set III
21. A function that has return type —— does not return anything.
a. Void
b. zero
c. int
d. float
Answer a
22. A C++ statement that invokes a function is known as ———-
a. Call statement
b. Execution statement
c. There is no such statement
d. None of the above
Answer a
23. A storage class specifies two things for a variable. One is visibility and the other is ————
a. Lifetime
b. Scope
c. Accessing Technique
d. None of the above
Answer a
24. The storage class ———— is used to a variable to retain its value when a function is not executing
a. Auto
b. Register
c. Extern
d. Static
Answer d
25. The ———- enables access to a global variable with the same name as a variable in the current scope.
a. External
b. Static
c. Register
d. Automatic
Answer a
26. The default access mode for a class member is ————-
a. Private
b. Public
c. Protected
d. Global
Answer a
27. In a class, a member declared as ———– is not accessible from outside the class.
a. Public
b. Private
c. Protected
d. Static
Answer b
28. A constructor name is the same as the name of a ————
a. class
b. object
c. function
d. None of the above
Answer a
29. Class members are accessed using the —— operator in conjunction with the name of the object of a class.
a. Insertion operator
b. Extraction operator
c. This operator
d. Dot operator
Answer d
30. Members functions of a class are normally declared as ———
a. Private
b. Public
c. Protected
d. Static
Answer b
C++ Mcqs with answers – Set IV
31. —————- operator dynamically allocates memory for an object of a specified type.
a. Delete
b. new
d. malloc
e. calloc
Answer b
32. A member function declared static can access only ——– class members.
a. static
b. private
c. public
d. All of the above
Answer a
33. An array element is accessed using the ——- number.
a. Subscripted
b. Index
c. Integer
d. None of the above
Answer b
34. The elements of an array of size 5 are numbered from ——- to ——–.
a. 1, 5
b. 0 to 4
c. Either a or b
d. None of the above
Answer b
35. When a multidimensional array is accessed, each array is surrounded by ——–
a. Parenthesis
b. Brackets
c. Box brackets
d. Curly braces
Answer c
36. C style strings are ——- of type char.
a. array
b. alphabets
c. alphanumeric
d. Any
Answer a
37. The keyword ——– is used to overload an operator.
a. super
b. this
c. operator
d. new
Answer c
38. Call by reference is achieved by applying a ——– operator to the formal parameters.
a. &
b. *
c. ==
d. ->
Answer a
39. Conversion from a basic type to a class type may be achieved using ——–
a. Operator overloading
b. Constructor
c. New
d. None of the above
Answer b
40. ———– is the way to add features to existing classes without rewriting them.
a. Header file
b. Inheritance
c. Classification
d. Friend function
Answer b
C++ Mcqs with answers – Set V
41. The members declared as ———– and ———– in the base class may be accessed from a member function of the derived class.
a. Private, Protected
b. Public, Protected
c. Static, Public
d. Private and Static
Answer b
42. The process of inheriting features from many basic classes is known as ————
a. Multi-level inheritance
b. Multiple inheritance
c. Hierarchical Inheritance
d. Hybrid inheritance
Answer b
43. In the protected derivation, public members of the base class become …………. members of the derived class.
a. public
b. protected
c. private
d. None of the above
Answer b
44. In multipath inheritance, the duplication of inherited members from the grandparent class can be avoided by declaring the intermediate class as ———
a. Virtual
b. Public
c. Protected
d. Static
Answer a
45. A class that is designed only to act as a base class but not used to create object is known as ———
a. Superclass
b. Abstract class
c. Final class
d. Friend class
Answer b
46. Inheritance represents ——- relationships between classes.
a. is a
b. part of
c. has a
d. None of the above
Answer a
47. Composition represents ———- relationships between classes
a. is a
b. part of
c. has a
d. None of the above
Answer c
48. The ——– operator is used to specify a particular class.
a. this
b. dot
c. new
d. none of the above
Answer a
49. A function call resolved at run time is referred to as ———– binding
a. dynamic
b. run time
c. compile time
d. None of the above
Answer a
50. When we use the same function name in both the base class and derived classes dynamic binding is achieved by declaring the base class function as ———-
a. protected
b. virtual
c. pure virtual
d. public
Answer b