Object-Oriented Programming MCQs (Part-2)

What does Encapsulation prevent in OOP?

A Data security
B Data hiding
C Data abstraction
D Data leakage

What type of class is an Interface in OOP?

A Abstract
B Final
C Static
D Concrete

Which principle allows a derived class to reuse code from its base class?

A Polymorphism
B Inheritance
C Abstraction
D Encapsulation

What is a Constructor used for in a class?

A Method overloading
B Memory allocation
C Exception handling
D Object initialization

Which of these is an example of Method Overriding in OOP?

A Same name, same parameters
B Same name, different parameters
C Same method in different class
D Same name, different behavior

What does Polymorphism enable in OOP?

A Data hiding
B Method overriding
C Dynamic method invocation
D Object creation

Which access modifier allows a class to be accessed only within its package?

A Public
B Protected
C Default
D Private

What is the main goal of Abstraction?

A Class construction
B Simplifying complex systems
C Multiple inheritance
D Code reuse

What is the difference between static and dynamic binding?

A Compile-time vs runtime
B Class vs object
C Method vs constructor
D Data vs methods

Which of the following is an example of Exception Handling?

A Object serialization
B Method overloading
C Interface implementation
D Try-Catch block

What is the purpose of a Destructor in OOP?

A Return object to memory
B Manage inheritance
C Initialize object state
D Clean up resources

What is the purpose of Object Serialization?

A Data persistence
B Dynamic binding
C Method overloading
D Code execution

Which of the following is a design pattern used in OOP?

A Singleton
B Cloning
C Inheritance
D Memory management

Which of the following does Multithreading allow in OOP?

A Memory management
B Dynamic binding
C Concurrent execution
D Method overriding

What is UML used for in OOP?

A Data analysis
B Object serialization
C Visual representation of classes
D Code execution