Q. Every class has at least one constructor function, even when none is declared.

  • (A) true
  • (B) false
  • (C) ---
  • (D) ---
πŸ’¬ Discuss
βœ… Correct Answer: (A) true

Q. What is the difference between struct and class in terms of Access Modifier?

  • (A) by default all the struct members are private while by default class members are public.
  • (B) by default all the struct members are protected while by default class members are private.
  • (C) by default all the struct members are public while by default class members are private.
  • (D) by default all the struct members are public while by default class members are protected.
πŸ’¬ Discuss
βœ… Correct Answer: (C) by default all the struct members are public while by default class members are private.

Q. The default access level assigned to members of a class is

  • (A) private
  • (B) public
  • (C) protected
  • (D) needs to be assigned
πŸ’¬ Discuss
βœ… Correct Answer: (A) private

Q. Which of the following operators allow defining the member functions of a class outside the class?

  • (A) ::
  • (B) ?
  • (C) :?
  • (D) %
πŸ’¬ Discuss
βœ… Correct Answer: (A) ::

Q. Which type of class has only one unique value for all the objects of that same class?

  • (A) this
  • (B) friend
  • (C) static
  • (D) both a and b
πŸ’¬ Discuss
βœ… Correct Answer: (C) static

Q. Which one of the following is not a fundamental data type in C++?

  • (A) float
  • (B) string
  • (C) int
  • (D) char
πŸ’¬ Discuss
βœ… Correct Answer: (B) string

Q. What is a constructor?

  • (A) a class automatically called whenever a new object of this class is created.
  • (B) a class automatically called whenever a new object of this class is destroyed.
  • (C) a function automatically called whenever a new object of this class is created.
  • (D) a function automatically called whenever a new object of this class is destroyed.
πŸ’¬ Discuss
βœ… Correct Answer: (C) a function automatically called whenever a new object of this class is created.

Jump to