Page 238 - Robotics and AI class 10
P. 238

SECTION B (Subjective Type Questions)

        A.  Short answer type questions:
            1   What is the use of the + operator with lists?

          Ans.  The + operator is used to concatenate the list with another list.
            2.  What do you mean by traversing a list?
          Ans.  Traversing a list means to visit each element and process it as required by a program.
            3   What is the use of ‘+’ and ‘*’ Operators with String values ?
          Ans.  Addition Operator ‘+’ is known as Concatenation operator with the string values as it works to join the string values
              Multiplication Operator ‘*’ is also known as the Repetition operator for the string values.

            4.  What is the ASCII values of digits, uppercase and lowercase
          Ans.  The ASCII/Unicode values of:
                Digits: 0 to 9 is from 48 to 57
                Uppercase ‘A’ to ‘Z’ is from 65 to 90
                Lowercase ‘a’ to ‘z’ is from 97 to 122

            5.  Name the two different ways of using index numbers in strings.
          Ans.  There are two different ways of using the index number:
              ●  Forward Indexing
              ●  Negative/Backward Indexing
        B.  Long answer type questions:

            1.  How can we modify elements in a list?
          Ans.  List is mutable so data can be easily modified by overwriting a new value to an existing value in a given list by using an
              assignment operator (=).
              Syntax
              list[index] = newvalue
              For example,

              l1 = [10, 20, 40, 50]
              l1[3] = 100
              print(l1)
            2.  What are Python libraries? Give three advantages of using Python libraries.
          Ans.  Python libraries are pre pre-written set of code which gives additional functionality and tools to enhance the capabilities
              of Python. They are collections of pre-defined modules and packages that provide some built in functions, classes, and
              methods for various tasks. It saves the programmers time and effort by providing solutions to some common problems
              and allowing them to use it in the existing code.
              Some of the major advantages of using Python libraries are:
              ●  Code Reusability: Since libraries have built in functions and modules which can directly be used in a program, it
                 provides the feature of reusing the code as and when needed by a programmer.
              ●  Extended Functionality: These libraries are created and maintained by experts in their respective fields, providing
                 robust and efficient implementations. These are some additional features that enhance the functionality of the Python
                 standard library. For example some of the libraries provide features like scientific computing, web development, data
                 analysis, machine learning, and many more.
              ●  Efficiency and Performance: Due to the reusability of the code it saves the time and the effort of the programmer
                 which can significantly improve the execution speed and efficiency of a program.


              236     Touchpad Robotics & Artificial Intelligence-X
   233   234   235   236   237   238   239   240   241   242   243