Q. Which of the following statements about constructors in C++ is false?

  • (A) A constructor has the same name as the class.
  • (B) A constructor does not have a return type.
  • (C) A constructor can be private.
  • (D) A constructor must be explicitly called when creating an object.
πŸ’¬ Discuss
βœ… Correct Answer: (D) A constructor must be explicitly called when creating an object.
Explanation: A constructor is automatically called when an object is instantiated.

Q. Which keyword is used to declare a constant variable in C++?

  • (A) define
  • (B) const
  • (C) static
  • (D) constant
πŸ’¬ Discuss
βœ… Correct Answer: (B) const
Explanation: The 'const' keyword is used to declare a constant variable in C++.

Q. What is the default access specifier for class members in C++?

  • (A) public
  • (B) private
  • (C) protected
  • (D) None of the above
πŸ’¬ Discuss
βœ… Correct Answer: (B) private
Explanation: By default, all class members in C++ are private unless specified otherwise.

Q. Which function is used to release dynamically allocated memory in C++?

  • (A) free()
  • (B) delete
  • (C) release()
  • (D) dispose()
πŸ’¬ Discuss
βœ… Correct Answer: (B) delete
Explanation: The 'delete' keyword is used to release dynamically allocated memory in C++.

Q. Which operator is used to resolve ambiguity in multiple inheritance?

  • (A) ::
  • (B) ->
  • (C) .*
  • (D) None of the above
πŸ’¬ Discuss
βœ… Correct Answer: (A) ::
Explanation: The scope resolution operator (::) is used to resolve ambiguity in multiple inheritance.

Q. Which of the following is an example of function overloading in C++?

  • (A) Using multiple functions with the same name but different parameters
  • (B) Using a function with the same name in a derived class
  • (C) Using a function inside a loop
  • (D) Defining a function inside a structure
πŸ’¬ Discuss
βœ… Correct Answer: (A) Using multiple functions with the same name but different parameters
Explanation: Function overloading allows multiple functions with the same name but different parameters.