Skip to main content

Object Oriented Programming MCQs with Answers

Practice important Object Oriented Programming MCQs with answers and explanations.

Multiple Choice Questions

Q341: What is the output of the following code? String s(“434"); cout << s.AsInt();
  • A: Junk value
  • B: 434
  • C: 0
  • D: -1
View Answer
B

Q342: The type conversion from String to int is implemented using which function?
  • A: operator int()
  • B: operator char*()
  • C: AsInt()
  • D: GetStringPtr()
View Answer
A

Q343: In the modified String class, what does the GetStringPtr() function return?
  • A: The size of the string
  • B: A pointer to the string
  • C: The integer value
  • D: NULL
View Answer
B

Q344: What is the relationship represented by inheritance in C++?
  • A: HAS A
  • B: IS A
  • C: USES A
  • D: CONTAINS A
View Answer
B

Q345: In C++, which of the following is NOT a type of inheritance?
  • A: Public
  • B: Private
  • C: Protected
  • D: Virtual
View Answer
D

Q346: What is the class that inherits from another class called?
  • A: Base Class
  • B: Parent Class
  • C: Derived Class
  • D: None of the above
View Answer
C

Q347: What is the class whose behavior is being inherited called?
  • A: Base Class
  • B: Derived Class
  • C: Child Class
  • D: Sibling Class
View Answer
A

Q348: In C++, public members of a base class become what in the derived class?
  • A: Private members
  • B: Protected members
  • C: Public members
  • D: No access
View Answer
C

Q349: In C++, the default constructor of a base class must exist if:
  • A: The derived class object is created
  • B: The derived class has a destructor
  • C: The derived class has a constructor
  • D: The derived class does not exist
View Answer
A

Q350: Which constructor is executed first when an object of a derived class is created?
  • A: Derived class constructor
  • B: Base class constructor
  • C: Any constructor
  • D: None of the above
View Answer
B

Test Your Knowledge

Take a timed quiz on Object Oriented Programming

🚀 Start Quiz Now