Python Part 31 Interview Questions
Python interview questions part 31
Take as many assessments as you can to improve and validate your skill rating
Total Questions: 20
1. What is the output of the following? x = [34, 56] print((''.join(list(map(str, x)))),)
A. 3456
B. -3456
C. (‘3456’)
D. (‘3456’,)
Correct Answer is : 3456
2. 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
Correct Answer is : error
3. 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
Correct Answer is : [[‘a’], [‘b’], [‘c’], [‘d’]].
4. 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
Correct Answer is : none of the mentioned
5. 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
Correct Answer is : none of the mentioned
6. 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
Correct Answer is : none of the mentioned
7. 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
Correct Answer is : none of the mentioned
8. 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
Correct Answer is : Python code is both compiled and interpreted
9. 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
Correct Answer is : A folder of python modules
10. 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
Correct Answer is : Each import package need not introduce a namespace
11. What is returned by math.ceil(3.4)?
A. 3
B. 4
C. 4
D. 3
Correct Answer is : 4
12. What is the value returned by math.floor(3.4)?
A. 3
B. 4
C. 4
D. 3
Correct Answer is : 3
13. What is the output of print(math.copysign(3, -1))?
A. 1
B. 1
C. -3
D. -3
Correct Answer is : -3
14. What is displayed on executing print(math.fabs(-3.4))?
A. -3.4
B. 3.4
C. 3
D. -3
Correct Answer is : 3.4
15. 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
Correct Answer is : sometimes
16. What is the value returned by math.fact(6)?
A. 720
B. 6
C. [1, 2, 3, 6].
D. error
Correct Answer is : error
17. What is the value of x if x = math.factorial(0)?
A. 0
B. 1
C. error
D. none of the mentioned
Correct Answer is : 1
18. What is math.factorial(4.0)?
A. 24
B. 1
C. error
D. none of the mentioned
Correct Answer is : 24
19. What is the output of print(math.factorial(4.5))?
A. 24
B. 120
C. error
D. 24
Correct Answer is : error
20. What is math.floor(0o10)?
A. 8
B. 10
C. 0
D. 9
Correct Answer is : 8