Professional Documents
Culture Documents
Variables, Expressions
Variables, Expressions
Variables, Expressions
Answers
Explanation: Class variables also known as static 25. (b) Short Circuit AND
variables are declared with the static keyword Explanation: In Java logical operators, if the
in a class, but outside a method, constructor or a evaluation of a logical expression exits in between
block. There would only be one copy of each class before complete evaluation, then it is known
variable per class, regardless of how many objects as Short-circuit. ... If there is an expression with
are created from it. &&(logical AND), and first operand itself is false,
4. (b) Keywords then short circuit occurs, the further expression is
Explanation: Java keywords are also known as not evaluated and false is returned.
reserved words. Keywords are particular words 26. (b) Short Circuit OR operator
that act as a key to a code. 27. (a) B
y skipping the second expression or operand
5. (c) Identifier if possible and save time.
Explanation: Identifiers in Java are symbolic 28. (d) All of the above
names used for identification. They can be a class 29. (d) All of the above
name, variable name, method name, package 30. (c) 9
name, constant name, and more.
31. (d) Compiler error
6. (d) None of the Above
32. (c) %
7. (c) All of the above
33. (b) Left to Right
8. (c) _5thTeam 34. (a) P
ostfix operators have more priority than
9. (d) All of the Above Prefix operators
10. (d) All of Above 35. (b) P
refix Increment has less priority than Postfix
11. (d) A and B Decrement
36. (b) Right to Left 52. (a) 1-(ii), 2-(i), 3-(iv), 4-(iii)
37. (d) All of the above 53. (a) 1-(ii), 2-(i), 3-(iv), 4-(iii)
38. (a) (++, --) group has higher priority than (+, -, *, /,
%) group 54. (a) 1-(ii), 2-(i), 3-(iv), 4-(iii)
39. (a) ()
Programming based questions
Fill in the blanks
55. (c) 3
40. (c) Boolean
56. (a) (i) The reverse of the given number is: 456789
41. (d) 8
42. (a) 1 -> 2 -> 3 ==== (b) (ii) ReverseNumber
43. (c)
Division operator, /, has higher precedence 57. (a) (ii) Compilation error
than multiplication operator
Explanation: Constructors can be chained and
44. (c) Boolean
overloaded. When Test() is called, it creates
45. (d) 1, 2 & 3
46. (d) && another Test object calling the constructor Test(int
47. (a) () temp).
48. (c) Boolean (b) (ii) Sum of natural Number 2
49. (d) 8
58. (a) (i) The number is positive.
Match the following (b) (ii) Check whether the number is positive or