Page 55 - Modular_V2.0_C++_Flikpbook
P. 55

2.  …………………… statements are also known as decision making statements.

                          a.  Assignment                               b.   Conditional
                          c.   Addition                                d.   None of these
                      3.  What will be the output of the following code?
                          void main()

                          {
                              int a=0;
                              a = 5<2 ? 4 : 3;

                              cout<<a;
                          }
                          a.  3                                        b.  4
                          c.  5                                        d.  12

                      4.  Which of the following statements is correct?
                          a.  else if is necessary to use with if statement
                          b.  else is compulsory to use with if statement
                          c.  else is optional with if statement

                          d.  None of these
                      5.  If none of the expressions evaluates to true in a switch block, then which case is executed?
                          a.  Default                                  b.  Break
                          c.  Both a and b                             d.  None of these

                 B.   Write ‘T’ for true and ‘F’ for false.

                      1.  The if…else statement is the simplest conditional statement.                  ……………………
                      2.  C++ does not allow nested if statement.                                       ……………………
                      3.  The if…else…if ladder is not a conditional statement in C++.                  ……………………

                      4.  We cannot use floating-point value in the switch statement.                   ……………………
                      5.  The if...else...if statement allows you to test multiple conditions.          ……………………

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


                                                           false, if, true, break, else


                      1.  The …………………… statement encloses multiple statements inside curly braces { }.

                      2.  In C++, the non-zero value is interpreted as …………………….
                      3.  Conditional statement may give the result as true or …………………….

                      4.  The …………………… block will be executed if and only if the provided condition evaluates to false.
                      5.  …………………… can be used inside the switch body but cannot be used inside if body.






                                                                                                                  53
                                                                                           Conditional Statements
   50   51   52   53   54   55   56   57   58   59   60