1. What is Java SE?

A. Java Standard Edition*
B. Java Software Editor
C. Java Scientific Edition
D. Java Software Emulator

2. Which of the following is the correct header for the main method of a Java program?

A. public static void main(String args)
B. public abstract void main(String[] args )
C. public static void main(String[] args )*
D. public static int main(String[] args )

3. Which of the following statements creates a constant in Java?

A. int const = 5;
B. const int x = 5;*
C. final int x = 5;
D. const x = 5;

4. Which of the following statements displays 17?

A. System.out.println (2*4+3*2+1);*
B. System.out.println ((2*4+3)*2+1);
C. System.out.println (2*4+(3*(2+1)));
D. System.out.println (2*(4+3*2)+1);

If x is an int and the original value of x is 5, which of the following statements assigns an even value to x?

5.

A. x += 2;
B. x /= 3;*
C. x %= 3;
D. x *= 3;

6. If x is an int, Which expression will always evaluate to true if x is evenly divisible by 5

A. x == 5*
B. x % 2 == 5
C. x % 2 == 0
D. x % 5 == 0

7. Consider the following directions.

int y = 5;
int z = 10;

Which of the following expressions evaluates to true?

A. y > 5 && z >= 10
B. z / y >= 2 && y * 2 > z
C. y - z >0 || y * 4 == z * 2*
D. y + z == z + y && z - y == y - z

8. Consider the following code.

int x = 2.
switch (x) {
case 1: x += 3;
case 2: x += 5;
case 3: x += 7;
default: x += 10;
}

After the switch statement, what is the value of x?

A. 2
B. 5
C. 7
D. 24*

9. If y refers to an array of int values with seven elements, and all of those elements have been given a value of 5, which statement would change the last element of a 2?

A. y {7] = 2
B. y [6] = 2
C. y [2] = 6*
D. y [2] = 7

10. Consider the following declaration.

int [] two = {{1, 2, 3}, {4, 5}};

Which arithmetic expression evaluates to a value of 8?

A. two[3] + two[2]
B. two[2] + two [1]
C. two[1] [3] + two[2] [2]
D. two[0] [2] + two[1] [1]*

11. Consider the following method.

public static void print (int a, int ) {
System.out.println ("The sum is" + (a+b));
}

If the print method is in the same class as the main method and there are no other methods named print, which of the following statements, called from the main method, will not cause a compiler error?

A. System.out.println (print (2, 3));
B. System.out.println (print (2 + 3));
C. print (2, 3);*
D. print (2 + 3);

12. Which of the following expressions correctly and most accurately calculates the area of a circle with radius r?

A. Math.pow (r, 2) * Math.PI*
B. Math.power (r, 2) * Math.PI
C. Math.pow (2, r) * Math.PI
D. Math.exp (r, 2) * Math.PI

13. Consider the following code.

public class Amazing {
int x;
int y;
}

Which of the following shows a statement that will create an instance of class Amazing and assign its reference to a reference variable?

A. Amazing a = new Amazing;
B. Amazing a = new Amazing ();
C. Amazing a = Amazing ();
D. It is not possible to create an instance of class Amazing. It does not have a constructor.*

14. Consider the following code.

public class Employee () {
private String firstName;
private String lastName;
private int empId;
}
Which of the following shows a constructor that, if added to class Employee, would allow a caller to create an object and pass in values from the call that will be assigned to its instance variables?

A. public Employee () {
firstName = “Fred”;
lastName = “Jones”;
empId = 101;
}

B. public Employee (String a, String b, int c) {
firstName = a;
lastName = b;
empId = c;
}

C. public Employee (“Fred”, “Jones”, 101) { *
firstName = a;
lastName = b;
empId = c;
}

D. public Employee (String a, String b, int c) {
firstName = “Fred”;
lastName = “Jones”;
empId = 101;
}

15. What is the output of the following code?

String name1 = “Chris”;
String name2 = “Christine”;
boolean b = name1 . startsWith (name2);
boolean c = name1 . charAt (4) == name2 . CharAt (7);
System.out.println (b + “, ” + c);

