0% found this document useful (0 votes)
6 views3 pages

OOP Java

The document outlines a written assessment for Object-Oriented Programming in Java, divided into two sections: short answer questions and extended response questions. It covers key concepts such as OOP principles, Java data types, inheritance, polymorphism, and the use of static and final keywords. The assessment includes programming tasks and theoretical questions to evaluate understanding of Java and OOP design principles.

Uploaded by

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

OOP Java

The document outlines a written assessment for Object-Oriented Programming in Java, divided into two sections: short answer questions and extended response questions. It covers key concepts such as OOP principles, Java data types, inheritance, polymorphism, and the use of static and final keywords. The assessment includes programming tasks and theoretical questions to evaluate understanding of Java and OOP design principles.

Uploaded by

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

OBJECT-ORIENTED PROGRAMMING – JAVA

WRITTEN ASSESSMENT
Time: 2 hours

SECTION A (40 MARKS) - SHORT ANSWER


QUESTIONS
Answer all questions in this section.

1. Define Object-Oriented Programming (OOP) and explain its significance in software


development. (4 Marks)
2. State and explain any four Object-Oriented Programming principles with examples.
(8 Marks)
3. Identify and describe any three Java data types and provide an example of each. (6
Marks)
4. Differentiate between instance variables and static variables in Java. (4 Marks)
5. Write a Java program that declares and initializes two integer variables, adds them, and
prints the result. (5 Marks)
6. Explain how Java handles input and output operations, highlighting the role of
Scanner and System.out.println(). (4 Marks)
7. What is an object in Java, and how is it related to a class? Provide an example. (5
Marks)
8. Explain the difference between method overloading and method overriding in Java. (4
Marks)

SECTION B (60 MARKS) - EXTENDED RESPONSE


QUESTIONS
Answer any three questions from this section.

QUESTION 9 (20 Marks) - OOD Principles and SOLID Principles

a) Explain the importance of Object-Oriented Design (OOD) in software development. (6


Marks)
b) Describe the five SOLID principles and how they improve software maintainability. (8
Marks)
c) Write a Java program that demonstrates the Liskov Substitution Principle (LSP) using a
superclass Bird and subclasses Parrot and Penguin. (6 Marks)
QUESTION 10 (20 Marks) - Inheritance

a) Define inheritance in Java and explain its role in code reuse. (6 Marks)
b) Write a Java program that demonstrates hierarchical inheritance, where Car and Bike
classes both inherit from a Vehicle class. (10 Marks)
c) Explain the significance of the super keyword in inheritance. (4 Marks)

QUESTION 11 (20 Marks) - Polymorphism

a) Define polymorphism and describe its types with examples. (6 Marks)


b) Write a Java program that demonstrates method overriding using a superclass Animal and
subclasses Dog and Cat. (10 Marks)
c) Why is method overriding useful in Object-Oriented Programming? (4 Marks)

QUESTION 12 (20 Marks) - Static and Final Keywords

a) Explain the difference between static methods and instance methods in Java. (6 Marks)
b) Write a Java program that demonstrates the use of a static variable and a static method in a
class. (10 Marks)
c) Describe how the final keyword is used in Java when applied to variables, methods, and
classes. (4 Marks)

QUESTION 13 (20 Marks) - Java Statements and I/O

a) Explain the role of conditional statements (if-else, switch) in Java. (6 Marks)


b) Write a Java program that prompts a user to enter a number, then checks if it is positive,
negative, or zero using an if-else statement. (8 Marks)
c) What is the importance of loops in Java? Briefly describe any two types of loops. (6 Marks)

QUESTION 14 (20 Marks) - Steps in Designing OOP Programs

a) Outline and explain the four main steps involved in designing an Object-Oriented Program.
(8 Marks)
b) Explain how the Open/Closed Principle (OCP) helps in software development. Provide an
example. (6 Marks)
c) Discuss the importance of class diagrams in Object-Oriented design. (6 Marks)
QUESTION 13 (20 Marks) - Classes, Objects, Methods, and Attributes

a) Define a class and an object in Java, and explain their relationship. (6 Marks)
b) Write a simple Java program that defines a class "Person" with attributes name and age, and
a method displayInfo() that prints the person's details. (8 Marks)
c) Explain the difference between instance methods and static methods in Java. (6 Marks)

You might also like