Page 70 - Modular v1.1 Pyhton
P. 70

C.  Fill in the blanks using the words given below.


                                                escape, lowercase, capitalize(), right, concatenation

                      1.   Index with negative integers starts from …………………… with -1.

                      2.   The backslash (\) is a special character and is also known as the …………………… character.
                      3.   String …………………… operator joins two or more strings into one.

                      4.   The lower() function converts all uppercase letters to …………………… .
                      5.   The …………………… function returns a string with the first character in capital.

                  D.  Short answer type questions.
                      1.   What are strings?

                      2.   What is the difference between (+) and (*)?
                      3.   What do you mean by traversing a string?

                  E.  Long answer type questions.
                      1.   Explain different ways of indexing a list.
                      2.   Write the any two built-in functions to manipulate strings.
                      3.   What do you mean by escape sequences? Explain in detail.
                                                                                                  Critical Thinking
                  F.  What will be the output of the following?
                      test_str = "Good Morning"
                      print("The original string is : " + str(test_str))
                      hlf_idx = len(test_str)
                      res = ' '
                      for idx in range(len(test_str)):
                           if idx >= hlf_idx:
                               res+= test_str[idx].upper()
                           else:
                               res+= test_str[idx].upper()
                                                                                               Experiential Learning
                           print("The resultant string : " + str(res))
                  G.   Application based question.
                        Taarush wants to print his name in Python. He noticed that it got printed in lowercase. How can he
                      change it into uppercase?
                                                    In the lab                                  Subject Enrichment


                     Write a Python program to:

                     1.  traverse a string "PYTHON" using for loop.
                     2.  convert the string "orange education" to uppercase.



                   Teacher's Corner

                  1.   Explain string in detail to the students.
                  2.   Give demonstration of creating multiline string to students.

                   68     Touchpad MODULAR (Version 1.0)
   65   66   67   68   69   70   71   72   73   74   75