• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 4 out of 38 pages
Exam (elaborations)

COMPUTER PROGRAMMING EXAM QUESTIONS AND ANSWERS 2025

Document preview thumbnail
Preview 4 out of 38 pages

COMPUTER PROGRAMMING EXAM QUESTIONS AND ANSWERS 2025

Content preview

COMPUTER LATEST
PROGRAMMING EXAM
ANSWER ALL QUESTIONS IN THIS SECTION



QUESTION 1



Which of the following is correct?



A) a parent class is a subclass of its child

B) a base class is a child class or derived class

C) a base class is a parent class or super class

D) a child class is a super class of its parent

E) None of these are correct - ANSWERS-C



QUESTION 2



An int array stores the following values: 9, 4, 12, 2, 6, 8,



Which of the following lists of numbers would accurately show the array after the
third pass of

the selection sort algorithm?



END OF
PAGE
1

, COMPUTER LATEST
PROGRAMMING EXAM
A) 9, 4, 12, 2, 6, 8, 18

B) 2, 4, 6, 9, 8, 12, 18

C) 2, 4, 12, 9, 6, 8, 18

D) 2, 4, 6, 9, 12, 8, 18

E) 2, 4, 9, 12, 6, 8, 18 - ANSWERS-D



QUESTION 3



Polymorphism is achieved by



A) overloading

B) overriding

C) embedding

D) abstraction

E) encapsulation - ANSWERS-B




END OF
PAGE
2

, COMPUTER LATEST
PROGRAMMING EXAM
QUESTION 4



Assume that Student, Employee and Retired are all extended classes of Person, and
all

four classes have different implementations of the method getMoney. Consider the
following code

where . . . indicates the required parameters for the constructors:



Person p = new Person(...);

int m1 = p.getMoney();

p = new Student(...);

int m2 = p.getMoney();

if (m2 < 100000) p = new Employee(...);

else if (m1 > 50000) p = new Retired(...);

int m3 = p.getMoney(); // assignment 3

The reference to getMoney() in assignment 3 is to the class



A) Person

B) Student

C) Employee

END OF
PAGE
3

, COMPUTER LATEST
PROGRAMMING EXAM
D) Retired

E) This cannot be determined by

examining the code - ANSWERS-E



QUESTION 6



What class hierarchy involving classes L, M, and N would make the following
code valid?



L l; M m; N n;

l = new M(); l = new N(); m = new N();



A) Classes M and N must both be subclasses of class L.

B) Class M must be a subclass of class N, which is a subclass of class L.

C) Class N must be a subclass of class M, which is a subclass of class L.

D) Classes L must be a subclass of class M and also a subclass of class N.

E) There is no class hierarchy that would allow this code. - ANSWERS-C




END OF
PAGE
4

Document information

Uploaded on
May 22, 2025
Number of pages
38
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers
$18.49

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
Teacher101
4.6
(278)
Sold
524
Followers
74
Items
11560
Last sold
4 days ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions