Page 47 - IPP-11
P. 47

13.  What is the Ndarray object of NumPy?
                Ans.  The object that is defined in the N-dimensional array type is known as ndarray. The collection of items of
                    the same type is described by ndarray and index starting with 0 (zero) is used for accessing the collection
                    of items.
                 14.  What are the different array attributes of NumPy?
                Ans.  The different array attributes of NumPy are shape, reshape, itemsize, ndim, etc.
                 15.  What are the different array creation routines of NumPy?
                Ans.  The array creation routine is used for constructing a new ndarray object. Some of the array creation
                    routines are empty(), zeros(), and ones().
                 16.  What is the following statement termed as?
                              a, b, c, d = 1, 2, 3, 4
                Ans.  Multiple Assignment Statement.
                 17.  Name five primitive data types in Python.
                Ans.  Five primitive data types in Python are: Numbers, String, List, Tuple and Dictionary.
                 18.  Differentiate between single quotes, double quotes and triple quotes.
                Ans.  The differences are:
                       •  If you use single quotes, you do not have to escape double quotes and vice versa.
                       •  If you use triple quotes, your string can span multiple lines.
                 19.  Is string a sequence data type?
                Ans.  Yes.
                 20.  Define input() method.
                Ans.  The purpose of an input() method is to fetch some information from the user of a program and store it
                    into a variable.

                 21.  What is the role of a print() function?
                Ans.  A print() method prints an expression which may be a variable’s value or string or a blank line.

                 22.  What does a print statement add to the end of the string?
                Ans.  By default, the print() function adds a new line to the end of the string being printed.
                 23.  If you don’t use the sep option with print() function, what will it print?
                Ans.  If sep is not defined, a space is printed between the values received by the print statement.
                 24.  What is the default value printed by giving end argument to print() method?
                Ans.  A new line (‘\n’).
                 25.  What is an operator in Python?
                Ans.  An operator works on data items and performs some mathematical operations or changes the data.
                    For example, +, -, *, /, %, >, <, >=, <=, <<, >>, &, |, ^, ==, etc.

                 26.  When does a logical and operator produce true result?
                Ans.  The logical and operator evaluates to True only if both conditions/operands are true.

                 27.  What is an expression? What does it constitute?
                Ans.  An operand or a combination of operands and operators, when evaluated, yields a single value called
                    an expression. The expression consists of variables, constants and functions.
                 28.  What is modulo operator? Give an example.
                Ans.  The % operator is termed as modulo operator. It calculates the remainder of division of one number by
                    another. For example, 5%2 shall return the result as 1—the remainder obtained when we are dividing
                    5 by 2.

                 29.  Which operator is used to compare the values of operands?
                Ans.  Relational operator.

                                                               2
   42   43   44   45   46   47   48   49   50   51   52