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. Which of the following functions can help us to find the version of python that we are currently working on?

2. State whether true or false.

s = time.time()
t= time.time()
s == t

3. Point out the error (if any) in the code shown below if the system date is 18th June, 2017?

tday=datetime.date.today()
bday=datetime.date(2017,9,18)
till_bday=bday-tday
print(till_bday)

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

import turtle
t=turtle.Pen()
for i in range(0,3):
	t.forward(100)
	t.left(120)
	
t.back(100)
for i in range(0,3):
	t.forward(100)
	t.left(120)

5. To sterilize an object hierarchy, the _____________ function must be called. To desterilize a data stream, the ______________ function must be called.

6. What is the range of values that random.random() can return?

7. Which of the following functions results in an error?

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

random.randrange(0,91,5)

9. What is the value of x if x = math.sqrt(4)?

10. The randrange function returns only an integer value.


 

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.