Page 175 - Computer science 868 Class 12
P. 175

3.  The associativity of the prefix unary operator is from ………………… .
                     4.  %= is an example of ………………… operator.
                     5.  The symbol of the left shift operator is ………………… .
                     6.  Bitwise NOT (!) will result  ………………… if the input is low.
                     7.  There are ………………… types of bitwise operators.
                     8.  If any one of the conditions in the expression satisfies, then the outcome is ………………… .
                     9.  There are ………………… different types of arithmetic operators.
                    10.  If int a=10, b=2, c=15, d;
                        What will be the value of d?
                        (a>b) && (b==c)
                 C.  Answer the following questions:
                     1.  What are the types of operators based on the number of operands?
                     2.  What is a binary operator in Java?
                     3.  What are unary operators in Java? What are the types of unary operators?
                     4.  What will be the output of the following programs?
                       •  int x = 2, y = 5;
                         int result1 = (x * y / x);
                         int result2 = (x * (y / x));
                         System.out.println(result1);
                         System.out.println(result2);
                       •  int x = 10, y = 5;
                         int result1 = (y * (x / y + x / y));
                         int result2 = (y * x / y + y * x / y);
                         System.out.println(result1);
                         System.out.println(result2);

                       •  int x = 9, y = 12, z = 3;
                         int result1 = x - y/3 + z * 2 - 1;
                         int result2 = (x - y)/3 + ((z * 2) - 1);
                         System.out.println(result1);
                         System.out.println(result2);
                         •  int x = 9, y = 12;
                         int a = 2, b = 4, c = 6;
                         int exp = 4/3 * (x + 34) + 9 * (a + b * c) + (3 + y * (2 + a)) / (a + b*y);
                         System.out.println(exp);
                     5.  What are logical operators in Java? How many types of logical operators are supported by Java?
                     6.  What is an assignment operator in Java?
                     7.  What will be the result of the following code?
                       int x = 20, y = 30, z = 50;
                       x += y;
                       y -= x + z;
                       z *= x * y;
                       System.out.println("x = " +x );
                      System.out.println("y = " +y );
                      System.out.println("z = " +z );



                                                                                                                       173
                                                                                               Variables and Expressions   173
   170   171   172   173   174   175   176   177   178   179   180