JOBSEEKERS
Login
Sign Up
Jobseeker
Employer
Staffing Firm
Direct Client
Python interview questions part 4
Python interview questions part 4
Back
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)?
A. 1011
B. 11
C. 13
D.
Show Correct Answer
Correct Answer is :
1011
2. To find the decimal value of 1111, that is 15, we can use the function:
A. int(1111,10)
B. int(‘1111’,10)
C. int(1111,2)
D. int(‘1111’,2)
Show Correct Answer
Correct Answer is :
int(‘1111’,2)
3. What is the result of the expression if x=15 and y=12: x & y
A. b1101
B. 0b1101
C. 12
D. 1101
Show Correct Answer
Correct Answer is :
12
4. Which of the following expressions results in an error?
A. int(1011)
B. int(‘1011’,23)
C. int(1011,2)
D. int(‘1011’)
Show Correct Answer
Correct Answer is :
int(1011,2)
5. Which of the following represents the bitwise XOR operator?
A. &
B. ^
C. |
D. !
Show Correct Answer
Correct Answer is :
^
6. What is the value of this expression? bin(0x8)
A. ‘0bx1000’
B. 8
C. 1000
D. ‘0b1000’
Show Correct Answer
Correct Answer is :
‘0b1000’
7. What is the result of the expression: 0x35 | 0x75
A. 115
B. 116
C. 117
D. 118
Show Correct Answer
Correct Answer is :
117
8. The output of the snippet of code shown below? bool(‘False’) bool()
A. TRUE
B. FALSE
C. FALSE
D. TRUE
Show Correct Answer
Correct Answer is :
TRUE
9. What is the output of the snippet of code shown below? ['hello', 'morning'][bool('')]
A. error
B. no output
C. hello
D. morning
Show Correct Answer
Correct Answer is :
hello
10. What is the output of the code shown below? not(3>4) not(1&1)
A. TRUE
B. TRUE
C. FALSE
D. FALSE
Show Correct Answer
Correct Answer is :
TRUE
11. What is the output of the code shown? ['f', 't'][bool('spam')]
A. t
B. f
C. No output
D. Error
Show Correct Answer
Correct Answer is :
t
12. What is the output of the code shown below? l=[1, 0, 2, 0, 'hello', '', []] list(filter(bool, l))
A. Error
B. [1, 0, 2, 0, ‘hello’, ”, []]
C. [1, 0, 2, ‘hello’, ”, []]
D. [1, 2, ‘hello’]
Show Correct Answer
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 [ ]
A. [ ]
B. [ ]
C. {}
D. {}
Show Correct Answer
Correct Answer is :
{}
14. What is the output of the code shown below? class Truth: pass x=Truth() bool(x)
A. pass
B. TRUE
C. FALSE
D. error
Show Correct Answer
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")
A. error
B. hello
C. good
D. bad
Show Correct Answer
Correct Answer is :
good
16. Which of the following Boolean expressions is not logically equivalent to the other three?
A. not(-6<0 or-6>10)
B. -6>=0 and -6<=10
C. not(-6<10 or-6==10)
D. not(-6>10 or-6==10)
Show Correct Answer
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)
A. TRUE
B. FALSE
C. Error
D. No output
Show Correct Answer
Correct Answer is :
FALSE
18. Which of the following functions is a built-in function in python?
A. seed()
B. sqrt()
C. factorial()
D. print()
Show Correct Answer
Correct Answer is :
print()
19. What is the output of the expression: round(4.576)
A. 4.5
B. 5
C. 4
D. 4.6
Show Correct Answer
Correct Answer is :
5
20. The function pow(x,y,z) is evaluated as:
A. (x**y)**z
B. (x**y) / z
C. (x**y) % z
D. (x**y)*z
Show Correct Answer
Correct Answer is :
(x**y) % z
Similar Interview Questions
Search for latest jobs
Find Jobs