Python

Python

Mapping Functions has 26 Questions
What is the output of the following?
elements = [0, 1, 2]
def incr(x):
    return x+1
print(list(map(elements, incr)))

[1, 2, 3]
[0, 1, 2]
error
none of the mentioned
What is the output of the following?
elements = [0, 1, 2]
def incr(x):
    return x+1
print(list(map(incr, elements)))

[1, 2, 3]
[0, 1, 2]
error
none of the mentioned
What is the output of the following?
x = ['ab', 'cd']
print(list(map(upper, x)))

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

['a', 'b', 'c', 'd']
['abcd']
[['a'], ['b'], ['c'], ['d']]
none of the mentioned
What is the output of the following?
x = abcd
print(list(map(list, x)))

['a', 'b', 'c', 'd']
['abcd']
[['a'], ['b'], ['c'], ['d']]
none of the mentioned
What is the output of the following?
x = 1234
print(list(map(list, x)))

[1, 2, 3, 4]
[1234]
[[1], [2], [3], [4]]
none of the mentioned
What is the output of the following?
x = 1234
print(list(map(list, [x])))

[1, 2, 3, 4]
[1234]
[[1], [2], [3], [4]]
none of the mentioned
What is the output of the following?
x = 'abcd'
print(list(map([], x)))

['a', 'b', 'c', 'd']
['abcd']
[['a'], ['b'], ['c'], ['d']]
none of the mentioned