Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 99 - 2629_Devagiri_C-7
P. 99

    2.  In an if statement, the condition is evaluated to either true or false.
                        3.  The condition in an if statement always gives a True or False result.

                        4.  Decisions are not made using the selection statement.

                        5.   The if statement is also known as a selection statement.

                     D.  Answer the following questions:
                        1.  Write the syntax of the following:
                            (a) if statement                              (b)  if … else … statement

                        2.  In what situation does the else block execute in an if...else statement?

                        3.  Differentiate between sequential flow and selective flow with examples.

                        4.  Can an if block be used in Python without a comparison operator? Explain with an example.

                        5.  Describe a nested if statement.

                                                                                                    21 st
                     COMPETENCY-BASED QUESTIONS                                                    Century   #Critical Thinking
                                                                                                   Skills  #Technology Literacy
                     1.   Sneha is writing a program to categorise ages into different stages of life: Child, Teen, Adult and Senior.
                        Which control structure should Sneha use to classify the ages into these stages?
                     2.   A computer teacher  asks students  to  enter a number. If  the number entered  is
                        greater than 50, the program should display  “Pass”.  Otherwise, it  should display
                        “Try  Again”. Which statement  will be  used  to  check the  condition  and execute  the
                        appropriate block of code?

                                                                                                                      97
                                                                                               Flow of Control in Python

| 94 95 96 97 98 99 100 101 102 103 104 |