What will be the output of the following Python expression?
print(round(4.576))
4.5
5
4
4.6
What will be the output of the following Python code?
import datetime d=datetime.date(2017,6,18) print(d)
Error
2017-06-18
18-06-2017
06-18-2017
What will be the output of the following Python code if the system date is 18th August, 2016?
import datetime d=datetime.date.today() print(d.month)
August
Aug
08
8
What will be the output of the following Python code if the system date is 18th June, 2017 (Sunday)?
import datetime
tday=datetime.date.today()
print(tday)
print(tday.weekday())
6
1
0
7
What will be the output of the following Python code if the system date is 21st June, 2017 (Wednesday)?
import datetime tday=datetime.date.today() print(tday.isoweekday())
Wed
Wednesday
2
3
Which of the following will throw an error if used after the following Python code?
bday=datetime.date(2017,9,18)
t_day=bday-tday
print(t_day.seconds)
print(t_day.months)
print(t_day.max)
print(t_day.resolution)
What will be the output of the following Python code if the system date is: 6/19/2017
tdelta=datetime.timedelta(days=10)
print(tday+tdelta)
2017-16-19
2017-06-9
2017-06-29
datetime.utc()
datetime.datetime.utc()
datetime.utcnow()
datetime.datetime.utcnow()
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
time.asctime()
Current date only
UTC time
Current date and time
Current time only
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’
t=(2010, 9, 20, 8, 45, 12, 6, 0, 0)
‘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’
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
import random
random.h
import.random
random.random
random.choice(2,3,4)
An integer other than 2, 3 and 4
Either 2, 3 or 4
3 only
random.choice([10.4, 56.99, 76])
Either 10.4, 56.99 or 76
Any number other than 10.4, 56.99 and 76
56.99 only
What will be the output of the following Python function (random module has already been imported)?
random.choice('sun')
sun
u
either s, u or n
error
What will be the output of the following Python function, assuming that the random module has already been imported?
random.uniform(3,4)
Either 3 or 4
Any integer other than 3 and 4
Any decimal value between 3 and 4
What will be the output of the following Python function if the random module has already been imported?
random.randint(3.5,7)
Any integer between 3.5 and 7, including 7
Any integer between 3.5 and 7, excluding 7
The integer closest to the mean of 3.5 and 7