Page 146 - Computer Science Class 11 Without Functions
P. 146

16.  Give an example of each of the following:
              a.  a single line comment                       b. a multiline comment
          17.  Write a Python statement to print a blank line.
          18.  What are the rules for writing a comment in a Python program?
          19.  What is the purpose of comments in a Python program?
        E.  Application Based Questions
           1.  Write a program to accept the name and age of a user and display it in the following format:
               Name: Abeer
               Age : 6
           2.  Write a program to accept city and state from the user and display them in different lines using a single print statement.
           3.  Write a program to accept the side of a cube and display its volume.
           4.  Write a program to accept and display your school's name and address in the following format:
              School Name:
              Address:


                Assertion and Reasoning Based Questions


           The following questions are assertion(A) and reasoning(R) based. Mark your answer as
           a.  Both A and R are true and R is the correct explanation of A
           b.  Both A and R are true and R is not the correct explanation of A
           c.  A is true but R is false
           d.  A is false but R is true
           1.  Assertion(A):  Python considers user input as strings
              Reasoning(R):  An INPUT() is used to accept user input from the keyboard.
           2.  Assertion(A):  Comments make the program lengthier.
              Reasoning(R):  Comments are ignored by the Python interpreter during execution.
           3.  Assertion(A):  An operator specifies the operation to be performed on the given operands.
              Reasoning(R):  An operand may be a constant or a variable.
           4.  Assertion(A):  Evaluating the following expression:

                          max('Anshul', 'Mridula', 'Shekhar', 'Ashish')
                          will yield 'Shekhar'.
              Reasoning(R):  max() takes only numeric values as arguments.
           5.  Assertion(A):  Python allows the conversion of data from one data type to another.
              Reasoning(R):  int() is an example of a type conversion function.


               Case Based Questions


           1.  Zorawar likes to work with numbers. He has just started working in Python and wants to perform the following mathematical
              operations using a Python program. He wants to accept two numbers and display their sum,   difference,   product,   quotient,
              and remainder. Help him complete his task.
           2.  Anish is a very naughty boy. His friend, Shankar wrote a program to accept 5 numbers and display each one of them in a
              single line, separated by a '$' symbol. The program is as follows:
              num1 = int(input('Enter a number'))
              num2 = int(input('Enter a number'))
              num3 = int(input('Enter a number'))
              num4 = int(input('Enter a number'))


         144   Touchpad Computer Science-XI
   141   142   143   144   145   146   147   148   149   150   151