A. true, true
B. true, false
C. false, true
D. false, false*

Note * means my answer

my mans just asked for the entire Java Programming 1 Review Quiz

1. Java SE stands for Java Standard Edition. The correct answer is A. Java Standard Edition.

2. The correct header for the main method of a Java program is C. public static void main(String[] args).

3. To create a constant in Java, you can use the final keyword. The correct answer is C. final int x = 5.

4. The statement that displays 17 is A. System.out.println (2*4+3*2+1).

5. To assign an even value to x, you can use the x /= 3; statement. The correct answer is B. x /= 3.

6. If x is evenly divisible by 5, the expression x % 5 == 0 will always evaluate to true. The correct answer is D. x % 5 == 0.

7. The expression that evaluates to true is C. y - z > 0 || y * 4 == z * 2.

8. After the switch statement, the value of x will be 24. The correct answer is D. 24.

9. To change the last element of array y to 2, you should use y[6] = 2. The correct answer is B. y[6] = 2.

10. The arithmetic expression that evaluates to 8 is D. two[0][2] + two[1][1].

11. The statement that will not cause a compiler error is C. print(2, 3);.

12. The expression that correctly and most accurately calculates the area of a circle is A. Math.pow(r, 2) * Math.PI.

13. To create an instance of class Amazing and assign its reference to a reference variable, you should use the statement Amazing a = new Amazing();. The correct answer is B. Amazing a = new Amazing().

14. The constructor that, if added to class Employee, would allow a caller to create an object and pass in values from the call is B. public Employee(String a, String b, int c) { ... }.

15. The output of the code is D. false, false.

1. What is Java SE? (Answer: A. Java Standard Edition)

2. Which of the following is the correct header for the main method of a Java program? (Answer: C. public static void main(String[] args))

3. Which of the following statements creates a constant in Java? (Answer: B. const int x = 5)

4. Which of the following statements displays 17? (Answer: A. System.out.println (2*4+3*2+1))

5. If x is an int and the original value of x is 5, which of the following statements assigns an even value to x? (Answer: B. x /= 3)

6. If x is an int, which expression will always evaluate to true if x is evenly divisible by 5? (Answer: A. x == 5)

7. Consider the following directions. int y = 5; int z = 10; Which of the following expressions evaluates to true? (Answer: C. y - z > 0 || y * 4 == z * 2)

8. Consider the following code. int x = 2. switch (x) { case 1: x += 3; case 2: x += 5; case 3: x += 7; default: x += 10; } After the switch statement, what is the value of x? (Answer: D. 24)

9. If y refers to an array of int values with seven elements, and all of those elements have been given a value of 5, which statement would change the last element of a 2? (Answer: C. y [2] = 6)

10. Consider the following declaration. int [] two = {{1, 2, 3}, {4, 5}}; Which arithmetic expression evaluates to a value of 8? (Answer: D. two[0] [2] + two[1] [1])

11. Consider the following method. public static void print (int a, int b) { System.out.println ("The sum is" + (a+b)); } If the print method is in the same class as the main method and there are no other methods named print, which of the following statements, called from the main method, will not cause a compiler error? (Answer: C. print (2, 3))

12. Which of the following expressions correctly and most accurately calculates the area of a circle with radius r? (Answer: A. Math.pow (r, 2) * Math.PI)

13. Consider the following code. public class Amazing { int x; int y; } Which of the following shows a statement that will create an instance of class Amazing and assign its reference to a reference variable? (Answer: B. Amazing a = new Amazing ();)

14. Consider the following code. public class Employee () { private String firstName; private String lastName; private int empId; } Which of the following shows a constructor that, if added to class Employee, would allow a caller to create an object and pass in values from the call that will be assigned to its instance variables? (Answer: B. public Employee (String a, String b, int c) { firstName = a; lastName = b; empId = c; })

15. What is the output of the following code? String name1 = "Chris"; String name2 = "Christine"; boolean b = name1.startsWith(name2); boolean c = name1.charAt(4) == name2.charAt(7); System.out.println(b + ", " + c); (Answer: D. false, false)