Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 2 out of 9 pages
Exam (elaborations)

COMP 1231 Questions with complete solution 2025

Document preview thumbnail
Preview 2 out of 9 pages

COMP 1231 Questions with complete solution 2025 From which problems is it possible for a program to recover - correct answer Exceptions Both class Error and class Exception are children of this parent: - correct answer Throwable Is a program required to catch all exceptions that might happen? - correct answer No. You can write a program to catch just the exceptions you want. What type of exception is thrown by nextInt() if it gets illegal data - correct answer InputMismatchException try{} block - correct answer - Some will never throw an exception. - may throw several types of exception. - must appear before the catch{} blocks. - can contain loops or branches. catch{} block - correct answer - There can be several " " blocks in a try/catch structure.

Content preview

COMP 1231 Questions with complete
solution 2025
From which problems is it possible for a program to recover - correct answer
✔Exceptions


Both class Error and class Exception are children of this parent: - correct
answer ✔Throwable


Is a program required to catch all exceptions that might happen? - correct
answer ✔No. You can write a program to catch just the exceptions you want.


What type of exception is thrown by nextInt() if it gets illegal data - correct
answer ✔InputMismatchException


try{} block - correct answer ✔- Some will never throw an exception.


- may throw several types of exception.


- must appear before the catch{} blocks.


- can contain loops or branches.


catch{} block - correct answer ✔- There can be several " " blocks in a
try/catch structure.


- The " " block for a child exception class must PRECEDE that of a parent
exception class.

, - If there is no " " block there must be a finally{} block


What happens in a method if an exception is thrown in a try{} block and there
is NO MATCHING catch{} block? - correct answer ✔The method throws the
exception to its caller, exactly if there were no try{} block.


How many finally{} blocks may there be in a try/catch structure? - correct
answer ✔There can be zero or one, following the last catch{} block.


When is a finally{} block executed? - correct answer ✔Always after execution
has left a try{} block, no matter for what reason.


What is a method's signature? - correct answer ✔It is the name of the
method and the data types of its parameters.


What must be true if a child of an abstract parent class does not override all of
the parent's abstract methods - correct answer ✔The child class itself must
be declared to be abstract.


What must a non-abstract child do about an abstract method in its parent
class? - correct answer ✔A child must override an abstract method inherited
from its parent by defining a method with the same signature and same return
type


What type of inheritance does Java have? - correct answer ✔single
inheritance


Can an object be a subclass of another object? - correct answer ✔No—
inheritance is only between classes.

Document information

Uploaded on
August 13, 2025
Number of pages
9
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$17.99

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.
LEWISSHAWN55
2.9
(11)
Sold
96
Followers
46
Items
7346
Last sold
6 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