wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Week 7

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

the memory location where the computer stores the list of memory locations to which the system must return when methods end

a)

Call stack

b)

Assertion

c)

Catch or Specify Requirement

2.

a Java language feature that can help detect logic errors and debug a program.

a)

Call Stack

b)

Assertion

c)

Checked Exception

3.

a premature, unexpected, and inelegant end to a program.

a)

Crash

b)

Runtime error

c)

Try catch

4.

- statement that sends an Exception out of a block or a method so it can be handled elsewhere.

a)

Exception Statement

b)

Catch Statement

c)

Throw Statement

5.

exceptions that a programmer should plan for and from which a program should be able to recover.

a)

Unchecked Exceptions

b)

Checked Exceptions

c)

Multithreaded

6.

Which of the following does the same thing as the BufferedWriter class newLine() method?

a)

System.out.println()

b)

Path.getProperty("line.separator")

c)

System.getProperty("line.separator")

7.

Which of the following statements is true?

a)

Exceptions are more serious than Errors.

b)

Errors are more serious than Exceptions.

c)

Errors and Exceptions are different but equally serious.

8.

The code within a finally block executes when the try block ____________.

a)

identifies one or more Exceptions

b)

does not identify any Exceptions

c)

either a or b

d)

neither a or b

9.

A try block includes all of the following elements except ____________.

a)

the keyword try

b)

the keyword catch

c)

curly braces

d)

statements that might cause Exceptions

10.

Which of the following statements creates a Path named p to a FileStream named f?

a)

Path p = new Path("C:\\Java\\MyFile.txt");

b)

Path p = f("C:\\Java\\MyFile.txt");

c)

Path p = f.getPath("C:\\Java\\MyFile.txt");

d)

Path p = getPath(new f("C:\\Java\\MyFile.txt"));