0% found this document useful (0 votes)
2 views1 page

Java OOP Rectangle Assessment

The document presents an assessment on a Rectangle program in Java, focusing on Object-Oriented Programming concepts, method purposes, expected outputs, access modifiers, and exception handling. It includes questions about class identification, method functionalities, program output based on user input, and the effects of changing variable access levels. Additionally, it tests knowledge on error handling with multiple-choice questions regarding user input scenarios.

Uploaded by

V. Arun Sundar
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)
2 views1 page

Java OOP Rectangle Assessment

The document presents an assessment on a Rectangle program in Java, focusing on Object-Oriented Programming concepts, method purposes, expected outputs, access modifiers, and exception handling. It includes questions about class identification, method functionalities, program output based on user input, and the effects of changing variable access levels. Additionally, it tests knowledge on error handling with multiple-choice questions regarding user input scenarios.

Uploaded by

V. Arun Sundar
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

Java OOP Assessment - Rectangle Program

Based on the given Rectangle program, answer the following questions.

Question 1 (Conceptual)
Identify the class and object in the program. Explain how this program demonstrates the
concept of Object-Oriented Programming (OOP).

Question 2 (Method & Return Type)


Explain the purpose of the methods setw(int x), seth(int x), and area(). What will happen if
the return type of area() is changed from int to void?

Question 3 (Find the Output)


If the input given is:
5
10

What will be the output? Justify your answer.

Question 4 (Access Modifier)


If the variables w and h are changed to private, will the program still work? Explain your
reasoning.

Question 5 (Exception Handling - MCQ)


If the user inputs:
5
abc

What will happen?

A) Compilation Error
B) Runtime Error - NumberFormatException
C) Runtime Error - InputMismatchException
D) Output will be 0

Choose the correct answer and justify.

You might also like