Page 163 - Cs_withBlue_J_C11_Flipbook
P. 163

Ans.  c = 103
                        Explanation:
                        c = a + b + a++ + b++ + ++a + ++b;
                          = 11 + 22 + 11 + 22 + 13 + 24
                          = 103
                    8.  What will be the output?
                       int i=0;
                       i = i++ - --i + ++i - i--;
                       System.out.println("i = "+i);
                   Ans.  i = 0
                        Explanation:
                        i = i++ - --i + ++i - i--
                          = 0 - 0 + 1 - 1
                          = 0
                    9.  What will be the value of i, j and k after execution?
                       int i=4, j=2, k = 5;

                       k += i-- - i++ + --j - ++j + --i - ++i;
                       System.out.println("i = "+i);
                       System.out.println("j = "+j);
                       System.out.println("k = "+k);
                   Ans.  i = 4
                        j = 2
                        k = 4
                        Explanation:
                        k = k+(i-- - i++ + --j - ++j + --i - ++i)
                          = 5 +(4 - 3+ 1 - 2 + 3 - 4)
                          = 5 - 1
                          = 4
                    10.  if int a=40, b=22, c=10;

                       c += a + a--/--b + b;
                       System.out.println("c = "+c);
                   Ans.  c =  72
                        Explanation:
                        c = c + (a + a--/--b + b)
                          = 40 + (40 + 40/21 + 21)
                          = 40 + (40 + 1 + 21)
                          = 40 + 62
                          = 72


                      Unsolved Questions



                 A.  Tick ( ) the correct option:
                    1.  What type of operator is used in  the expression a+b?
                       a.  Unary                                       b.  Binary
                       c.  Ternary                                     d.  None of these



                                                                                                                       161
                                                                                               Variables and Expressions  161
   158   159   160   161   162   163   164   165   166   167   168