1. What does a pointer variable hold in C++?
A) Memory address of another variable
B) Value of the variable
C) Size of the variable
D) None of the above
Show Explanation
2. Which of the following is used to dynamically allocate memory in C++?
A) malloc
B) new
C) create
D) allocate
Show Explanation
3. What does STL stand for in C++?
A) Standard Template Library
B) Standard Type Library
C) Simple Template Library
D) Simple Type Library
Show Explanation
4. What is the 'this' pointer in C++?
A) Pointer to the class
B) Pointer to the invoking object
C) Pointer to the base class
D) None of the above
Show Explanation
5. Which symbol is used to declare a destructor in C++?
A) ~
B) !
C) #
D) *
Show Explanation
6. Which of the following is an access specifier in C++?
A) external
B) public
C) internal
D) static
Show Explanation
7. What is a friend function in C++?
A) A function defined inside the class
B) A function that returns a class object
C) A function that is accessible only to other friend classes
D) A function that has access to private members of the class
Show Explanation
8. What is 'cin' used for in C++?
A) Displaying output
B) Reading files
C) Taking input from standard input
D) None of the above
Show Explanation
9. Which operator is used in C++ to define a function outside a class?
A) . (dot)
B) -> (arrow)
C) :: (scope resolution)
D) & (address)
Show Explanation
10. What is the default access specifier for members of a class in C++?
A) private
B) public
C) protected
D) static
Show Explanation
11. Why are inline functions used in C++?
A) To improve security
B) To enhance polymorphism
C) To handle exceptions
D) To reduce function call overhead
Show Explanation
12. What is a reference variable in C++?
A) A variable that points to another variable
B) An alias for another variable
C) A constant variable
D) A global variable
Show Explanation
13. Which keyword allows a function to be overridden in derived classes in C++?
A) override
B) abstract
C) virtual
D) protected
Show Explanation
14. Which operator is used to free the memory allocated by 'new' in C++?
A) delete
B) free
C) remove
D) discard
Show Explanation
15. What is a constructor in C++?
A) A function that destroys objects
B) A function called automatically upon object creation
C) A member variable of the class
D) A function that initializes all objects
Show Explanation
16. What does overloading mean in C++?
A) Using the same function name with different parameters
B) Using the same function name in different classes
C) Using the same variable name in different functions
D) None of the above
Show Explanation
17. What does polymorphism enable in C++?
A) Memory management
B) Efficient file handling
C) Different behavior for the same function based on object type
D) None of the above
Show Explanation
18. What is multiple inheritance in C++?
A) A class inheriting from more than one base class
B) A function calling multiple classes
C) A class having multiple constructors
D) None of the above
Show Explanation
19. Which keyword is used in C++ to allocate memory dynamically?
A) malloc
B) calloc
C) new
D) memory
Show Explanation
20. What is a pure virtual function in C++?
A) A function with default implementation
B) A function that calls virtual functions
C) A function used for polymorphism
D) A function with no body that must be overridden
Show Explanation