Page 113 - CA_Blue( J )_Class9
P. 113

5.  Which of the following is an example of a shorthand operator in Java?
                        a.  a = a + b                                  b.  a += b
                        c.  a == b                                     d.  a >= b
                    6.  Write the output?
                       int a=3,b=4;
                        System.out.print((a!=b)?(a+b): (a-b));
                        a.  3                                          b.  4
                        c.  7                                          d.  -1
                    7.  What is the result stored in x, after evaluating the following expression?
                        int x = 5;
                        x = x++ * 2 + 3 * --x;
                        a.  22                                         b.  24
                        c.  26                                         d.  25
                    8.  The result of a+=4 is an ………………… expression.
                        a.  Unary                                      b.  Accumulator
                        c.  Counter                                    d.  Binary
                    9.  State the result of:
                        int a=10, b=3, c=0;
                        c=b%a;
                        a.  10                                         b.  0.3
                        c.  0                                          d.  3
                   10.  State the result of:
                        int a = -1;
                        System.out.println(-a++);
                        a.  1                                          b.  -1
                        c.  0                                          d.  None of these

                  Answers
                  1. b       2. b     3. d     4. c     5. b     6. c      7. d     8. b     9. d     10. a


                 B.  Fill in the blanks.

                    1.  == is a/an ………………… operator.
                    2.  The symbols on which the operand works are known as ………………….
                    3.  The ………………… operator is used to allocate space in the dynamic memory.
                    4.  The expression is assigned to a variable using ………………….

                    5.  ………………… contains three operands or expression.
                    6.  In ………………… value of a is printed then increased by one.
                    7.  The ………………… operator is written after the operand.
                    8.  The associativity of postfix unary operator is ………………… to ………………….
                    9.  The operators applied to a single operand is known as ………………… operator.

                   10.  = is a/an ………………… operator.

                  Answers
                  1. Relational     2. Operators    3. new      4. assignment statement        5. Ternary Operator
                  6. a++         7. Postfix      8. Right, left    9. unary            10. Assignment






                                                                                               Operators in Java   111
   108   109   110   111   112   113   114   115   116   117   118