Home /University Of Sargodha (UOS) /Object Oriented Programming

Object Oriented Programming BS 4 Semester/Term University Of Sargodha (UOS) 2022

Object Oriented Programming BS 4 Semester/Term University Of Sargodha (UOS) 2022 — page 1

Discussion

Ask a question about this paper, or help someone else with theirs. Answers are emailed to whoever asked.

Your email is only used to send you replies and occasional Ustadni updates. It is never shown publicly.

Log in to post under your name

No questions yet — be the first to ask.

More Object Oriented Programming papers

See all

Paper text

30229

Subject: L.T

Time Allowed: 02:30 Hours

University of Sargodha

Bs 2*4 Term Examination 2022

Paper: Object Oriented Programming (CMPC-102)

Maximum Marks: 40

Note: Objective part is compulsory. Aftempt any three questions from subjective part.

Objective Part

(Compulsory)

Q.1.

Ustad! What are the different types of arguments?

Wale for answers of the following in 2-3 lines cach on your answer sheet.

(2*8)

Tr What is the main difference between overteting and overriding?

HiA WHAT IS THE difference between maläpie and multilevel inheritance?

ive Explain the following line used under Java Program

public static void main (String argst ])

v. What is a pure virtual function?

vi. What are sealed modifiers?

vii. What is the difference between throw and throws?

ustadni.com

vili. What is the output of the following?

class Test

public static void main (String argsED

System.out.printin(20 + 30 + "Javatpoint"):

System.out.printin(" Javatpoint" + 20 + 30):

Subjective Part

(3"8)

Q.2.

Write a program that shows a constructor passing information about constructor failure to an exception

handler. Define class Some Class, which throws an Exception in the constructor. Your program should

try to create an object of type Some Class and catch the exception that's thrown from the constructor.

Q.3.

Write a temperature-conversion application that converts from Fahrenheit to Celsius. The Fahrenheit

temperature should be entered from the keyboard (via a TextField). An un-editable Textfield should

be used to display the converted temperature when user clicks on conversion button. Use the following

formula for the conversion:

Celsius - 5/9× (Fahrenheit - 32).

Q.4.

Create a constructor for the student class you created. The constructor should initialize each Student's

ID number to 9999, his or her points earned to 12, and credit hours to 3 (resulting in a grade point

average of 4.0). Write a program that demonstrates that the constructor works by instantiating an object

and displaying the initial values.

Q.5.

Write compile, and test a class that uses the command window to display the following statement about

cofathents: "Program comments are non-executing statements you add to a file for the purpose of

US documentation."

Also include the same statement-in three different comments in the class; cach

comment should use one of the three different methods of including comments in a Java clans

0.6.

Assume that the population of Mexico is 114 million and that the population increases 1.21 Percent

annually. Assume that the population of the United States is 312 million and that the population is

reduced 0.15 percent annually. Write an application that displays the populations for the two countries

every year until the population of Mexico exceeds that of the United States and display the number of

years it took.

LK-6981

Scanned with CamScanne

ustadni.com