Multiple Choice Questions Set 1
This page lists 20 multiple choice questions from C++ covering all the aspects of the language. Click here to go to the answers page for multiple choice questions set 1.
1. Which of the following languages is a subset of C++ language?
A. C language
B. Java Language
C. C# language
D. B language
2. Which of the following correctly describes C++ language?
A. Statically typed language
B. Dynamically typed language
C. Both Statically and dynamically typed language
D. Type-less language
3. Which of the following keyword supports dynamic method resolution?
A. abstract
B. Virtual
C. Dynamic
D. Typeid
4. Which of the following language is not supported by C++?
A. Exception Handling
B. Reflection
C. Operator Overloading
D. Namespaces
5. Which of the following language feature is not an access specifier in C++?
A. public
B. private
C protected
D. internal
6. What does STL stand for?
A. Simple Template Library
B. Standard Template Library
C. Static Type Library
D. Single Type-based Library
7. 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
8. What is the implicit pointer that is passed as the first argument for nonstatic member functions?
A. ‘self’ pointer
B. std::auto_ptr pointer
C. ‘Myself’ pointer
D. ‘this’ pointer
9. If X is the name of the class, what is the correct way to declare copy constructor of X?
A. X(X arg)
B. X(X* arg)
C. X(const X* arg)
D. X(const X& arg)
10. Which of the following operator cannot be overloaded?
A. = (assignment operator)
B. == (equality operator)
C. –> (rrow operator)
D. :: (cope resolution operator)
11. Which of the following operators can be overloaded?
A. . (dot or member access operator)
B. & (address-of operator)
C. sizeof operator
D. ?: (conditional operator)
12. 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++
13. 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++
14. How many copies of a class static member are shared between objects of the class?
A. A copy of the static member is shared by all objects of a class
B. A copy is created only when at least one object is created from that class
C. A copy of the static member is created for each instntiation of the class
D. No memory is allocated for static members of a class
15. Which of the following is true about const member functions?
A. const members can be invoked on both const as well as nonconst objects
B. const members can be invoked only on const objects and not on nonconst objects
C. nonconst members can be invoked on const objects as well as nonconst objects
D. none of the above
16. When is std::bad_alloc exception thrown?
A. When new operator cannot allocate memory
B. When alloc function fails
C. When type requested for new operation is considered bad, this exception is thrown
D. When delete operator cannot delete teh allocated (corrupted) object
17. Which header file should we include for using std::auto_ptr?
a. <memory>
B. <alloc>
C. <autoptr>
D. <smartptr>
18. 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)
19. 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
20. 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()
These were the twenty multiple choice questions from C++ covering all the aspects of the language. Click here to go to the answers page for multiple choice questions set 1.
No related posts.

[...] C++ Studies « Multiple Choice Questions Set 1 [...]
[...] on Monday, June 7th, 2010 and is filed under Multiple Choice Questions. You can click here to go to Questions of Set 1 and the Answers of Set [...]