Page 172 - Computer science 868 Class 12
P. 172
7. What will be the output?
int a=7, b;
b= --(a++);
System.out.println(b);
a. 6 b. 7
c. Will show an error d. 8
8. What will be the output?
int a=1, b=2;
System.out.println(--b - ++a + ++b - --a);
a. 0 b. 1
c. 2 d. -1
9. When an operator works on two operands, it is known as ………………… .
a. Unary Operator b. Binary Operator
c. Ternary Operator d. None of these
10. expression1 && expression2 results in ………………… .
a. true if either expression1 or expression2 is true b. true only if both expression1 and expression2 are true
c. true if expression2 is false d. None of these
11. Which of the following is a token?
a. Literals b. Operators
c. Keywords d. All of these
12. Which of the following is an example of decimal literal?
a. 768 b. AB56
c. 12C d. 10110
Answers
1. b 2. c 3. a 4. b 5. c 6. b 7. c 8. a 9. b 10. b
11. d 12. a
B. Fill in the blanks:
1. The ………………… is written before the operand.
2. The symbols on which the operand works are known as ………………… .
3. There are ………………… types of relational operators.
4. The expression which is assigned to a variable is called a/an ………………… .
5. There are ………………… different types of shift operators.
6. In …………………, the value of the variable is printed and then increased by 1.
7. The variables or values that are used in an expression are called ………………… .
8. A ternary operator is also known as ………………… .
9. Any meaningful statement containing identifiers, literals and arithmetical operators that produces a result is called a/an
………………… .
10. The ………………… contains three operands or expressions.
11. Each individual character that is used for creating an executable code is known as a ………………… .
12. ‘\n’ is a/an ………………… .
Answers
1. prefix increment/decrement operator 2. operators 3. six
4. arithmetical statement 5. three 6. postfix increment operator
7. operands 8. conditional assignment operator 9. arithmetical expression
10. ternary operator 11. token 12. escape sequence
170170 Touchpad Computer Science-XII

