C++ Multiple Choice Questions
41. Which of the following correctly describes the meaning of ‘namespace’ feature in C++?
a. Namespaces refer to the memory space allocated for names used in a program
b. Namespaces refer to space between teh names in a program
c. Namespaces refer to space between the names in a program
d. namespaces provide facilities for organizing the names in a program to avoid name clashes
42. Which of the following language is not supported by C++?
a. Exception Handling
b. Reflection
c. Operator Overloading
d. Namespaces
43. class derived: public base1, public base2 { } is an example of
a. Polymorphic inheritance
b. Multilevel inheritance
c. Hierarchical inheritance
d. Multiple inheritance
44. Which of the following languages is a subset of C++ language?
a. C language
b. Java Language
c. C# language
d. language
45. How do we declare an ‘interface’ class?
a. By making all the methods pure virtual in a class
b. By making all the methods abstract using the keyword ‘abstract’ in a class
c. By declaring the class as interface with the keyword ‘interface’
d. It is not possible to create interface class in C++
46. How do we declare an abstract class?
a. By providing at least one pure virtual method (function signature followed by ==0;) in a class
b. By declaring at least one method abstract using the keyword ‘abstract’ in a class
c. By declaring the class abstract with the keyword ‘abstract’
d. It is not possible to create abstract classes in C++
47. Which of the following is not an advantage of secondary memory
a. It is cost-effective
b. It has large storage capacity
c. It has highest speed
d. It is easily portable
48. What happens when a pointer is deleted twice?
a. It can abort the program
b. It can cause a failure
c. It can cause an error
d. It can cause a trap
49. Which of the following language feature is not an access specifier in C++?
a. public
b. private
c. C protected
d. internal
50. Expression C=i++ causes
a. Value of i assigned to C and then i incremented by 1
b. i to be incremented by 1 and then value of i assigned to C
c. Value of i assigned to C
d. i to be incremented by 1
51. The statement i++; is equivalent to
a. i = i + i;
b. i = i + 1;
c. i = i - 1;
d. i --;
52. In C language, a hexadecimal number is represented by writing
a. x
b. xo
c. ox
d. h
53. Which of the following library function below by default aborts the program?
a. Terminate()
b. end()
c. Abort()
d. exit()
54. If a member needs to have unique value for all the objects of that same class, declare the member as
a. Global variable outside class
b. Local variable inside constructor
c. Static variable inside class
d. Dynamic variable inside class
55. Value of ix+j, if i,j are integer type and ix long type would be
a. integer
b. float
c. long integer
d. double percision
56. Which of the following below can perform conversions between pointers to related classes?
a. A. cast_static
b. B. dynamic_cast
c. c. static_cast
d. D. cast_dynamic
57. How do we define a constructor?
a. a. x~() {}
b. B. X() {}~
c. C. X() ~{}
d. D. ~X() {}
58. Vtables
a. creates a static table per class
b. creates a static table per object
c. creates a dynamic table per class
d. creates a dynamic table per object
59. When class B is inherited from class A, what is the order in which the constructers of those classes are called
a. Class A first Class B next
b. Class B first Class A next
c. Class B's only as it is the child class
d. Class A's only as it is the parent class
60. 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()
Correct Answers to C++ MCQ Questions
41 - d | 42 - d | 43 - b | 44 - d | 45 - a | 46 - a | 47 - a | 48 - c | 49 - d | 50 - d |
51 - a | 52 - b | 53 - d | 54 - a | 55 - b | 56 - c | 57 - C | 58 - D | 59 - a | 60 - a |
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++.
Priyanka Mahani says
Superb collection for ready reference and placement preparation.
Thank you for sharing..
prasanjeet says
In Q 43
Ans is Multiple inheritance
class P: public M,public N
{
body//
}
hinoto says
Sir most of your ans are wrong