Explore topic-wise MCQs in Technical Programming.

This section includes 1007 Mcqs, each offering curated multiple-choice questions to sharpen your Technical Programming knowledge and support exam preparation. Choose a topic below to get started.

351.

What is the output of print(math.factorial(4.5))?

A. 24
B. 120
C. error
D. 24.0
Answer» D. 24.0
352.

What is math.factorial(4.0)?

A. 24
B. 1
C. error
D. none of the mentioned
Answer» B. 1
353.

What is the value of x if x = math.factorial(0)?

A. 0
B. 1
C. error
D. none of the mentioned
Answer» C. error
354.

What is the value returned by math.fact(6)?

A. 720
B. 6
C. [1, 2, 3, 6].
D. error
Answer» E.
355.

Is the output of the function abs() the same as that of the function math.fabs()?

A. sometimes
B. always
C. never
D. none of the mentioned
Answer» B. always
356.

What is displayed on executing print(math.fabs(-3.4))?

A. -3.4
B. 3.4
C. 3
D. -3
Answer» C. 3
357.

What is the output of print(math.copysign(3, -1))?

A. 1
B. 1.0
C. -3
D. -3.0
Answer» E.
358.

What is the value returned by math.floor(3.4)?

A. 3
B. 4
C. 4.0
D. 3.0
Answer» B. 4
359.

What is returned by math.ceil(3.4)?

A. 3
B. 4
C. 4.0
D. 3.0
Answer» C. 4.0
360.

What is the order of namespaces in which Python looks for an identifier?

A. Python first searches the global namespace, then the local namespace and finally the built-in namespace
B. Python first searches the local namespace, then the global namespace and finally the built-in namespace
C. Python first searches the built-in namespace, then the global namespace and finally the local namespace
D. Python first searches the built-in namespace, then the local namespace and finally the global namespace
Answer» C. Python first searches the built-in namespace, then the global namespace and finally the local namespace
361.

What is the output of the following piece of code? from math import factorial print(math.factorial(5))

A. 120
B. Nothing is printed
C. Error, method factorial doesn’t exist in math module
D. Error, the statement should be: print(factorial(5))
Answer» E.
362.

Which of the statements about modules is false?

A. In the “from-import” form of import, identifiers beginning with two underscores are private and aren’t imported
B. dir() built-in function monitors the items in the namespace of the main module
C. In the “from-import” form of import, all identifiers regardless of whether they are private or public are imported
D. When a module is loaded, a compiled version of the module with file extension .pyc is automatically produced
Answer» D. When a module is loaded, a compiled version of the module with file extension .pyc is automatically produced
363.

Which of the following is false about “from-import” form of import?

A. The syntax is: from modulename import identifier
B. This form of import prevents name clash
C. The namespace of imported module becomes part of importing module
D. The identifiers in module are accessed directly as: identifier
Answer» C. The namespace of imported module becomes part of importing module
364.

Which of the following is false about “import modulename” form of import?

A. The namespace of imported module becomes part of importing module
B. This form of import prevents name clash
C. The namespace of imported module becomes available to importing module
D. The identifiers in module are accessed as: modulename.identifier
Answer» B. This form of import prevents name clash
365.

Which of the following is not a valid namespace?

A. Global namespace
B. Public namespace
C. Built-in namespace
D. Local namespace
Answer» C. Built-in namespace
366.

Which of the following isn’t true about main modules?

A. When a python file is directly executed, it is considered main module of a program
B. Main modules may import any number of modules
C. Special name given to main modules is: __main__
D. Other main modules can import main modules
Answer» E.
367.

What is the output of the following piece of 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)

A. [2,4,6].
B. [1,4,9].
C. 2,4,6]. [1,4,9].
D. There is a name clash
Answer» E.
368.

Which of the following is true about top-down design process?

A. The details of a program design are addressed before the overall design
B. Only the details of the program are addressed
C. The overall design of the program is addressed before the details
D. Only the design of the program is addressed
Answer» D. Only the design of the program is addressed
369.

_____ is a string literal denoted by triple quotes for providing the specifications of certain program elements.

A. Interface
B. Modularity
C. Client
D. Docstring
Answer» E.
370.

Program code making use of a given module is called a ______ of the module.

A. Client
B. Docstring
C. Interface
D. Modularity
Answer» B. Docstring
371.

Which of the following is not an advantage of using modules?

A. Provides a means of reuse of program code
B. Provides a means of dividing up tasks
C. Provides a means of reducing the size of the program
D. Provides a means of testing individual parts of the program
Answer» D. Provides a means of testing individual parts of the program
372.

Which of these definitions correctly describes a module?

A. Denoted by triple quotes for providing the specification of certain program elements
B. Design and implementation of specific functionality to be incorporated into a program
C. Defines the specification of how it is to be used
D. Any program that reuses code
Answer» C. Defines the specification of how it is to be used
373.

Which of these is false about a package?

A. A package can have subfolders and modules
B. Each import package need not introduce a namespace
C. import folder.subfolder.mod1 imports packages
D. from folder.subfolder.mod1 import objects imports packages
Answer» C. import folder.subfolder.mod1 imports packages
374.

Which of these is the definition for packages in Python?

A. A folder of python modules
B. A set of programs making use of Python modules
C. A set of main modules
D. A number of files containing Python definitions and statements
Answer» B. A set of programs making use of Python modules
375.

Is Python code compiled or interpreted?

