
2.4 - The random Module

Quiz
•
Computers
•
11th Grade
•
Hard
Nicholas Oreskovich
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which Python module is used for generating random numbers as mentioned in the text?
sys
os
random
math
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What function from the random module is used to generate a random integer within a specified range?
random.random()
random.randint()
random.randrange()
random.uniform()
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the purpose of the third argument in the random.randrange() function?
It specifies the seed value.
It specifies the step value.
It specifies the upper bound.
It specifies the lower bound.
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
When using random.randrange(11, 30, 2) to generate random even numbers, why is the upper bound set to 30 instead of 31?
To ensure that 30 is included in the range.
To ensure that 31 is included in the range.
To generate only odd numbers.
To generate a random float number.
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the range of values that random.random() can generate?
Between 0 and 1 (excluding 1)
Between 1 and 10 (including 10)
Between 0 and 100 (excluding 100)
Between -1 and 1 (including 1)
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the purpose of the random.choice() function in Python?
To generate a random number within a specified range
To select a random element from a sequence
To shuffle the elements of a list randomly
To generate a random floating-point number
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How can you simulate a loaded die that is more likely to roll a 4 using Python's random module?
By creating a list with more occurrences of the number 4 and using random.choice()
By using the random.randint() function with biased arguments
By calling random.random() and mapping the result to the number 4
By using the random.shuffle() function on a list containing the number 4
Create a free account and access millions of resources
Similar Resources on Wayground
10 questions
Primary Storage

Quiz
•
4th Grade - University
12 questions
Python Unit 2 Quiz 2

Quiz
•
9th - 12th Grade
10 questions
Aplikasi Pengolah Presentasi menggunakan Canva

Quiz
•
11th Grade
12 questions
IT Fundamentals - 1.1 and 1.2

Quiz
•
9th Grade - University
8 questions
Python Quiz: Choosing Test Data - GCSE CS

Quiz
•
11th Grade
10 questions
Artificial Intelligence

Quiz
•
11th Grade
15 questions
Quantum Cryptography Quiz

Quiz
•
11th Grade
10 questions
Data vs Information

Quiz
•
10th - 11th Grade
Popular Resources on Wayground
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
9/11 Experience and Reflections

Interactive video
•
10th - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
9 questions
Tips & Tricks

Lesson
•
6th - 8th Grade
Discover more resources for Computers
20 questions
Digital Citizenship

Quiz
•
8th - 12th Grade
35 questions
Computer Baseline Examination 2025-26

Quiz
•
9th - 12th Grade
13 questions
Problem Solving Process

Quiz
•
9th - 12th Grade
10 questions
Understanding Algorithms with Pseudocode and Flowcharts

Interactive video
•
9th - 12th Grade
19 questions
AP CSP Unit 1 Review (code.org)

Quiz
•
10th - 12th Grade