Program code making use of a given module is called a ______ of the module.
1.Client
2.Docstring
3.Interface
4.Modularity
What will be the output of the following Python code? x = 'abcd' print(list(map(list, x)))
1.[‘a’, ‘b’, ‘c’, ‘d’]
2. [‘abcd’]
3.[[‘a’], [‘b’], [‘c’], [‘d’]]
4.none of the mentioned
What will be the output of the following Python code? x = abcd print(list(map(list, x)))
1.[‘a’, ‘b’, ‘c’, ‘d’]
2.[‘abcd’]
3.[[‘a’], [‘b’], [‘c’], [‘d’]]
4.none of the mentioned
What will be the output of the following Python code? x = [34, 56] print(len(map(str, x)))
1. [34, 56]
2. [’34’, ’56’]
3.34 56
4.error
What will be the output of the following Python code? x = [[0], [1]] print((' '.join(list(map(str, x)))))
1.(‘[0] [1]’,)
2.(’01’,)
3. [0] [1]
4.01
Which of the following is not a valid namespace?
1.Global namespace
2. Public namespace
3.Built-in namespace
4.Local namespace
______ is a string literal denoted by triple quotes for providing the specifications of certain program elements.
1.Interface
2.Modularity
3.Client
4.Docstring
Is the output of the function abs() the same as that of the function math.fabs()?
1.sometimes
2.always
3.never
4.none of the mentioned
What is displayed on executing print(math.fabs(-3.4))?
1.-3.4
2.3.4
3.3
4. -3
What is math.factorial(4.0)?
1. 24
2.1
3. error
4.none of the mentioned
What is math.floor(0o10)?
1.8
2.10
3.0
4.9
What is returned by math.ceil(3.4)?
1.3
2.4
3.4.0
4. 3.0
What is the value of x if x = math.factorial(0)?
1. 0
2.1
3.error
4.none of the mentioned
What is the value returned by math.fact(6)?
1. 720
2.6
3.[1, 2, 3, 6]
4. error
What is the value returned by math.floor(3.4)?
1.3
2.4
3.4.0
4.3.0
What will be the output of print(math.copysign(3, -1))?
1.1
2.1.0
3. -3
4.-3.0
What will be the output of print(math.factorial(4.5))?
1.24
2. 120
3. error
4. 24.0
What will be the output of the following Python code? #mod1 def change(a): b=[x*2 for x in a] print(b) #mod2 def change(a): b=[x*x for x in a] print(b) from mod1 import change from mod2 import change #main s=[1,2,3] change(s)
1. [2,4,6]
2.[1,4,9]
3.[2,4,6] [1,4,9]
4.There is a name clash
What will be the output of the following Python code? def to_upper(k): k.upper() x = ['ab', 'cd'] print(list(map(to_upper, x)))
1. [‘AB’, ‘CD’]
2.[‘ab’, ‘cd’]
3.none of the mentioned
4.error
What will be the output of the following Python code? def to_upper(k): return k.upper() x = ['ab', 'cd'] print(list(map(to_upper, x)))
1.[‘AB’, ‘CD’]
2.[‘ab’, ‘cd’]
3.none of the mentioned
4. error
What will be the output of the following Python code? def to_upper(k): return k.upper() x = ['ab', 'cd'] print(list(map(upper, x)))
1. [‘AB’, ‘CD’]
2. [‘ab’, ‘cd’]
3.none of the mentioned
4. error
What will be the output of the following Python code? elements = [0, 1, 2] def incr(x): return x+1 print(list(map(elements, incr)))
1.[1, 2, 3]
2.[0, 1, 2]
3.error
4.none of the mentioned
What will be the output of the following Python code? elements = [0, 1, 2] def incr(x): return x+1 print(list(map(incr, elements)))
1. [1, 2, 3]
2.[0, 1, 2]
3.error
4.none of the mentioned
What will be the output of the following Python code? from math import factorial print(math.factorial(5))
1.120
2.Nothing is printed
3.Error, method factorial doesn’t exist in math module
4.Error, the statement should be: print(factorial(5))
What will be the output of the following Python code? x = 'abcd' print(list(map([], x)))
1. [‘a’, ‘b’, ‘c’, ‘d’]
2.[‘abcd’]
3. [[‘a’], [‘b’], [‘c’], [‘d’]]
4.none of the mentioned
What will be the output of the following Python code? x = 1234 print(list(map(list, x)))
1. [1, 2, 3, 4]
2. [1234]
3. [[1], [2], [3], [4]]
4.none of the mentioned
What will be the output of the following Python code? x = 1234 print(list(map(list, [x])))
1.[1, 2, 3, 4]
2. [1234]
3. [[1], [2], [3], [4]]
4.none of the mentioned
What will be the output of the following Python code? x = ['ab', 'cd'] print(len(list(map(list, x))))
1. 2
2.4
3. error
4.none of the mentioned
What will be the output of the following Python code? x = ['ab', 'cd'] print(len(list(map(list, x))))))
1.2
2. 4
3. error
4.none of the mentioned
What will be the output of the following Python code? x = ['ab', 'cd'] print(len(map(list, x)))
1. [2, 2]
2.2
3. 4
4.none of the mentioned
What will be the output of the following Python code? x = ['ab', 'cd'] print(list(map(len, x)))
1.[‘ab’, ‘cd’]
2. [2, 2]
3.[‘2’, ‘2’]
4. None of the mentioned
What will be the output of the following Python code? x = ['ab', 'cd'] print(list(map(list, x)))
1.[‘a’, ‘b’, ‘c’, ‘d’]
2.[[‘ab’], [‘cd’]]
3.[[‘a’, ‘b’], [‘c’, ‘d’]]
4.none of the mentioned
What will be the output of the following Python code? x = ['ab', 'cd'] print(list(map(upper, x)))
1. [‘AB’, ‘CD’]
2.[‘ab’, ‘cd’]
3. error
4.none of the mentioned
What will be the output of the following Python code? x = ['ab', 'cd'] print(map(len, x))
1.[‘ab’, ‘cd’]
2. [2, 2]
3. [‘2’, ‘2’]
4. None of the mentioned
What will be the output of the following Python code? x = [12, 34] print(len(' '.join(list(map(int, x)))))
1. 4
2.5
3.6
4.error
What will be the output of the following Python code? x = [12, 34] print(len(''.join(list(map(int, x)))))
1. 4
2. 2
3. error
4.none of the mentioned
What will be the output of the following Python code? x = [12, 34] print(len(''.join(list(map(str, x)))))
1.4
2. 5
3.6
4.error
What will be the output of the following Python code? x = [12, 34] print(len(list(map(int, x))))
1.2
2.1
3.error
4.none of the mentioned
What will be the output of the following Python code? x = [12, 34] print(len(list(map(len, x))))
1.2
2.1
3.error
4.none of the mentioned
What will be the output of the following Python code? x = [12.1, 34.0] print(' '.join(list(map(str, x))))
1.12 1 34 0
2. 12.1 34
3.121 340
4.12.1 34.0
What will be the output of the following Python code? x = [12.1, 34.0] print(len(' '.join(list(map(str, x)))))
1. 6
2. 8
3.9
4.error
What will be the output of the following Python code? x = [34, 56] print((''.join(list(map(str, x)))),)
1.3456
2.(3456)
3.(‘3456’)
4. (‘3456’,)
What will be the output of the following Python code? x = [34, 56] print((''.join(list(map(str, x))),))
1.3456
2. (3456)
3.(‘3456’)
4.(‘3456’,)
What will be the output of the following Python code? x = [[0], [1]] print(len(' '.join(list(map(str, x)))))
1.2
2. 3
3.7
4.8
Which of the following is false about “from-import†form of import?
1.The syntax is: from modulename import identifier
2. This form of import prevents name clash
3.The namespace of imported module becomes part of importing module
4.The identifiers in module are accessed directly as: identifier
Which of the following is false about “import modulename†form of import?
1. The namespace of imported module becomes part of importing module
2.This form of import prevents name clash
3.The namespace of imported module becomes available to importing module
4. The identifiers in module are accessed as: modulename.identifier
Which of the following is not an advantage of using modules?
1. Provides a means of reuse of program code
2.Provides a means of dividing up tasks
3.Provides a means of reducing the size of the program
4.Provides a means of testing individual parts of the program
Which of the following is true about top-down design process?
1. The details of a program design are addressed before the overall design
2.Only the details of the program are addressed
3.The overall design of the program is addressed before the details
4.Only the design of the program is addressed
Which of the following isn’t true about main modules?
1.When a python file is directly executed, it is considered main module of a program
2.Main modules may import any number of modules
3.Special name given to main modules is: __main__
4.Other main modules can import main modules
Which of the statements about modules is false?
1. In the “from-import†form of import, identifiers beginning with two underscores are private and aren’t imported
2.dir() built-in function monitors the items in the namespace of the main module
3.In the “from-import†form of import, all identifiers regardless of whether they are private or public are imported
4.When a module is loaded, a compiled version of the module with file extension .pyc is automatically produced
Which of these definitions correctly describes a module?
1.Denoted by triple quotes for providing the specification of certain program elements
2.Design and implementation of specific functionality to be incorporated into a program
3.Defines the specification of how it is to be used
4.Any program that reuses code
which of these is false about a package?
1. A package can have subfolders and modules
2.Each import package need not introduce a namespace
3. import folder.subfolder.mod1 imports packages
4.from folder.subfolder.mod1 import objects imports packages