Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 86 - 2501_KVS_C-7
P. 86

    5.   Comment is a remark/statement that is given within a program to define purpose and
                                 ownership program. These  statements are ignored by  compiler  during  compilation
                                 process. # symbol is used to represent single line comment.

                      B.  Fill in the blanks.
                            1.  F5                2. #             3. print()       4. Process        5. .py

                      C.  Match the following:

                            1. c.      2. d.       3. a.         4. e.         5. b.

                      D.  Tick (ü) the correct option.
                             1. c.       2. c.        3. c.        4. c.        5. a.

                      E.  State whether these statements are true or false.

                            1. False    2. False    3. True      4. True       5. True

                                                                  Exercise

                      A.  Answer the following questions:
                            1.   The input() function is used to take user input at run-time.

                            2.   Ravita is applying arithmetic operator (+) on variable Sub1, Sub2 and Sub3. She should
                                 convert  these values to integer  or float using int()  or float() function.  By default
                                 input function return string value and arithmetic operation could not applied on string.

                                 Corrected code will be :
                                 Sub1=float(input("Enter marks of Subject1"))
                                 Sub2= float(input("Enter marks of Subject2"))
                                 Sub3= float(input("Enter marks of Subject3"))
                                 Total=Sub1+Sub2+Sub3
                                 print(Total)
                            3.   Decision structure in programming allows you to execute statements based on a given
                                 condition.  If the  condition evaluates  to  True,  one set  of statements  is  executed.
                                 Otherwise, if the condition evaluates to False, another set of statements is executed.
                            4.   The if…else statement evaluates a test expression and will execute the body of if block
                                 only when the test condition is True. If the condition is False, the body of else block is
                                 executed. Statements that are written at the same indent form a block.

                                 Syntax:  if<condition>:
                                              Statements
                                         else:
                                             Statements
                            5.   int() and float() functions are type conversion function. These are used to do explicit
                                 type conversion from one data type to another.

                    84                         KVS DELHI REGION 2025

| 81 82 83 84 85 86 87 88 89 90 |