Page 174 - Computer science 868 Class 12
P. 174
2. What will be the output?
char ch = '0';
System.out.println(ch-- + --ch);
a. 94 b. 93
c. 95 d. None of these
3. What will be the output of a = - 15 & 9?
a. 15 b. 1
c. 24 d. 6
4. An example of a unary prefix increment operator is ………………… .
a. a++ b. ++a
c. a-- d. --a
5. What will be the output?
int a=1, b=2;
System.out.println(--a - ++b + b++ - --a);
a. 0 b. 1
c. 2 d. -1
6. The operator that works on one operand is known as ………………… .
a. Unary Operator b. Binary Operator
c. Ternary Operator d. None of these
7. Find the value of:
if a=20, b=15;
b += a++ * 2 / a++ + b;
a. 33 b. 31
c. 32 d. None of these
8. The associativity of the postfix unary operator is from ………………… .
a. Right to Left b. Left to Right
c. Right to Right d. None of these
9. What will be the output?
byte n1 = 20;
System.out.println(n1 >>> 3);
a. 20 b. 2
c. 3 d. None of these
10. Which of the following is the correct way to assign a char value?
a. char ch = "abc" b. char ch = "A";
c. char ch = ‘a’ d. None of these
11. Which of the following is an example of a ternary operator?
a. (a>b)? a ; b; b. (a<b)? a, b
c. (a>b)? a: b; d. None of these
12. < is an example of ………………… operator.
a. Logical b. Arithmetical
c. Relational d. None of these
13. These are the punctuation signs and are used in Java as special characters.
a. Separators b. Punctuators
c. Assignments d. Operators
14. The sequence of characters (including alphabets, digits and symbols) together enclosed in double quotation marks is called
………………… .
a. Char literal b. Null literal
c. String literal d. Boolean literal
B. Fill in the blanks:
1. The variable a1 returns ………………… in the expression a1 = true && true.
2. An operator that compares two variables or expressions and the resultant output and the relation between them is known as
………………… operator.
172172 Touchpad Computer Science-XII

