WEEK-1
Q1. Which library package would you import to use NumberFormat and DecimalFormat?
A) java.text
Q2. The expression 4 + 20 / (3 - 1) ∗ 2 is evaluated to ________.
A) 24
Q3. Which of the following expressions results in a value 1?
A) 37 % 6
Q4. If x is an int and y is a float, all of the following are legal except which assignment statement?
A) x = y;
Q5. Which of the following assignment statements are incorrect?
A)
1. i == j == k == 1;
2. 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);
}
}
A) y is 3.
Q7. A Java variable is the name of a
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?
A) "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?
A) 15
Q10. The values of (double) 5 / 2 and (double) (5 / 2) are identical.
A) FALS
Comments
Post a Comment