Q1. Which library package would you import to use NumberFormat and DecimalFormat?
java.text
Q2. The expression 4 + 20 / (3 – 1) ∗ 2 is evaluated to ________.
24
Q3.Which of the following expressions results in a value 1?
37 % 6
Q4. If x is an int and y is a float, all of the following are legal except which assignment statement?
x = y;
Q5. Which of the following assignment statements are incorrect?
i == j == k == 1;
i = 1 = j = 1 = k = 1;
Q6. What is y displayed in the following code?
public class Test {
public static void main(String[] args) {
int x = 1;
int y = x++ + x;
System.out.println(“y is ” + y);
}
}
y is 3.
Q7. A Java variable is the name of a
data value stored in memory that can change its value but cannot change its type during the program’s execution
Q8. Suppose that String name = “Frank Zappa”. What will the instruction
name.toUpperCase .replace(‘A’, ‘I’); return?
“FRINK ZIPPI”
Q9. What is output with the statement System.out.println(x+y); if x and y are int values where x=10 and y=5?
15
Q10. The values of (double) 5 / 2 and (double) (5 / 2) are identical.
FALS
Other Links:
See other websites for quiz:
Check on QUIZLET