0% found this document useful (0 votes)
6 views2 pages

Python MCQs Using Random Module

The document contains multiple-choice questions (MCQs) related to the Python random module. Each question presents a code snippet that utilizes the random module to select and print elements from a tuple, with options provided for the expected output. The questions test the understanding of random number generation and indexing in Python.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

Python MCQs Using Random Module

The document contains multiple-choice questions (MCQs) related to the Python random module. Each question presents a code snippet that utilizes the random module to select and print elements from a tuple, with options provided for the expected output. The questions test the understanding of random number generation and indexing in Python.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Board Exam Style MCQs – Python (random

module)
1.
import random
days = ("Mon", "Tue", "Wed", "Thu", "Fri")
x = [Link](1, 2)
y = [Link](2, 4)
for i in range(x, y):
print(days[i], end="*")

a. Tue*Wed*Thu*
b. Tue*Wed*
c. Wed*Thu*Fri*
d. Mon*Tue*Wed*

2.
import random
nums = (10, 20, 30, 40)
a = [Link](0, 1)
b = [Link](2, 3)
for i in range(a, b + 1):
print(nums[i], end="-")

a. 10-20-30-
b. 20-30-40-
c. 10-20-30-40-
d. 30-40-

3.
import random
fruits = ("Apple", "Banana", "Cherry", "Mango")
x = [Link](0, 2)
y = [Link](1, 3)
for i in range(x, y):
print(fruits[i], end="@")

a. Apple@Banana@
b. Banana@Cherry@
c. Cherry@Mango@
d. Apple@Banana@Cherry@

4.
import random
letters = ("A", "B", "C", "D", "E")
p = [Link](1, 3)
q = [Link](3, 4)
for i in range(p, q):
print(letters[i], end="$")

a. B$C$
b. C$D$
c. D$E$
d. B$C$D$
5.
import random
animals = ("Cat", "Dog", "Cow", "Lion")
m = [Link](0, 1)
n = [Link](1, 2)
for i in range(m, n + 1):
print(animals[i], end="#")

a. Cat#Dog#
b. Dog#Cow#
c. Cat#Dog#Cow#
d. Cow#Lion#

You might also like