Page 161 - Cs_withBlue_J_C11_Flipbook
P. 161

MIND DRILL






                      Solved Questions



                 A.  Tick ( ) the correct option:
                    1.  Which of the following operator is used to perform arithmetical calculations?
                       a.  Binary operator                             b.  Arithmetic operator
                       c.  Logical operator                            d.  Both a and b
                    2.  Which of the following operators is used before the operand and returns the value with a reversed sign?
                       a.   Unary(-)                                   b.  Unary(+)
                       c.  Unary(++)                                   d.  Unary(--)
                    3.  What do we call the Unary Increment operator when it is placed before the operand?
                       a.  Prefix Unary Increment                      b.  Postfix Unary Increment
                       c.  Both a and b                                d.  None of these
                    4.  Which operator is used to assign a value or an expression to a variable?
                       a.  Logical Operator                            b.  Relational Operator
                       c.  Assignment Operator                         d.  None of these
                    5.  What data type is returned by relational operators?
                       a.  int                                         b.  double
                       c.  float                                       d.  boolean
                    6.  Which of the following logical operators results in true if both conditions are satisfied, else it will return false?
                       a.  OR                                          b.  NOT
                       c.  AND                                         d.  None of these
                    7.  If, int c=(5<4)? ((2==4)? 5: 4) : 6+5; What will be the value of c?
                       a.  5                                           b.  4
                       c.  6                                           d.  11
                    8.  Which bitwise operator returns false when both the results are false?
                       a.  Bitwise AND (&)                             b.  Bitwise OR (|)
                       c.  Bitwise NOT (!)                             d.  Both a and b
                    9.  What is the result of 10 | 8?
                       a.  2                                           b.  5
                       c. 10                                           d.  None of these
                    10.  What is the operator >> called?
                       a.  Bitwise signed right shift operator         b.  Bitwise signed left shift operator
                       c.  Bitwise unsigned left shift operator        d.  None of these

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

                 B.  Fill in the blanks:

                    1.  ………………… must start with a letter or an underscore (_) or a dollar ($) sign.
                    2.  We ………………… change the value of the final variable.
                    3.  ………………… works the same as val=val-1.

                    4.  When the Unary decrement operator is placed before the operand, then it is known as the ………………… .
                    5.  The operator which is used to find the remainder between two operands is known as ………………… .

                    6.  A ………………… is a tabular representation that displays the input and output bits when the bitwise operators &, |, ! are used.

                                                                                                                       159
                                                                                               Variables and Expressions  159
   156   157   158   159   160   161   162   163   164   165   166