Python Practice Test MCQ Certified Go from 0 to Expert hero Set 33

What will be the output of the following Python code if the system date is 21st June, 2017 (Wednesday)?


Options are :

  • Wed
  • Wednesday
  • 2
  • 3

Answer :3

Python Practice Test MCQ Certified Go from 0 to Expert hero Set 34

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


Options are :

  • 3 months, 0:00:00
  • 90 days, 0:00:00
  • 3 months 2 days, 0:00:00
  • 92 days, 0:00:00

Answer :92 days, 0:00:00

The value returned when we use the function isoweekday() is ______ and that for the function weekday() is ________ if the system date is 19th June, 2017 (Monday).


Options are :

  • 0,0
  • 0,1
  • 1,0
  • 1,1

Answer :1,0

Which of the following will throw an error if used after the following Python code?


Options are :

  • print(t_day.seconds)
  • print(t_day.months)
  • print(t_day.max)
  • print(t_day.resolution)

Answer :print(t_day.months)

Python Practice Test MCQ Certified Go from 0 to Expert hero Set 23

What will be the output of the following Python code if the system date is: 6/19/2017


Options are :

  • 2017-16-19
  • 2017-06-9
  • 2017-06-29
  • Error

Answer :2017-06-29

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


Options are :

  • True
  • False

Answer :False

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


Options are :

  • datetime.utc()
  • datetime.datetime.utc()
  • datetime.utcnow()
  • datetime.datetime.utcnow()

Answer :datetime.datetime.utcnow()

Python Certification Exam Preparation Set 8

What will be the output of the following Python code?


Options are :

  • 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

Answer :The number of seconds passed since 1st January, 1970

What will be the output of the following Python code, if the time module has already been imported?


Options are :

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

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

What will be the output of the following Python code?


Options are :

  • Current date only
  • UTC time
  • Current date and time
  • Current time only

Answer :Current date and time

Python Practice Test MCQ Certified Go from 0 to Expert hero Set 29

What will be the output of the following Python code?


Options are :

  • '20 Sep 2010 8:15:12 Sun'
  • '2010 20 Sept 08:15:12 Sun'
  • 'Sun Sept 20 8:15:12 2010'
  • Error

Answer :Error

What will be the output of the following Python code?


Options are :

  • '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'

Answer :'Sun Sep 20 08:45:12 2010'

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


Options are :

  • 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

Answer :Pause the code for the specified number of seconds

Python Certification Exam Preparation Set 16

What will be the output of the following Python code?


Options are :

  • 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

Answer :Prints the numbers 0, 1, 2, 3, 4 at an interval of 2 seconds between each number

What will be the output if we try to extract only the year from the following Python code? (time.struct_time(tm_year=2017, tm_mon=6, tm_mday=25, tm_hour=18, tm_min=26, tm_sec=6, tm_wday=6, tm_yday=176, tm_isdst=0))


Options are :

  • t[1]
  • tm_year
  • t[0]
  • t_year

Answer :t[0]

State whether true or false.


Options are :

  • True
  • False

Answer :False

Python Certification Exam Preparation Set 14

To include the use of functions which are present in the random library, we must use the option:


Options are :

  • import random
  • random.h
  • import.random
  • random.random

Answer :import random

The output of the following Python code is either 1 or 2.


Options are :

  • True
  • False

Answer :True

What will be the output of the following Python code?


Options are :

  • An integer other than 2, 3 and 4
  • Either 2, 3 or 4
  • Error
  • 3 only

Answer :Error

Python Certification Exam Preparation Set 1

What will be the output of the following Python code?


Options are :

  • Error
  • Either 10.4, 56.99 or 76
  • Any number other than 10.4, 56.99 and 76
  • 56.99 only

Answer :Either 10.4, 56.99 or 76

What will be the output of the following Python function (random module has already been imported)?


Options are :

  • sun
  • u
  • either s, u or n
  • error

Answer :either s, u or n

What will be the output of the following Python function, assuming that the random module has already been imported?


Options are :

  • Error
  • Either 3 or 4
  • Any integer other than 3 and 4
  • Any decimal value between 3 and 4

Answer :Any decimal value between 3 and 4

Python Certification Exam Preparation Set 12

What will be the output of the following Python function if the random module has already been imported?


Options are :

  • Error
  • 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

Answer :Error

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


Options are :

  • seed
  • randomise
  • shuffle
  • uniform

Answer :shuffle

What will be the output of the following Python code?


Options are :

  • 3
  • 2
  • Any integer between 1 and 5, including 1 and 5
  • Any integer between 1 and 5, excluding 1 and 5

Answer :2

Python Practice Test MCQ Certified Go from 0 to Expert hero Set 29

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


Options are :

  • (0,1)
  • (0,1]
  • [0,1]
  • [0,1)

Answer :[0,1)

What will be the output of the following Python code?


Options are :

  • 10
  • 18
  • 79
  • 95

Answer :10

Both the functions randint and uniform accept ____________ parameters.


Options are :

  • 0
  • 1
  • 3
  • 2

Answer :3

Python Certification Exam Preparation Set 7

The randrange function returns only an integer value.


Options are :

  • True
  • False

Answer :True

What will be the output of the following Python code?


Options are :

  • 32
  • 67
  • 91
  • 80

Answer :91

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions