Page 33 - Modular_V1.1_Flipbook
P. 33

5.  Which of the following determines the order of evaluation when more than one operator with
                          same precedence is used in an expression?
                          a.  Associativity                                c.  Relationship

                          b.  Typecasting                                 d.  Expression
                 B.   Write ‘T’ for true and ‘F’ for false.
                      1.  The conditional operator is the only ternary operator available in C++.       ……………………

                      2.  Logical operators are used to combine more than one relational expression.    ……………………
                      3.  An operator is a symbol used to perform mathematical and logical calculations.  ……………………
                      4.  Decrement operator is used to decrease the value of a variable by 1.          ……………………

                      5.  Explicit typecasting is done automatically by the C++ compiler.               ……………………

                 C.   Fill in the blanks using the words given below.


                                                  ==, AND, Modulus, Increment, Assignment

                      1.  The ……………………….. operator returns the remainder.
                      2.  The ……………………….. operator is used to check whether the values of two operands are equal.

                      3.  The ……………………….. operator returns true, if both operands are true.
                      4.  The ……………………….. operator assigns the value of the right operand to the left operand.
                      5.  The ……………………….. is the unary operator.

                 D.   Short answer type questions.
                      1.  What is the difference between ‘/’ and ‘%’ operators?
                      2.  What is operator precedence?
                      3.  What is type casting?

                      4.  What are relational operators?
                      5.  What are binary operators?

                 E.   Long answer type questions.
                      1.  Write the names of all the relational operators of C++?
                      2.  What is the difference between prefix and postfix increment? Give examples for both.
                      3.  Differentiate between implicit and explicit type casting.
                      4.  What is the difference between *= and /= operators?

                 F.   Find the output of the following codes:
                      1.  void main()                              2.    void main()
                          {                                             {
                                  int x = 5, y = 0;                               int a;
                                  x++;                                            a = 34 / 4 - 4;
                                  ++x;                                            cout<<a;
                                  y = x++ + 1;                          }
                          cout<<x;
                          cout<<y;}


                                                                                               Operators in C++   31
   28   29   30   31   32   33   34   35   36   37   38