Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Enduro 25 - 3

Total questions: 8

Worksheet time: 4mins

Name
Class
Date
1.

What does random() function of random module do?

a)

return a float between 0 and 1

b)

return a float between the input numbers

c)

return a int value between the input numbers

d)

all of these

2.

What is the correct syntax to use pi constant of Math module?

a)

math.pi()

b)

math.pi

c)

math(pi)

d)

pi()

3.

Which of the following data structure is not indexed by position?

a)

List

b)

Tuple

c)

Dictionary

d)

None of these

4.

What will be the output of the given code?

a)

9

b)

8

c)

7

d)

6

5.
a)

print(student[1])

b)

print(student.rol_no)

c)

print(student.get(1))

d)

print(student['roll_no'])

6.
a)

return the file abc.txt

b)

rewrite the file in text mode

c)

open the file in read only mode

d)

rewrite the file abc.txt

7.
a)

create a list of lines in the file

b)

store the file contents in a string

c)

create a dictionary of lines in the file

d)

stores each line of file as different file

8.

Which function is used select a random item from a list?

a)

random.choice()

b)

list.random()

c)

list.choose()

d)

math.random()