A. Python code is only compiled
B. Python code is both compiled and interpreted
C. Python code is only interpreted
D. Python code is neither compiled nor interpreted
Answer» C. Python code is only interpreted
376.

What is the output of the following? x = 'abcd' print(list(map([], x)))

A. [‘a’, ‘b’, ‘c’, ‘d’].
B. [‘abcd’].
C. [[‘a’], [‘b’], [‘c’], [‘d’]].
D. none of the mentioned
Answer» E.
377.

What is the output of the following? x = 1234 print(list(map(list, [x])))

A. [1, 2, 3, 4].
B. [1234].
C. [[1], [2], [3], [4]].
D. none of the mentioned
Answer» E.
378.

What is the output of the following? x = 1234 print(list(map(list, x)))

A. [1, 2, 3, 4].
B. [1234].
C. [[1], [2], [3], [4]].
D. none of the mentioned
Answer» E.
379.

What is the output of the following? x = abcd print(list(map(list, x)))

A. [‘a’, ‘b’, ‘c’, ‘d’].
B. [‘abcd’].
C. [[‘a’], [‘b’], [‘c’], [‘d’]].
D. none of the mentioned
Answer» E.
380.

What is the output of the following? x = 'abcd' print(list(map(list, x)))

A. [‘a’, ‘b’, ‘c’, ‘d’].
B. [‘abcd’].
C. [[‘a’], [‘b’], [‘c’], [‘d’]].
D. none of the mentioned
Answer» D. none of the mentioned
381.

What is the output of the following? x = [34, 56] print(len(map(str, x)))

A. [34, 56].
B. [’34’, ’56’].
C. 34 56
D. error
Answer» E.
382.

What is the output of the following? x = [34, 56] print((''.join(list(map(str, x)))),)

A. 3456
B. (3456)
C. (‘3456’)
D. (‘3456’,)
Answer» B. (3456)
383.

What is the output of the following? x = [34, 56] print((''.join(list(map(str, x))),))

A. 3456
B. (3456)
C. (‘3456’)
D. (‘3456’,)
Answer» E.
384.

What is the output of the following? x = [[0], [1]] print((' '.join(list(map(str, x))),))

A. (‘[0] [1]’,)
B. (’01’)
C. 0] [1].
D. 01
Answer» B. (’01’)
385.

What is the output of the following? x = [[0], [1]] print((' '.join(list(map(str, x)))))

A. (‘[0] [1]’,)
B. (’01’,)
C. [0] [1].
D. 01
Answer» D. 01
386.

What is the output of the following? x = [[0], [1]] print(len(' '.join(list(map(str, x)))))

A. 2
B. 3
C. 7
D. 8
Answer» D. 8
387.

What is the output of the following? x = [12.1, 34.0] print(' '.join(list(map(str, x))))

A. 12 1 34 0
B. 12.1 34
C. 121 340
D. 12.1 34.0
Answer» E.
388.

What is the output of the following? x = [12.1, 34.0] print(len(' '.join(list(map(str, x)))))

A. 6
B. 8
C. 9
D. error
Answer» D. error
389.

What is the output of the following? x = [12, 34] print(len(' '.join(list(map(int, x)))))

A. 4
B. 5
C. 6
D. error
Answer» E.
390.

What is the output of the following? x = [12, 34] print(len(''.join(list(map(str, x)))))

A. 4
B. 5
C. 6
D. error
Answer» B. 5
391.

What is the output of the following? x = [12, 34] print(len(''.join(list(map(int, x)))))

A. 2
B. 4
C. error
D. none of the mentioned
Answer» D. none of the mentioned
392.

What is the output of the following? x = [12, 34] print(len(list(map(int, x))))

A. 2
B. 1
C. error
D. none of the mentioned
Answer» B. 1
393.

What is the output of the following? x = [12, 34] print(len(list(map(len, x))))

A. 2
B. 1
C. error
D. none of the mentioned
Answer» D. none of the mentioned
394.

What is the output of the following? x = ['ab', 'cd'] print(list(map(list, x)))

A. [‘a’, ‘b’, ‘c’, ‘d’].
B. [[‘ab’], [‘cd’]].
C. [[‘a’, ‘b’], [‘c’, ‘d’]].
D. none of the mentioned
Answer» D. none of the mentioned
395.

What is the output of the following? x = ['ab', 'cd'] print(len(list(map(list, x))))))

A. 2
B. 4
C. error
D. none of the mentioned
Answer» D. none of the mentioned
396.

What is the output of the following? x = ['ab', 'cd'] print(len(list(map(list, x))))

A. 2
B. 4
C. error
D. none of the mentioned
Answer» B. 4
397.

What is the output of the following? x = ['ab', 'cd'] print(len(map(list, x)))

A. [2, 2].
B. 2
C. 4
D. none of the mentioned
Answer» E.
398.

What is the output of the following? x = ['ab', 'cd'] print(list(map(len, x)))

A. [‘ab’, ‘cd’].
B. [2, 2].
C. [‘2’, ‘2’].
D. none of the mentioned
Answer» C. [‘2’, ‘2’].
399.

What is the output of the following? x = ['ab', 'cd'] print(map(len, x))

A. [‘ab’, ‘cd’].
B. [2, 2].
C. [‘2’, ‘2’].
D. none of the mentioned
Answer» E.
400.

What is the output of the following? def to_upper(k): k.upper() x = ['ab', 'cd'] print(list(map(to_upper, x)))

A. [‘AB’, ‘CD’].
B. [‘ab’, ‘cd’].
C. none of the mentioned
D. error
Answer» D. error