Respuesta :
Answer:
1. What is Java SE?
A. Java Standard Edition
2. Which of the following is the correct header for the main method of a Java program?
C. public static void main(String[] args )
3. Which of the following statements creates a constant in Java?
B. const int x = 5;
4. Which of the following statements displays 17?
C. 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.
C. x %= 3;
6. If x is an int, Which expression will always evaluate to true if x is evenly divisible by 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?
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?
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?
B. y [6] = 2
10. Consider the following declaration.
int [] two = {{1, 2, 3}, {4, 5}};
Which arithmetic expression evaluates to a value of 8?
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?
C. 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
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?
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?
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);
A. true, true
Explanation:
The questions in the answer section are being followed by answer. Some explanation is necessary. Regarding which, the cases are executed from the case that is accepted by expression in switch, and continue execution till last if break keyword is not mentioned. And default can come anywhere, and hence since its after case 2 here, it will be executed as well. And hence that answer. Also if a class does not have an explicit super class, it has an implicit super class (object), and this has the zero args constructor. And hence when we do not mention constructor in a class, a default constructor is created automatically, and hence an object can be created, and hence the above answer. However, format must be correct. Rest are self explanatory.
Answer:
1. What is Java SE?
A. Java Standard Edition
Good luck
Explanation: