Logo

Python Questions Set 100:

Quiz Mode

x = (6*11+15-30/9*2)/7

print round (x)

1
2
3
4

Solution:

What is the output of the following command.


lt = [1,2,3,4,5]

print(lt.count(3))

1
2
3
4

Solution:

How can we print and state the type of the code

school = "abcd"

1
2
3

Solution:

import turtle


t=turtle.Pen()


t.backward(100)


t.penup()


t.tilt(75)


t.isdown()



1
2
3
4

Solution:

 

What will be the output of the following Python code?

>>>t = (1, 2, 4, 3, 8, 9)

>>>[t[i] for i in range(0, len(t), 2)]

1
2

Solution:

What will be the output of the following Python code?

x = "abcdef"
i = "i"
while i in x:
   print(i, end=" ")

1
2
3
4

Solution:

Command to open a file for writing

1
2
3
4

Solution:

What will be the output of the following Python code?


for i in range(float('inf')):

    print (i)

1
2
3
4

Solution:

 Which of the following functions can be used to find the coordinated universal time, assuming that the datetime module has already been imported? 

1
2
3
4

Solution:

In Python, we do not explicitly specify types. The interpreter directly handles the type inference. Consider the following operation:

>>>x = 13 ? 2

The objective is to ensure that the final value of x is an integer. Select all the options that apply (Python 3.xx).

1
2
3
4

Solution: