My Report

Python Programming Practice Test 8


Correct Answer: 2 points | Wrong: -1 point
Grades: A* (100% score) | A (80%-99%) | B (60%-80%) | C (40%-60%) | D (0%-40%)
advertisement

1. The output of both of the print statements is the same.

import datetime
dt_1 = datetime.datetime.today()
dt_2 = datetime.datetime.now()
print(dt_1)
print(dt_2)

2. Which of the following functions helps us to randomize the items of a list?

3. What is the interval of the value generated by the function random.random(), assuming that the random module has already been imported?

4. What will be the output of the following Python code?

import datetime
d=datetime.date(2016,7,24)
print(d)

5. What will be the output of the following Python code?

import turtle
t=turtle.Pen()
t.clear()
t.isvisible()

6. Which of the following cannot be returned by random.randrange(4)?

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

8. What the does random.seed(3) return?

9. What does random.shuffle(x) do when x = [1, 2, 3]?

10. What will be the output shape of the following Python code?

import turtle
t=turtle.Pen()
for i in range(0,6):
	t.forward(100)
	t.left(60)

 

Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.