PYTHON QUIZ
1 .
Which of the following operators has its associativity from right to left?

Correct Answer : Option (C)

**
  Show Answer
2 .
What will be the value of x in the following Python expression?
 
x = int(43.55+2/2)

Correct Answer : Option (B)

44
  Show Answer
3 .
What are the values of the following Python expressions?
 2**(3**2)
 (2**3)**2
 2**3**2

Correct Answer : Option (D)

512, 64, 512
  Show Answer
4 .
What is the value of the following expression?
 
8/4/2, 8/(4/2)

Correct Answer : Option (A)

(1.0, 4.0)
  Show Answer
5 .
What will be the output of the following Python code snippet?
 
X=”hi”
print(“05d”%X)

Correct Answer : Option (D)

error
  Show Answer
6 .
Read the information given below carefully and write a list comprehension such that the output is: [‘e’, ‘o’]
 
w="hello"
v=('a', 'e', 'i', 'o', 'u')

Correct Answer : Option (B)

[x for x in w if x in v]
  Show Answer
7 .
What will be the output of the following Python code?
 
t=32.00
[round((x-32)*5/9) for x in t]

Correct Answer : Option (D)

Error
  Show Answer
8 .
Write a list comprehension for producing a list of numbers between 1 and 1000 that are divisible by 3.

Correct Answer : Option (C)

[x for x in range(1000) if x%3==0]
  Show Answer
9 .
Write a list comprehension equivalent for the Python code shown below.
 
for i in range(1, 101):
	if int(i*0.5)==i*0.5:
		print(i)

Correct Answer : Option (B)

[i for i in range(1, 101) if int(i*0.5)==(i*0.5)]
  Show Answer
10 .
Write a list comprehension to produce the list: [1, 2, 4, 8, 16……212].

Correct Answer : Option (A)

[(2**x) for x in range(0, 13)]
  Show Answer