Page 75 - Information_Practice_Fliipbook_Class11
P. 75

14.  Write Python statements (to be executed in the IDLE environment) to accept the first name and last name of a person and
                  print them in one line, separated by a space:
             Ans.  >>> fName = input('Enter your first name :  ')
                  >>> lName = input('Enter your last name :  ')
                  >>> print(fName, lName)
              15.  Write  Python statements (to be executed in the IDLE environment)  to accept the first name and last name of a person and
                  print them in one line, separated by  ***.
             Ans.  >>> fName = input('Enter your first name :  ')
                  >>> lName = input('Enter your last name :  ')
                  >>> print(fName, lName, sep='***')
              16.  Write a program to accept the radius of a circle and print its circumference.
             Ans.  #Objective: To compute the circumference of a circle.
                  #User input: Radius of a circle.
                  #Output: Circumference of a circle having a given radius
                  pi = 3.14
                  radius = int(input('Enter the radius of a circle : '))
                  circumference = 2 * pi * radius
                  print('radius:', radius, 'circumference:', circumference)


                   Assertion and Reasoning Based Questions


                   The following questions are Assertion(A) and Reasoning(R) based questions. Mark the correct choice 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):  myMarks is an identifier.
                  Reasoning (R):  An identifier begins with a letter or underscore character, followed by a sequence of letters and digits.
               2.  Assertion(A):  sum Marks is a valid identifier.
                  Reasoning (R):  An identifier cannot contain any space or a special symbol except an underscore.
               3.  Assertion (A):  The following statement will not be executed in a Python program.
                              # This is a practice session
                  Reasoning (R):  The above is an example of a comment.
               4.  Assertion(A):  eval() is a built-in function.
                  Reasoning(R):  A built-in function is a pre-defined function in Python.
             Ans.  1. a  2. d  3. a  4. b


                   Case-based Questions


               1.  Simrat has started programming in Python. She has studied print() with sep and end clauses. Now, she wants to accept the
                  name, DOB, Contact No, and hobby of her friends and then display the data in the following format:
                  YOUR DATA

                  Name:
                  Date of Birth:
                  Contact No:
                  ********************************************************************************************


                                                                                    Basics of Python Programming  61
   70   71   72   73   74   75   76   77   78   79   80