0% found this document useful (0 votes)
2 views2 pages

Java OOP Mock Test with Explanations

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Java OOP Mock Test with Explanations

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Programming with Java: Chapterwise Mock Test with Explanations

Chapter 1: Fundamentals of Object-Oriented Programming

1. Which of the following is not a feature of object-oriented programming?

A. Encapsulation

B. Inheritance

C. Procedural abstraction

D. Polymorphism

Answer: C

Explanation: Procedural abstraction is a feature of procedural programming. OOP emphasizes

encapsulation, inheritance, and polymorphism.

2. Which of the following best describes encapsulation?

A. Deriving a new class from an existing class

B. Binding data and methods together

C. Using one name for multiple methods

D. Hiding the implementation details

Answer: B

Explanation: Encapsulation binds data and the code that manipulates it. It hides internal details and

exposes only required interfaces.

3. What is the term for the ability of different objects to respond in a unique way to the same

message?

A. Inheritance

B. Encapsulation

C. Abstraction

D. Polymorphism
Answer: D

Explanation: Polymorphism allows the same operation to behave differently on different classes.

4. What is the main advantage of object-oriented programming over procedural programming?

A. Easier to write code

B. Higher execution speed

C. Better code modularity and reuse

D. Lower memory consumption

Answer: C

Explanation: OOP encourages modular, reusable code by organizing it around objects and classes.

5. Which of the following languages is not object-oriented?

A. C++

B. Java

C. Python

D. C

Answer: D

Explanation: C is a procedural language. It does not support object-oriented features like classes

and objects natively.

You might also like