Page 513 - ComputerScience_Class_11
P. 513

2.  Which type of flow executes statements one after another?
                       a.  Conditional                                 b.  Iterative
                       c.  Sequential                                  d.  Nested
                    3.  Which loop control statement terminates a loop immediately?
                       a.  break                                       b.  pass
                       c.  continue                                    d.  elif
                    4.  What is the default start value of range()?
                       a.  1                                           b.  0
                       c.  -1                                          d.  10
                    5.  When is the else block executed in an if-else statement?
                       a.  When condition is True                      b.  When condition is False
                       c.  Always                                      d.  Never

                 B.  Fill in the blanks.
                    1.  The pass statement acts as a ………………… that performs no action.
                    2.  The ………………… function generates a sequence of numbers in Python.
                    3.  A loop consists of initialisation, condition checking, loop body and ………………… of the control variable.
                    4.  When the number of repetitions depends on a condition, it is called ………………… iteration.
                    5.  In a nested loop, the ………………… loop controls how many times the inner loop runs.

                 C.  Answer the following questions:
                    1.  When would you use the continue statement in a loop?
                    2.  What is the role of a control variable in loops?
                    3.  Which Python statements are used to repeat actions?

                    4.  What is a nested if statement?
                    5.  Create a Python program that asks for a number and uses if, elif, else statements to print whether the number is divisible by 2, 3,
                       both or neither.
                    6.  Explain the structure and working of a for loop using the range() function.
                    7.  Explain how conditional and iterative flow of control helps in making Python programs dynamic and flexible.
                    8.  Write a Python program example combining conditional statements and loops, explaining how flow of control is managed in it.


                 D.  Higher Order Thinking Skills (HOTS)
                    1.  A  school  grading  system  first  checks  if  a  student  passed.  If  passed,  it  then  checks  for  distinction.  Which  structure  should
                       be used?
                    2.  A developer wants a program that executes steps normally, makes decisions and repeats tasks when required. Which three types
                       of flow of control must be combined?

                 E.  Case study-based questions.
                        A weather application provides advice based on the temperature. If the temperature is below 10°C, the system advises people to
                       wear heavy winter clothes. If the temperature is between 10°C and 20°C, it suggests wearing light jackets. If the temperature is
                       between 21°C and 30°C, the weather is considered pleasant. If the temperature is above 30°C, the system advises people to stay
                       hydrated and avoid direct sunlight. The elif statement allows the system to check each temperature range and provide the correct
                       advice.
                        Based on the given case, answer the following questions:
                    1.  What advice will the system give if the temperature is 8°C?
                    2.  How does the elif statement help in providing the correct advice to users?






                                                                                                    Flow of Control  511
   508   509   510   511   512   513   514   515   516   517   518