Page 77 - CA_Blue( J )_Class10
P. 77

1.  Assertion (A): The += operator in Java performs addition and assignment in a single operation.
                        Reason (R): The += operator is a shorthand for writing x = x + y where x is a variable.
                    2.  Assertion (A): The != operator checks whether two values are not equal.
                        Reason (R): The != operator is a relational operator used to compare the equality of two values.


                                             Previous Years' Questions


                    1.  The operator which acts on one operand is known as:                                         [2022]
                       a.  binary                                      b.  ternary
                       c.  binary                                      d.  relational
                   Ans.  c
                    2.  The ASCII code of 'B' is                                                                    [2022]
                       a.  67                                          b.  66
                       c.  98                                          d.  99
                   Ans.  b
                    3.  State whether the statement is True or False:                                               [2022]
                        == is an assignment operator.
                       a.  True                                        b.  False
                   Ans.  b
                    4.  Choose the odd one:                                                                         [2022]
                       a.  >=                                          b.  %
                       c.  /                                           d.  *
                   Ans.  a
                    5.  Write a difference between unary and binary operators.                                      [2019]
                   Ans.
                              Unary Operator              Binary Operator
                       Uses one operand            Uses two operands
                       Example: a++, --b           Example: a+b, a/c
                    6.  Name the operators listed below:                                                            [2017]
                       a.  <                                           b.  ++
                       c.  &&                                          d.  ?:
                   Ans.  a.  < (Less than operator)                    b.  ++ (Increment operator)
                        c.  && (Logical AND operator)                  d.  ?: (Conditional or Ternary operator)
                    7.  Write one difference between / and % operator.                                              [2017]
                   Ans.
                                          / operator                                     % operator
                       Results quotient after dividing a number by another   Results remainder after dividing a number by another
                       number.                                        number.
                       Example:                                       Example:
                       int a = 20, b = 3, c;                          int a = 20, b = 3, c;
                       c = a / b; //c=6                               c = a % b; //c=2
                    8.  Write the output:                                                                           [2017]
                        char ch = 'F';
                        int m = ch;
                        m = m + 5;
                        System.out.println(m + " " + ch);
                   Ans.  75 F






                                                                                                                       75
                                                                                                      Operators in Java   75
   72   73   74   75   76   77   78   79   80   81   82