πŸ“Š CPP Programming
Q. Which of the following is a correct statement?
  • (A) Composition is a strong type of association between two classes with full ownership.
  • (B) Composition is a strong type of association between two classes with partial ownership.
  • (C) Composition is a weak type of association between two classes with partial ownership.
  • (D) Composition is a weak type of association between two classes with strong ownership.
πŸ’¬ Discuss
βœ… Correct Answer: (A) Composition is a strong type of association between two classes with full ownership.
πŸ“Š CPP Programming
Q. Which of the following is not a correct statement?
  • (A) Every class containing abstract method must be declared abstract.
  • (B) Abstract class can directly be initiated with ‘new’ operator.
  • (C) Abstract class can be initiated.
  • (D) Abstract class does not contain any definition of implementation.
πŸ’¬ Discuss
βœ… Correct Answer: (B) Abstract class can directly be initiated with ‘new’ operator.
πŸ“Š CPP Programming
Q. When a method in a subclass has the same name and type signatures as a method in the superclass, then the method in the subclass _____ the method in the superclass.
  • (A) Overloads
  • (B) Friendships
  • (C) Inherits
  • (D) Overrides
πŸ’¬ Discuss
βœ… Correct Answer: (D) Overrides
πŸ“Š CPP Programming
Q. It is possible to define a class within a class termed as nested class. There are _____ types of nested classes.
  • (A) 2
  • (B) 3
  • (C) 4
  • (D) 5
πŸ’¬ Discuss
βœ… Correct Answer: (A) 2
πŸ“Š CPP Programming
Q. When one object reference variable is assigned to another object reference variable then
  • (A) a copy of the object is created.
  • (B) a copy of the reference is created.
  • (C) a copy of the reference is not created.
  • (D) it is illegal to assign one object reference variable to another object reference variable.
πŸ’¬ Discuss
βœ… Correct Answer: (B) a copy of the reference is created.
πŸ“Š CPP Programming
Q. Which of the following is not a member of class?
  • (A) Static function
  • (B) Friend function
  • (C) Const function
  • (D) Virtual function
πŸ’¬ Discuss
βœ… Correct Answer: (B) Friend function
πŸ“Š CPP Programming
Q. How can we restrict dynamic allocation of objects of a class using new?
  • (A) By overloading new operator
  • (B) By making an empty private new operator.
  • (C) By making an empty private new and new[] operators
  • (D) By overloading new operator and new[] operators
πŸ’¬ Discuss
βœ… Correct Answer: (C) By making an empty private new and new[] operators
πŸ“Š CPP Programming
Q. Which of the following operators cannot be overloaded?
  • (A) . (Member Access or Dot operator)
  • (B) ?: (Ternary or Conditional Operator)
  • (C) :: (Scope Resolution Operator)
  • (D) All of the above
πŸ’¬ Discuss
βœ… Correct Answer: (D) All of the above
πŸ“Š CPP Programming
Q. Which of the following operators are overloaded by default by the compiler in every user defined classes even if user has not written? 1) Comparison Operator (==) 2) Assignment Operator (=)
  • (A) Both 1 and 2
  • (B) Only 1
  • (C) Only 2
  • (D) None of the two
πŸ’¬ Discuss
βœ… Correct Answer: (C) Only 2
πŸ“Š CPP Programming
Q. Which of the following operators should be preferred to overload as a global function rather than a member method?
  • (A) Postfix ++
  • (B) Comparison Operator
  • (C) Insertion Operator <<
  • (D) Prefix++
πŸ’¬ Discuss
βœ… Correct Answer: (C) Insertion Operator <<

Jump to