Page 166 - TP_Plus_v2.2_Class_8
P. 166

4.  Long answer type questions.
                     a.  Write down the components of a function.

                          ______________________________________________________________________________
                          ______________________________________________________________________________

                     b.  How can we call a function in Python? Explain using an example.
                          ______________________________________________________________________________

                          ______________________________________________________________________________
                          ______________________________________________________________________________

                     c.  What are the different types of functions? Explain in detail.
                          ______________________________________________________________________________

                          ______________________________________________________________________________
                          ______________________________________________________________________________

                     d.  Write any two built-in functions to manipulate strings.
                          ______________________________________________________________________________

                          ______________________________________________________________________________

                  5.  Competency-based/Application-based questions.

                     a.   Arjun wants to print his name in Python. He noticed that it got printed in lowercase. How can
                         he change it into uppercase?
                     b.   Your friend Rohit created multiple strings in Python. He now wishes to join the
                         strings to form a single string. Is this possible? Help him do so.





                  teCh Zone


                                                                                                21 st
                      Let's soLve                                                            Century   #Critical Thinking
                                                                                               Skills

                      Write the output of the following programs:
                      a. 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()
                         print("The resultant string : " + str(res))


                  164   Plus (Ver. 2.2)-VIII
   161   162   163   164   165   166   167   168   169   170   171