Python Mapping Function Interview Questions: Python MCQs

Python Mapping Function Interview Questions. Interview Questions in Multiple Choice Questions form on the topic Mapping Functions in Python language.

 

Python Mapping Function Interview Questions

 

 

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

 

What will be the output of the following Python code ??

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

 

What will be the output of the following ??

x = [‘ab’, ‘cd’]
print(list(map(upper, x)))

a) [‘AB’, ‘CD’]
b) [‘ab’, ‘cd’]
c) error
d) none of the mentioned

 

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

 

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

 

What will be the output of the following code ??

elements = [0, 1, 2]
def incr(x):
return x+1
print(list(map(incr, elements)))

a) [1, 2, 3]
b) [0, 1, 2]
c) error
d) none of the mentioned

 

What will be 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

 

What will be the output of the following code ??

x = 1234
print(list(map(list, [x])))

a) [1, 2, 3, 4]
b) [1234]
c) [[1], [2], [3], [4]]
d) none of the mentioned

 

What will be the output ??

x = 1234
print(list(map(list, x)))

a) [1, 2, 3, 4]
b) [1234]
c) [[1], [2], [3], [4]]
d) none of the mentioned

 

What will be the output of ??

x = abcd
print(list(map(list, x)))

a) [‘a’, ‘b’, ‘c’, ‘d’]
b) [‘abcd’]
c) [[‘a’], [‘b’], [‘c’], [‘d’]]
d) none of the mentioned

 

What will be the output of code ??

x = ‘abcd’
print(list(map(list, x)))

a) [‘a’, ‘b’, ‘c’, ‘d’]
b) [‘abcd’]
c) [[‘a’], [‘b’], [‘c’], [‘d’]]
d) none of the mentioned

 

What will be the output of code ??

x = [34, 56]
print(len(map(str, x)))

a) [34, 56]
b) [’34’, ’56’]
c) 34 56
d) error

 

What is the output ??

x = [34, 56]
print((”.join(list(map(str, x)))),)

a) 3456
b) (3456)
c) (‘3456’)
d) (‘3456’,)

 

What will be the output of ??

x = [34, 56]
print((”.join(list(map(str, x))),))

a) 3456
b) (3456)
c) (‘3456’)
d) (‘3456’,)

 

What will be the output of the following Python code ??

x = [‘ab’, ‘cd’]
print(len(list(map(list, x))))))

a) 2
b) 4
c) error
d) none of the mentioned

 

What will be the output of this code ??

elements = [0, 1, 2]
def incr(x):
return x+1
print(list(map(elements, incr)))

a) [1, 2, 3]
b) [0, 1, 2]
c) error
d) none of the mentioned

 

What will be the answer ??

x = [[0], [1]]
print((‘ ‘.join(list(map(str, x))),))

a) (‘[0] [1]’,)
b) (’01’)
c) [0] [1]
d) 01

 

What will be the output of the Python code ??

x = [[0], [1]]
print((‘ ‘.join(list(map(str, x)))))

a) (‘[0] [1]’,)
b) (’01’,)
c) [0] [1]
d) 01

Leave a Comment

Your email address will not be published. Required fields are marked *

error: Content is protected !!