Code snippet:
import turtle
t=turtle.Pen()
for i in range(0,4):
t.forward(100)
t.left(120)
What will be the output shape of the code?
Anonymous Quiz
24%
square
39%
rectangle
26%
triangle
12%
kite
Code snippet:
def foo():
try:
return 1
finally:
return 2
k = foo()
print(k)
What will be the output of the statements?
Anonymous Quiz
35%
1
31%
2
7%
3
27%
error, there is more than one return statement in a single try-finally block
Code snippet:
a=[13,56,17]
a.append([87])
a.extend([45,67])
print(a)
๐1
What will be the output of the code?
Anonymous Quiz
28%
[13, 56, 17, [87], 45, 67]
27%
[13, 56, 17, 87, 45, 67]
21%
[13, 56, 17, 87, [45, 67]]
24%
[13, 56, 17, [87], [45, 67]]
When a value is truncated to 3 decimal places, which of the following is true?
Anonymous Quiz
15%
Both positive and negative numbers are rounded down.
31%
Positive numbers are rounded down and negative numbers are rounded up.
31%
Positive numbers are rounded up and negative numbers are rounded down.
22%
Both positive and negative numbers are rounded up.
Code snippet:
A = [[1, 2, 3],
[4, 5, 6],
[7, 8, 9]]
[A[i][i] for i in range(len(A))]
What will be the output of the code?
Anonymous Quiz
65%
[1, 5, 9]
16%
[3, 5, 7]
8%
[4, 5, 6]
12%
[2, 5, 8]
What will be the output of the code?
Anonymous Quiz
29%
__str__ called
24%
__repr__ called
19%
Error
28%
Nothing is printed