Dan Chisholm's
Java Programmer Certification Mock Exam

Please Help Save a Tree!

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 amazon.com.

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.


Question 1


class GRC10 {
  public static void main (String[] s) {
    System.out.print(s[1] + s[2] + s[3]);
}}
java GRC10 A B C D E F

What is the result of attempting to compile and run the program using the specified command line?

a. Prints: ABC
b. Prints: BCD
c. Prints: CDE
d. Prints: A B C
e. Prints: B C D
f. Prints: C D E
g. Compile-time error
h. Run-time error
i. None of the above

Question 2

class GRC4 {public static void main(String[] args) {}} // 1
class GRC5 {public static void main(String []args) {}} // 2
class GRC6 {public static void main(String args[]) {}} // 3

What is the result of attempting to compile and run the above programs?

a. Compile-time error at line 1.
b. Compile-time error at line 2.
c. Compile-time error at line 3.
d. An attempt to run GRC4 from the command line fails.
e. An attempt to run GRC5 from the command line fails.
f. An attempt to run GRC6 from the command line fails.
g. None of the above

Question 3

class GRC7 {public void main(String[] args) {}} // 1
class GRC8 {public void main(String []args) {}} // 2
class GRC9 {public void main(String args[]) {}} // 3

What is the result of attempting to compile and run the above programs?

a. Compile-time error at line 1.
b. Compile-time error at line 2.
c. Compile-time error at line 3.
d. An attempt to run GRC7 from the command line fails.
e. An attempt to run GRC8 from the command line fails.
f. An attempt to run GRC9 from the command line fails.

Question 4

class GRC1 {public static void main(String[] args) {}}    // 1
class GRC2 {protected static void main(String[] args) {}} // 2
class GRC3 {private static void main(String[] args) {}}   // 3

What is the result of attempting to compile each of the three class declarations and invoke each main method from the command line?

a. Compile-time error at line 1.
b. Compile-time error at line 2.
c. Compile-time error at line 3.
d. An attempt to run GRC1 from the command line fails.
e. An attempt to run GRC2 from the command line fails.
f. An attempt to run GRC3 from the command line fails.


Copyright © 2002-2004, Dan Chisholm
All rights reserved.