Python interview questions part 34

Python interview questions part 34

Take as many assements as you can to improve your validate your skill rating

Total Questions: 20

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)]

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)]

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)

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)

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?

Correct Answer is : -5

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)?

Correct Answer is : 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)?

Correct Answer is : 2

14. What does 3 ^ 4 evaluate to?

Correct Answer is : 7

15. What does os.name contain?

Correct Answer is : the name of the operating system dependent module imported

16. What does print(os.geteuid()) print?

Correct Answer is : the user id of the current process

17. What does os.getlogin() return?

Correct Answer is : name of the current user logged in

18. What does os.close(f) do?

Correct Answer is : close the file descriptor f

19. What does os.fchmod(fd, mode) do?

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()

Similar Interview Questions

    Search for latest jobs

    Icon
    Icon