The pages of this web site are not formatted to conserve paper, but my new book (ISBN: 0-9745862-0-X) is formatted to save paper, save your printer cartridge, save a loose-leaf binder, and save money. If you prefer to work my exams from printed pages, then give your printer a rest and buy my new book.
Today, you can find my book at BookSurge.com.
Are you a university student studying Java programming? Do you agree that my book would serve as a helpful workbook and companion to be used along with the Java fundamentals textbook that is currently being used in your class? If so, then please ask your professor to consider using my book in future classes.
If you have any questions or comments concerning my mock exams or my book, then please send an e-mail to me at scjpexam2000@yahoo.com.
I would also like to read your response to the following questions.
Which of the follow are true statements.
| a. | A nested class is any class that is declared within the body of another class or interface. |
| b. | A nested class can not be declared within the body of an interface declaration. |
| c. | An inner class is a nested class that is not static. |
| d. | A nested class can not be declared static. |
| e. | A named class is any class that is not anonymous. |
Which of the follow are true statements.
| a. | A local class is declared within a method, constructor or block. |
| b. | An anonymous class is always a local class. |
| c. | A local class is a nested class. |
| d. | A local class is a member class. |
| e. | A local class is always a named class. |
Which of the following are class modifiers? Select all that are applicable to a top-level class and all that are applicable to a nested class. It is not required that a modifier be applicable to both.
| a. | abstract |
| b. | extends |
| c. | final |
| d. | implements |
| e. | private |
| f. | protected |
| g. | public |
| h. | static |
| i. | synchronized |
| j. | transient |
| k. | volatile |
Which of the following modifiers can be applied to a member class?
| a. | abstract |
| b. | final |
| c. | public |
| d. | protected |
| e. | private |
| f. | static |
| g. | synchronized |
| h. | transient |
Which of the following modifiers can be applied to a local class?
| a. | public |
| b. | protected |
| c. | private |
| d. | abstract |
| e. | static |
| f. | final |
class Z {
abstract class A {} // 1
final class B {} // 2
private class C {} // 3
protected class D {} // 4
public class E {} // 5
}
Which class declaration results in a compile-time error?
| a. | 1 |
| b. | 2 |
| c. | 3 |
| d. | 4 |
| e. | 5 |
| f. | None of the above |
class Z {
static class F {} // 1
synchronized class G {} // 2
transient class H {} // 3
volatile class I {} // 4
}
Which class declaration does not result in a compile-time error?
| a. | 1 |
| b. | 2 |
| c. | 3 |
| d. | 4 |
| e. | None of the above |
class Z {
void m1() {
abstract class A {} // 1
final class B {} // 2
private class C {} // 3
protected class D {} // 4
public class E {} // 5
}
}
Which class declarations result in compile-time errors?
| a. | 1 |
| b. | 2 |
| c. | 3 |
| d. | 4 |
| e. | 5 |
class Z {
void m1() {
static class F {} // 1
synchronized class G {} // 2
transient class H {} // 3
volatile class I {} // 4
abstract class A {} // 5
final class B {} // 6
}
}
Compile-time errors are generated at which lines?
| a. | 1 |
| b. | 2 |
| c. | 3 |
| d. | 4 |
| e. | 5 |
| f. | 6 |
class A {
A() {} // 1
int A; // 2
void A() {} // 3
class A {} // 4
}
Which line results in a compile-time error?
| a. | 1 |
| b. | 2 |
| c. | 3 |
| d. | 4 |
| e. | None of the above |
class A {
int B; // 1
void B() {} // 2
class B {} // 3
}
Which line results in a compile-time error?
| a. | 1 |
| b. | 2 |
| c. | 3 |
| d. | None of the above |
abstract class A { // 1
private abstract void m1(); // 2
private abstract class B {} // 3
private class C extends B {} // 4
}
Which line results in a compile-time error?
| a. | 1 |
| b. | 2 |
| c. | 3 |
| d. | 4 |
| e. | None of the above. |
abstract class A { // 1
abstract final void m1(); // 2
abstract final class B {} // 3
class C extends B {} // 4
}
Which line does not result in a compile-time error?
| a. | 1 |
| b. | 2 |
| c. | 3 |
| d. | 4 |
| e. | None of the above |
abstract class A { // 1
abstract synchronized void m1(); // 2
abstract synchronized class B {} // 3
synchronized class C extends B {} // 4
}
Which line does not result in a compile-time error?
| a. | 1 |
| b. | 2 |
| c. | 3 |
| d. | 4 |
| e. | None of the above |