Prévia do material em texto
Certified Java Programmer Mock Exam 2
g. extends
h. select
i. break
j. dim
k. instanceOf
l. None of the Above
Question 6
1. class Basics1 {
2. public void main(String[] args) {}
3. }
4. class Basics2 {
5. public void main(String []args) {}
6. }
7. class Basics3 {
8. public void main(String args[]) {}
9. }
What is the result of attempting to compile and run the above programs?
a. Compiler error at line 2.
b. Compiler error at line 5.
c. Compiler error at line 8.
d. Run time error at line 2.
e. Run time error at line 5.
f. Run time error at line 8.
g. None of the Above
Question 7
Which of these words belong to the set of java keywords?
a. dispose
b. goto
c. begin
d. package
e. synchronized
f. default
g. interface
h. volatile
i. addressof
j. None of the Above
Question 8
class A {
public static void main (String[] args) {
// Insert code here.
}
}
Which of the following lines can be inserted at the specified location without generating a compile-time error?
a. char a = a;
b. char b = abc;
c. char c = \u0041;
d. char d = \uabcd;
e. None of the Above
Question 9
Which of these words belong to the set of java keywords?
a. virtual
b. goto
c. ifdef
d. typedef
e. friend
f. struct
g. implements
h. union
i. const
j. None of the Above
Question 10
class Violet {
public static void main (String[] s) {
System.out.print(s[1] + s[2] + s[3]);
}
}
Assume the above main method is invoked using the following
command line.
java Violet 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