Page 164 - Cs_withBlue_J_C11_Flipbook
P. 164

2.  What will be printed after the execution of the following?
                    int a=5;
                    System.out.println(++a);
                    a.  5                                           b.  4
                    c.  6                                           d.  0
                  3.  Which operator uses the principle of ‘change before action’?
                    a.  Prefix operator                             b.  Postfix operator
                    c.  Both a and b                                d.  None of these
                  4.  What will be the output of (5>6) && (2>1)?
                    a.  True                                        b.  False
                    c.  Error                                       d.  None of these
                  5.  What is the data type returned by OR(|) operator?
                    a.  boolean                                     b.  int
                    c.  double                                      d.  None of these
                  6.  What will be returned by (5!=5 || (1+2)==3)?
                    a.  False                                       b.  True
                    c.  5                                           d.  3
                  7.  Which one of the following logical operators holds the highest precedence?
                    a.  OR                                          b.  AND
                    c.  NOT                                         d.  None of these
                  8.  The output of 15<<3 is …………………. .
                    a.  100                                         b.  120
                    c.  15                                          d.  3
                  9.  In the mathematical expression, what rule is followed by Java?
                    a.  BEDMAS                                      b.  BODMAS
                    c.  MASBOD                                      d.  None of these
                 10.  Which of the following operator is higher in precedence?
                    a.  Ternary                                     b.  Shift
                    c.  Logical                                     d.  Relational

              B.  Fill in the blanks:

                  1.  ………………… compare two variables or expressions and result in true or false.
                  2.  Conditional  Assignment  Operator  consists  of  3  operands  that  may  be  variable,  expression  or  constant.  It  is  also  known  as
                    ………………… .
                  3.  When a Conditional Assignment Operator is used under another, it is known as ………………… .
                  4.  ………………… is a relational operator which checks whether both the operands are equal or not.
                  5.  Java allows a way to represent some binary operators in a shorter way using shorthand assignment operators. They are known as
                    ………………… .

                  6.  The Java expression of p = a / b2 + b / a2 is ………………… .
                  7.  ………………… operators deal with two operands.
                  8.  If k=10, l=20 , m; m = ++k + ++l * ++k will give ………………… .
                  9.  3>7 || 8<12 is ………………… .
                 10.  ………………… operator results in false if the operands are of the same value.

              C.  Answer the following questions:
                  1.  If int a=10, b; b = a++ / a++;
                    System.out.println(a+ " - "  +b);
                    What will be printed?
                  2.  If !(3==5)
                      What will be the result?



                162162  Touchpad Computer Science-XI
   159   160   161   162   163   164   165   166   167   168   169