Java OOP Exam Questions, Exams of Java Programming

The documents contain java OOP QUESTIONS for Computer Science published by Winnie 2025

Typology: Exams

2025/2026

Available from 06/22/2026

winnie-wanjiku
winnie-wanjiku 🇷🇴

1 document

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
JAVA PROGRAMMING EXAM QUESTIONS
TOPIC: OBJECT-ORIENTED PROGRAMMING (OOP)
SECTION A: SHORT ANSWER QUESTIONS
1. Define Object-Oriented Programming (OOP).
2. State four principles of OOP.
3. What is a class in Java?
4. What is an object in Java?
5. Differentiate between a class and an object.
6. State three advantages of using OOP.
7. What is encapsulation?
8. Explain the meaning of inheritance in Java.
9. What is polymorphism?
10. State two types of polymorphism in Java.
SECTION B: STRUCTURED QUESTIONS
11. Explain the relationship between a class and an object using an example.
12. Describe the purpose of constructors in Java.
13. Write a Java class called Car with:
- Brand
- Model
- Year
Create an object and display the details.
14. Explain the difference between:
a) Method overloading
b) Method overriding
15. Describe how inheritance helps in code reuse.
16. Explain the purpose of access modifiers:
- public
- private
- protected
17. Write a Java program that creates a class Student with:
- Name
- Age
- Marks
Display student information using an object.
pf2

Partial preview of the text

Download Java OOP Exam Questions and more Exams Java Programming in PDF only on Docsity!

JAVA PROGRAMMING EXAM QUESTIONS

TOPIC: OBJECT-ORIENTED PROGRAMMING (OOP)

SECTION A: SHORT ANSWER QUESTIONS

  1. Define Object-Oriented Programming (OOP).
  2. State four principles of OOP.
  3. What is a class in Java?
  4. What is an object in Java?
  5. Differentiate between a class and an object.
  6. State three advantages of using OOP.
  7. What is encapsulation?
  8. Explain the meaning of inheritance in Java.
  9. What is polymorphism?
  10. State two types of polymorphism in Java.

SECTION B: STRUCTURED QUESTIONS

  1. Explain the relationship between a class and an object using an example.
  2. Describe the purpose of constructors in Java.
  3. Write a Java class called Car with:
  • Brand
  • Model
  • Year

Create an object and display the details.

  1. Explain the difference between:

a) Method overloading

b) Method overriding

  1. Describe how inheritance helps in code reuse.
  2. Explain the purpose of access modifiers:
  • public
  • private
  • protected
  1. Write a Java program that creates a class Student with:
  • Name
  • Age
  • Marks

Display student information using an object.

  1. Explain abstraction in Java and give an example.
  2. Describe the difference between an object variable and a class variable.
  3. Explain five OOP keywords used in Java.

SECTION C: PRACTICAL PROGRAMMING QUESTIONS

  1. Create a Java program using a class BankAccount with:
  • Account number
  • Account holder name
  • Balance

Include methods to deposit and display balance.

  1. Write a Java program demonstrating inheritance using:
  • Parent class: Animal
  • Child class: Dog
  1. Create a Java program that demonstrates method overloading.
  2. Write a Java program that uses encapsulation by creating private variables and getter/setter methods.
  3. Create a Java program showing polymorphism using a parent class and child class.