gs gs109 Python Modules - Python Random Module - Quiz No.1
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 1: To include the use of functions which are present in the random library, we must use the option:
import random
random.h
import.random
random.random
Question 3: What will be the output of the following Python code?
import random random.choice(2,3,4)
An integer other than 2, 3 and 4
Either 2, 3 or 4
Error
3 only
Question 4: What will be the output of the following Python code?
import random random.choice([10.4, 56.99, 76])
Error
Either 10.4, 56.99 or 76
Any number other than 10.4, 56.99 and 76
56.99 only
Question 6: What will be the output of the following Python function, assuming that the random module has already been imported?
random.uniform(3,4)
Error
Either 3 or 4
Any integer other than 3 and 4
Any decimal value between 3 and 4
Question 7: What will be the output of the following Python function if the random module has already been imported?
random.randint(3.5,7)
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
Question 8: Which of the following functions helps us to randomize the items of a list?
seed
randomise
shuffle
uniform
Question 9: What will be the output of the following Python code?
random.seed(3) random.randint(1,5) 2 random.seed(3) random.randint(1,5)
3
2
Any integer between 1 and 5, including 1 and 5
Any integer between 1 and 5, excluding 1 and 5