# Which of the following will throw an error if used after the following Python code tday=datetime.date.today() bday=datetime.date(2017,9,18) t_day=bday-tday

1.  print(t_day.seconds)

2.  print(t_day.months)

3.  print(t_day.max)

4.  print(t_day.resolution)

4
Correct Answer :

print(t_day.months)

Explanation :
No Explanation available for this question

# What will be the output of the following Python code if the system date is: 6/19/2017 tday=datetime.date.today() tdelta=datetime.timedelta(days=10) print(tday+tdelta)

1.  2017-16-19

2.  2017-06-9

3.  2017-06-29

4.  Error

4
Correct Answer :

2017-06-29

Explanation :
No Explanation available for this question

# 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)

1.  True

2.  False

2
Correct Answer :

False

Explanation :
No Explanation available for this question

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

1.  datetime.utc()

2.  datetime.datetime.utc()

3.  datetime.utcnow()

4.  datetime.datetime.utcnow()

4
Correct Answer :

datetime.datetime.utcnow()

Explanation :
No Explanation available for this question

# What will be the output of the following Python code import time time.time()

1.  The number of hours passed since 1st January, 1970

2.  The number of days passed since 1st January, 1970

3.  The number of seconds passed since 1st January, 1970

4.  The number of minutes passed since 1st January, 1970

4
Correct Answer :

The number of seconds passed since 1st January, 1970

Explanation :
No Explanation available for this question

# 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)

1.  123The time taken for the execution of the code

2.  3The time taken for the execution of the code

3.  123UTC time

4.  3UTC time

4
Correct Answer :

1
2
3
The time taken for the execution of the code

Explanation :
No Explanation available for this question

# What will be the output of the following Python code import time time.asctime()

1.  Current date only

2.  UTC time

3.  Current date and time

4.  Current time only

4
Correct Answer :

Current date and time

Explanation :
No Explanation available for this question

# What will be the output of the following Python code import time t=(2010, 9, 20, 8, 15, 12, 6) time.asctime(t)

1.  ‘20 Sep 2010 8:15:12 Sun’

2.  ‘2010 20 Sept 08:15:12 Sun’

3.  ‘Sun Sept 20 8:15:12 2010’

4.  Error

4
Correct Answer :

Error

Explanation :
No Explanation available for this question

# 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)

1.  ‘Sep 20 2010 08:45:12 Sun’

2.  ‘Sun Sep 20 08:45:12 2010’

3.  ’20 Sep 08:45:12 Sun 2010’

4.  ‘2010 20 Sep 08:45:12 Sun’

4
Correct Answer :

‘Sun Sep 20 08:45:12 2010’

Explanation :
No Explanation available for this question

# The sleep function (under the time module) is used to ___________

1.  Pause the code for the specified number of seconds

2.  Return the specified number of seconds, in terms of milliseconds

3.  Stop the execution of the code

4.  Return the output of the code had it been executed earlier by the specified number of seconds

4
Correct Answer :

Pause the code for the specified number of seconds

Explanation :
No Explanation available for this question

## Interview Questions

 MongoDB Java Script Node JS PHP JQuery Python