gs gs109 Python Modules - Python Datetime Module - Quiz No.2
gs gs109 Python Quiz
This quiz belongs to book/course code gs gs109 Python of gs organization. We have 134 quizzes available related to the book/course Python. This quiz has a total of 10 multiple choice questions (MCQs) to prepare and belongs to topic Python Modules. NVAEducation wants its users to help them learn in an easy way. For that purpose, you are free to prepare online MCQs and quizzes.
NVAEducation also facilitates users to contribute in online competitions with other students to make a challenging situation to learn in a creative way. You can create one to one, and group competition on an topic of a book/course code. Also on NVAEducation you can get certifications by passing the online quiz test.
Question 2: Which of the following functions can be used to find the coordinated universal time, assuming that the datetime module has already been imported?
datetime.utc()
datetime.datetime.utc()
datetime.utcnow()
datetime.datetime.utcnow()
Question 3: What will be the output of the following Python code?
import time time.time()
The number of hours passed since 1st January, 1970
The number of days passed since 1st January, 1970
The number of seconds passed since 1st January, 1970
The number of minutes passed since 1st January, 1970
Question 4: What will be the output of the following Python code, if the time module has already been imported?
def num(m): t1 = time.time() for i in range(0,m): print(i) t2 = time.time() print(str(t2-t1)) num(3)
0 1 2 The time taken for the execution of the code
2 The time taken for the execution of the code
0 1 2 UTC time
2 UTC time
Question 5: What will be the output of the following Python code?
import time time.asctime()
Current date only
UTC time
Current date and time
Current time only
Question 6: What will be the output of the following Python code?
import time t=(2010, 9, 20, 8, 15, 12, 6) time.asctime(t)
‘20 Sep 2010 8:15:12 Sun’
‘2010 20 Sept 08:15:12 Sun’
‘Sun Sept 20 8:15:12 2010’
Error
Question 7: What will be the output of the following Python code?
import time t=(2010, 9, 20, 8, 45, 12, 6, 0, 0) time.asctime(t)
‘Sep 20 2010 08:45:12 Sun’
‘Sun Sep 20 08:45:12 2010’
’20 Sep 08:45:12 Sun 2010’
‘2010 20 Sep 08:45:12 Sun’
Question 8: The sleep function (under the time module) is used to ___________
Pause the code for the specified number of seconds
Return the specified number of seconds, in terms of milliseconds
Stop the execution of the code
Return the output of the code had it been executed earlier by the specified number of seconds
Question 9: What will be the output of the following Python code?
import time for i in range(0,5): print(i) time.sleep(2)
After an interval of 2 seconds, the numbers 1, 2, 3, 4, 5 are printed all together
After an interval of 2 seconds, the numbers 0, 1, 2, 3, 4 are printed all together
Prints the numbers 1, 2, 3, 4, 5 at an interval of 2 seconds between each number
Prints the numbers 0, 1, 2, 3, 4 at an interval of 2 seconds between each number