Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 150 - CodePilot V5.0 C7
P. 150

    C.  Write  T  for true and  F  for false.

                         1.  The elif statement allows you to check multiple conditions in an if-else construct.
                         2.  In an if statement, the condition is evaluated to either true or false.

                         3.  A while loop checks the condition after each repetition.

                         4.  Decisions are not made using the selection statement.

                         5.   The continue statement is used to skip the current iteration of the loop and move
                             to the next one.

                      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.  Explain the difference between a for loop and a while loop.

                         4.  Write a Python program to print the numbers in reverse order from 5 to 1.

                         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.   Amit is using a for loop to print the first 6 even numbers. Which range should he use
                         to print them?

                       148
                            CodePilot (V5.0)-VII

| 145 146 147 148 149 150 151 152 153 154 155 |