Java Exam UPDATED ACTUAL Exam Questions and CORRECT
Answers
8 - One byte has ________ bits.
Sun Microsystems - Java was developed by ____________.
System.out.println ("Welcome to Java"); - Which of the following statements is correct to display
Welcome to Java on the console? a) System.out.println ('Welcome to Java');
b) System.out.println ("Welcome to Java");
c) system.println ("Welcome to Java");
d) System.out.print ('Welcome to Java'); e) system.out.print ("Welcome to Java");
Test.java - Suppose you define a Java class as follows: public class Test {
}
In order to compile this program, the source code should be stored in a file named
-- comments - Which of the following lines is not a Java comment? a) /** comments */
b) // comments
c) -- comments
d) /* comments */
e) //** comments **\\
int length, width; - Which of the following is a correct way to declare variables? a) int length: int
width;
b) int length, width;
c) int length; width;
, d) int length, int width; e) none of the above
5 - 14. What is the value of variable i printed by the following code?
public class Test {
public static void main(String[] args) {
int j = 0; inti=++j *5;
System.out.println("What is i? " + i); }
}
class - The reserved word __________ is required to declare a class
a logical error - If a program compiles fine, but it produces incorrect result, then the program
suffers __________.
0 - What is the value of variable i printed by the following code?
public class Test {
public static void main(String[] args) {
int j = 0;
int i = j++ * 5;
System.out.println("What is i? " + i); }
}
Java123 - The expression "Java " + 1 + 2 + 3 evaluates to ________.
A constructor - ________ is invoked to create an object.
x contains a reference to a Account object. - Given the declaration Account x = new Account (),
which of the following statement is most accurate.
Answers
8 - One byte has ________ bits.
Sun Microsystems - Java was developed by ____________.
System.out.println ("Welcome to Java"); - Which of the following statements is correct to display
Welcome to Java on the console? a) System.out.println ('Welcome to Java');
b) System.out.println ("Welcome to Java");
c) system.println ("Welcome to Java");
d) System.out.print ('Welcome to Java'); e) system.out.print ("Welcome to Java");
Test.java - Suppose you define a Java class as follows: public class Test {
}
In order to compile this program, the source code should be stored in a file named
-- comments - Which of the following lines is not a Java comment? a) /** comments */
b) // comments
c) -- comments
d) /* comments */
e) //** comments **\\
int length, width; - Which of the following is a correct way to declare variables? a) int length: int
width;
b) int length, width;
c) int length; width;
, d) int length, int width; e) none of the above
5 - 14. What is the value of variable i printed by the following code?
public class Test {
public static void main(String[] args) {
int j = 0; inti=++j *5;
System.out.println("What is i? " + i); }
}
class - The reserved word __________ is required to declare a class
a logical error - If a program compiles fine, but it produces incorrect result, then the program
suffers __________.
0 - What is the value of variable i printed by the following code?
public class Test {
public static void main(String[] args) {
int j = 0;
int i = j++ * 5;
System.out.println("What is i? " + i); }
}
Java123 - The expression "Java " + 1 + 2 + 3 evaluates to ________.
A constructor - ________ is invoked to create an object.
x contains a reference to a Account object. - Given the declaration Account x = new Account (),
which of the following statement is most accurate.