1. What is the output of the code shown?
A = [[1, 2, 3],
[4, 5, 6],
[7, 8, 9]]
B = [[3, 3, 3],
[4, 4, 4],
[5, 5, 5]]
[[col1 * col2 for (col1, col2) in zip(row1, row2)] for (row1, row2) in zip(A, B)]
A. [0, 30, 60, 120, 160, 200, 300, 350, 400]
B. [[0, 30, 60], [120, 160, 200], [300, 350, 400]]
Correct Answer is : [[0, 30, 60], [120, 160, 200], [300, 350, 400]]
2. What is the output of the code shown?
A = [[1, 2, 3],
[4, 5, 6],
[7, 8, 9]]
B = [[3, 3, 3],
[4, 4, 4],
[5, 5, 5]]
[[col1 * col2 for (col1, col2) in zip(row1, row2)] for (row1, row2) in zip(A, B)]
A. [0, 30, 60, 120, 160, 200, 300, 350, 400]
B. [[0, 30, 60], [120, 160, 200], [300, 350, 400]]
Correct Answer is : [[0, 30, 60], [120, 160, 200], [300, 350, 400]]
3. What is the output of the code shown?
A = [[1, 2, 3],
[4, 5, 6],
[7, 8, 9]]
B = [[3, 3, 3],
[4, 4, 4],
[5, 5, 5]]
zip(A, B)
A. Address of the zip object
B. Address of the matrices A and B
D. [3, 6, 9, 16, 20, 24, 35, 40, 45]
Correct Answer is : Address of the zip object
4. What is the output of the code shown?
A = [[1, 2, 3],
[4, 5, 6],
[7, 8, 9]]
B = [[3, 3, 3],
[4, 4, 4],
[5, 5, 5]]
zip(A, B)
A. Address of the zip object
B. Address of the matrices A and B
D. [3, 6, 9, 16, 20, 24, 35, 40, 45]
Correct Answer is : Address of the zip object
5. What is the output of print 0.1 + 0.2 == 0.3?
Correct Answer is : FALSE
6. Which of the following is not a complex number?
Correct Answer is : k = 2 + 3l
7. What is the type of inf?
Correct Answer is : Float
8. What does ~4 evaluate to?
9. What does ~~~~~~5 evaluate to?
Correct Answer is : 45295
10. Which of the following is incorrect?
Correct Answer is : x = 03964
11. What is the result of cmp(3, 1)?
12. Which of the following is incorrect?
Correct Answer is : float(’12+34′)
13. What is the result of round(0.5) – round(-0.5)?
14. What does 3 ^ 4 evaluate to?
15. What does os.name contain?
A. the name of the operating system dependent module imported
B. the address of the module os
C. error, it should’ve been os.name()
Correct Answer is : the name of the operating system dependent module imported
16. What does print(os.geteuid()) print?
A. the group id of the current process
B. the user id of the current process
C. both the group id and the user of the current process
Correct Answer is : the user id of the current process
17. What does os.getlogin() return?
A. name of the current user logged in
C. gets a form to login as a different user
Correct Answer is : name of the current user logged in
18. What does os.close(f) do?
A. terminate the process f
B. terminate the process f if f is not responding
C. close the file descriptor f
D. return an integer telling how close the file pointer is to the end of file
Correct Answer is : close the file descriptor f
19. What does os.fchmod(fd, mode) do?
A. change permission bits of the file
B. change permission bits of the directory
C. change permission bits of either the file or the directory
Correct Answer is : change permission bits of the file
20. Which of the following functions can be used to read data from a file using a file descriptor?
Correct Answer is : os.read()