Python interview questions part 5

Python interview questions part 5

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

Total Questions: 20

1. What is the output of the function shown below? all([2,4,0,6])

Correct Answer is : FALSE

2. What is the output of the expression? round(4.5676,2)?

Correct Answer is : 4.57

3. What is the output of the following function? any([2>8, 4>2, 1>2])

Correct Answer is : TRUE

4. What is the output of the function shown below? import math abs(math.sqrt(25))

Correct Answer is : 5

5. What are the outcomes of the functions shown below? sum(2,4,6) sum([1,2,3])

Correct Answer is : Error, 6

6. What is the output of the function: all(3,0,4.2)

Correct Answer is : Error

7. What is the output of the functions shown below? min(max(False,-3,-4), 2,7)

Correct Answer is : FALSE

8. What are the outcomes of the following functions? chr(‘97’) chr(97)

Correct Answer is : Error

9. What is the output of the following function? complex(1+2j)

Correct Answer is : 1+2j

10. What is the output of the function complex() ?

Correct Answer is : 0j

11. The function divmod(a,b), where both ‘a’ and ‘b’ are integers is evaluated as:

Correct Answer is : (a//b, a%b)

12. What is the output of the functions shown below? divmod(10.5,5) divmod(2.4,1.2)

Correct Answer is : (2.0, 0.5)

13. The function complex(‘2-3j’) is valid but the function complex(‘2 – 3j’) is invalid. State whether this statement is true or false.

Correct Answer is : TRUE

14. What is the output of the function shown below? list(enumerate([2, 3]))

Correct Answer is : [(0, 2), (1, 3)]

15. What are the outcomes of the function shown below? x=3 eval('x^2')

Correct Answer is : 1

16. What is the output of the functions shown below? float('1e-003') float('2e+003')

Correct Answer is : 0.001

17. Which of the following functions does not necessarily accept only iterables as arguments?

Correct Answer is : chr()

18. Which of the following functions accepts only integers as arguments?

Correct Answer is : chr()

19. Suppose there is a list such that: l=[2,3,4]. If we want to print this list in reverse order, which of the following methods should be used?

Correct Answer is : list(reversed(l))

20. The output of the function: float(' -12345\n') (Note that the number of blank spaces before the number is 5)

Correct Answer is : -12345

Similar Interview Questions

    Search for latest jobs

    Icon
    Icon