Skip to main content

Object Oriented Programming MCQs with Answers

Practice important Object Oriented Programming MCQs with answers and explanations.

Multiple Choice Questions

Q481: What is the purpose of using polymorphism in a payroll application?
  • A: To calculate salaries based on employee type
  • B: To handle user input
  • C: To generate reports
  • D: To manage database connections
View Answer
A

Q482: Which method in the Employee class is used to calculate salary?
  • A: getName
  • B: calcSalary
  • C: getTax
  • D: applyBonus
View Answer
B

Q483: What is the base class in the payroll application example?
  • A: SalariedEmp
  • B: Employee
  • C: HourlyEmp
  • D: CommEmp
View Answer
B

Q484: How does the SalariedEmp class calculate salary?
  • A: By multiplying salary with tax rate
  • B: By adding salary and tax
  • C: By subtracting tax from salary
  • D: By multiplying hourly rate with hours worked
View Answer
C

Q485: What type of employee object is used to represent an employee paid by the hour?
  • A: SalariedEmp
  • B: HourlyEmp
  • C: CommEmp
  • D: TemporaryEmp
View Answer
B

Q486: Which class in the example represents an employee with a commission-based salary?
  • A: SalariedEmp
  • B: HourlyEmp
  • C: CommEmp
  • D: ManagerEmp
View Answer
C

Q487: In the generatePayroll function, what type of array is used to store employee objects?
  • A: Array of objects
  • B: Array of pointers to objects
  • C: Array of integers
  • D: Array of strings
View Answer
B

Q488: What is the correct way to achieve polymorphism with arrays in C++?
  • A: Use arrays of objects
  • B: Use arrays of pointers to objects
  • C: Use arrays of integers
  • D: Use arrays of strings
View Answer
B

Q489: What is a common mistake when trying to use polymorphism with arrays?
  • A: Using arrays of pointers
  • B: Using arrays of objects
  • C: Incorrectly calculating memory addresses
  • D: Not initializing arrays
View Answer
C

Q490: Which of the following statements is true regarding the use of arrays of objects for polymorphism?
  • A: They cause runtime errors due to incorrect address calculation
  • B: They work correctly and efficiently
  • C: They are easy to implement without issues
  • D: They are used for managing pointers to objects
View Answer
A

Test Your Knowledge

Take a timed quiz on Object Oriented Programming

🚀 Start Quiz Now