Page 117 - CA_Blue( J )_Class9
P. 117

1.  Assertion(A): In Java, the expression (true || false) evaluates to true.
                         Reason(R): The logical OR operator (||) requires both operands to be true to return true.
                   Ans.  c. A is true, but R is false
                    2.  Assertion (A): The equality operator (==) and the relational operators (<, >, <=, >=) have the same precedence level
                        in Java.
                        Reason (R): Relational and equality operators are evaluated from left to right in an expression.
                   Ans.  a. Both A and R are true, and R is the correct explanation of A.


                      Unsolved Questions



                 A.  Tick ( ) the correct answer.
                    1.  What values will be stored in x and y respectively after executing the following?
                       int x=-10, y;     and  y=--x;
                        a.  x=-11 and y=-11                            b.  x=-10 and y=-11
                        c.  x=11 and y=11                              d.  x=-11 and y=11
                    2.  If int m=50, n=5, then n%m  is ………………….
                        a.  5                                          b.  10
                        c.  0                                          d.  1
                    3.  “Change after action” is the example of ………………….
                        a.  Prefix operator                            b.  Postfix operator
                        c.  Binary operator                            d.  Assignment operator
                    4.  Operators that contains one operand or expression ………………….
                        a.  Unary operator                             b.  Ternary operator
                        c.  Binary operator                            d.  Null operator
                    5.  Which of the following operators is used to initialize all non-primitive data types?
                        a.  .(dot) operator                            b.  Ternary operator
                        c.   New operator                              d.  Relational
                    6.   What is the result of a += 9; statement?
                        a.  ++a;                                       b.  a = a + 9;
                        c.  a + 9;                                     d.  None of these
                    7.  If int a = 5, b = 4, c = 0; What value is stored in c, when c = a % ++b;?
                        a.  5.0                                        b.  5
                        c.  0                                          d.  None of these
                    8.  What will be the output of ++a + ++a; when int a = -1?
                        a.  -1                                         b.  0
                        c.  1                                          d.  None of these
                    9.  What is correct java expression for the p = a  + bc statement?
                                                           2
                        a.  p = a * a + b * c;                         b.  p=axa + bxc
                        c.  p= a.a + b.c                               d.  None of these
                   10.  Which shorthand operator can be used to decrease a variable a by 3 in Java?
                        a.  a++                                        b.  a -= 3
                        c.  a += 3                                     d.  a = 3
                   11.  Which of the following statements about System.out.print and System.out.println is true?
                        a.  System.out.print prints a newline after the output.
                        b.  System.out.println prints the output followed by a space.
                        c.  System.out.print does not print a newline after the output.
                        d.  System.out.println only prints integers.





                                                                                               Operators in Java   115
   112   113   114   115   116   117   118   119   120   121   122