C++ Multiple Choice Questions
61. Which of the following is the most general exception handler that catches exception of ‘any type’?
a. catch(std::exception)
b. catch(std::any_exception)
c. catch(…)
d. catch()
62. In a group of nested loops, which loop is executed the most number of times?
a. the outermost loop
b. the innermost loop
c. all loops are executed the same number of times
d. cannot be determined without knowing the size of the loops
63. What is the Difference between struct and class in terms of Access Modifier?
a. By default all the struct members are private while by default class members are public.
b. By default all the struct members are protected while by default class members are private.
c. By default all the struct members are public while by default class members are private.
d. By default all the struct members are public while by default class members are protected.
64. Inline functions are invoked at the time of
a. Run time
b. Compile time
c. Depends on how it is invoked
d. Both b and c above
65. What is shallow copy?
a. A shallow copy creates a copy of the dynamically allocated objects too.
b. A shallow copy just copies the values of the data as they are.
c. A shallow copy creates a copy of the statically allocated objects too
d. Both b and c above
66. What is deep copy?
a. A deep copy creates a copy of the dynamically allocated objects too.
b. A deep copy just copies the values of the data as they are.
c. A deep copy creates a copy of the statically allocated objects too
d. Both b and c above
67. Which of the following below is /are a valid iterator type?
a. Input Iterator
b. Backward Iterator
c. Forward Iterator
d. Both a and c above
68. What defines a general set of operations that will be applied to various types of data?
a. Template class
b. Function template
c. Class template
d. Both a and c above
69. Under which of the following circumstances, synchronization takes place?
a. When the file is closed
b. When the buffer is empty
c. Explicitly, with manipulators
d. both a and c
70. Which of the following functions below can be used Allocate space for array in memory?
a. calloc()
b. malloc()
c. Realloc()
d. both a and b
71. Statement scanf(“%d”,80);
a. Assign an integer to variable i
b. Give an error message
c. Print the value of i
d. Assign an float to variable i
72. STL is based on which of the following programming paradigms?
a. Structured Programming
b. Object Oriented Programming (OOP)
c. Functional Programming
d. Aspect Oriented Programming (AOP)
73. STL is based on which of the following programmingparadigms?
a. Structured Programming
b. Object Oriented Programming (OOP)
c. Functional Programming
d. Aspect Oriented Programming (AOP)
74. If there is more than one statement in the block of a for loop, which of the following must be placed at the beginning and the ending of the loop block?
a. parentheses ( )
b. braces { }
c. brackets [ ].
d. arrows < >
75. Which of the following members do get inherited but become private members in child class
a. Public
b. Private
c. Protected
d. All the above
76. Which looping process is best used when the number of iterations is known?
a. for
b. while
c. do-while
d. all looping processes require that the iterations be known
77. In a C language ‘3’ represents
a. A digit
b. An integer
c. A character
d. A word
78. Which of the following is the most common way of implementing C++?
a. C++ programs are directly compiled into native code by a compiler
b. C++ programs are first compiled to intermediate code by a compiler and then executed by a virtual machine
c. C++ programs are interpreted by an interpreter
d. A C++ editor directly compiles and executes the program
79. Which header file should we include for using std::auto_ptr?
a.
b.
c.
d.
80. Which of the following operators can be implemented as a nonmember operator?
#NAME?
b. () (function call operator)
c. [. (array access operator)
d. + (addition operator)
Correct Answers to C++ MCQ Questions
61 – c | 62 – c | 63 – b | 64 – c | 65 – b | 66 – b | 67 – a | 68 – d | 69 – b | 70 – d |
71 – a | 72 – a | 73 – c | 74 – c | 75 – b | 76 – c | 77 – a | 78 – c | 79 – a | 80 – c |
Please, let us know if you discover any error or mistake in these MCQ sets. Don’t hesitate to leave your comments.
Download MCQ Questions PDF File for C++
Please visit Downloads section to download the pdf file of these MCQs from C++.
Other C++ MCQ Questions
Leave a Reply