Python interview questions part 4

Python interview questions part 4

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

Total Questions: 20

1. What is the result of the expression: int(1011)?

Correct Answer is : 1011

2. To find the decimal value of 1111, that is 15, we can use the function:

Correct Answer is : int(‘1111’,2)

3. What is the result of the expression if x=15 and y=12: x & y

Correct Answer is : 12

4. Which of the following expressions results in an error?

Correct Answer is : int(1011,2)

5. Which of the following represents the bitwise XOR operator?

Correct Answer is : ^

6. What is the value of this expression? bin(0x8)

Correct Answer is : ‘0b1000’

7. What is the result of the expression: 0x35 | 0x75

Correct Answer is : 117

8. The output of the snippet of code shown below? bool(‘False’) bool()

Correct Answer is : TRUE

9. What is the output of the snippet of code shown below? ['hello', 'morning'][bool('')]

Correct Answer is : hello

10. What is the output of the code shown below? not(3>4) not(1&1)

Correct Answer is : TRUE

11. What is the output of the code shown? ['f', 't'][bool('spam')]

Correct Answer is : t

12. What is the output of the code shown below? l=[1, 0, 2, 0, 'hello', '', []] list(filter(bool, l))

Correct Answer is : [1, 2, ‘hello’]

13. What is the output of the following code if the system date is 21st June, 2017 (Wednesday)? [ ] or {} {} or [ ]

Correct Answer is : {}

14. What is the output of the code shown below? class Truth: pass x=Truth() bool(x)

Correct Answer is : TRUE

15. What is the output of the code shown below? if (9 < 0) and (0 < -9): print("hello") elif (9 > 0) or False: print("good") else: print("bad")

Correct Answer is : good

16. Which of the following Boolean expressions is not logically equivalent to the other three?

Correct Answer is : not(-6>10 or-6==10)

17. The output of the line of code shown below is: not(10<20) and not(10>30)

Correct Answer is : FALSE

18. Which of the following functions is a built-in function in python?

Correct Answer is : print()

19. What is the output of the expression: round(4.576)

Correct Answer is : 5

20. The function pow(x,y,z) is evaluated as:

Correct Answer is : (x**y) % z

Similar Interview Questions

    Search for latest jobs

    Icon
    Icon