Dark Mode On/Off

# Python Online Practice Test - 3

This Test will cover complete Python with very important questions, starting off from basics to advanced level.
Q. What is the order of precedence in python?
 A. Parentheses, Exponential, Division, Multiplication, Addition, Subtraction B. Parentheses, Multiplication, Division, Exponential, Addition, Subtraction C. Parentheses, Division, Multiplication, Addition, Subtraction, Exponential D. None of the above
Q. What is the value of following expression: `3*1**3`
 A. 1 B. 3 C. 9 D. 27
Q. Which one of the following have the same precedence?
 A. Addition and Subtraction B. Multiplication and Division C. Both A and B D. None of the above
Q. What will be the output of the below program?
``````
>>>str="studytonight"
>>>str[:5]
>>>
```
```
 A. tonight B. study C. studytonight D. 5

Q. What is the datatype of below statement?
``````
L = [1, 'hello', 'studytonight', 1]
```
```
 A. Array B. Dictionary C. List D. Tuple
Q. Which datatype is used to store values in terms of key and value?
 A. Array B. List C. Class D. Dictionary
Q. What does ~9 evaluate to?
 A. 8 B. -8 C. 10 D. -10
Q. What is the value of following expression: `24//6%3`
 A. 0 B. 1 C. 2 D. 3
Q. What is the value of following expression: `bin(0x8)`
 A. 8 B. 1000 C. '0bx1000' D. '0b1000'

Q. What is the output of the code shown below?
``````
bool('False')
bool()
```
```
 A. True True B. False True C. False False D. True False
Q. What is the output of the code shown below?
``````
['study', 'tonight'][bool('')]
```
```
 A. Error B. No output C. study D. tonight
Q. What is pass statement in Python?
 A. It declares variables B. It defines function C. It is a null statement D. None of the above
Q. What is the output of the code shown below?
``````
if (9 < 0) and (0 < -9):
print("hello")
elif (9 > 0) or False:
print("study")
else:
print("tonight")
```
```
 A. hello B. study C. tonight D. None of the above
Q. What is the output of the code shown below?
``````
X="studytonight"
print("05d"%X)
```
```
 A. 00000studytonight B. studytonight00000 C. Error D. None of the above
Q. What is the output of the code shown below?
``````
s='{0}, {1}, and {2}'
s.format('hello', 'good', 'morning')
```
```
 A. 'hello study and tonight' B. 'hello, study, tonight' C. 'hello, study, and tonight' D. Error

### Related Tests:

#### Explore more Subjects:

Tests for various other programming languages and subjects: