CBSE Class 11 Computer Science Random Function MCQs

Practice MCQs for Class 11 Computer Science Random Function

Access targeted multiple-choice questions for Random Function designed to align with the latest CBSE academic syllabus for Class 11 Computer Science. These objective practice sets help students evaluate their conceptual understanding and improve exam readiness.

Access Random Function Questions and Solutions

View or download the dedicated Random Function MCQ resource below. Practicing these 50 objective questions regularly builds familiarity with standard exam patterns and helps secure higher marks in final Computer Science evaluations.

Question. What does the following statement do?
import random
a) Imports the random module
b) Imports a random module from a list of modules
c) Imports the random function
d) imports the directory named random

Answer : A

Question. What will be the output after the following statements?
from random import
x = [0, 2, 4, 6, 8, 10]
print(sample(x, 3))
a) A dictionary containing 3 random keys from list x
b) Three random integer values between 0 and 10
c) A list containing 3 random elements from list x
d) A tuple containing 2 random elements from list x

Answer : C

Question. What will be the output after the following statements?
import random
x = [3, 8, 6, 5, 0]
y = random.shuffle(x)
print(y)
a) A random element from the list x
b) The shuffled list x with the elements mixed up
c) None
d) A random element from the list x, excluding 3 and 0

Answer : C

Question. What will be the output after the following statements?
import random
print(random.sample(range(5, 20), 4))
a) A list of 5 unique numbers within the range of 4 to 19
b) A list of 5 unique numbers within the range of 5 to 20
c) A list of 4 unique numbers within the range of 5 to 19
d) A tuple of 4 unique numbers within the range of 5 to 19

Answer : C

Question. What is the output of the code shown below?
import random
random.choice(2,3,4)
a) An integer other than 2, 3 and 4
b) Either 2, 3 or 4
c) Error
d) 3 only

Answer : B

Question. The output of the following Python code is either 1 or 2.
import random
random.randint(1,2)
a) True
b) False
c) none
d) Error

Answer : A

Question. What will be the output after the following statements?
import random as rd
print(rd.randint(4,7))
a) A random float value between 4 and 7, including 4 and 7
b) A random float value between 4 and 7, excluding 4 and 7
c) A random integer value between 4 and 7, excluding 4 and 7
d) A random integer value between 4 and 7, including 4 and 7

Answer : D

Question. What will be the output after the following statements?
import random
x = [3, 8, 6, 5, 0]
random.shuffle(x)
print(x)
a) A random element from the list x
b) The shuffled list x with the elements mixed up
c) A random element from the list x, excluding 3 and 0
d) A random element from the list elements 3 and 0

Answer : B

Question. What will be the output after the following statements?
import random
print(random.sample(range(20), 5))
a) A list of 5 unique numbers within the range of 0 to 19
b) A list of 5 unique numbers within the range of 0 to 20
c) A list of 4 unique numbers within the range of 0 to 19
d) A tuple of 5 unique numbers within the range of 0 to 19

Answer : A

Question. To include the use of functions which are present in the random library, we must use the option:
a) import random
b) random.h
c) import.random
d) random.random

Answer : B

Question. What is the output of the function shown below if the random module has already been imported?
>>>import random
>>>random.randint(3.5,7)
a) Error
b) Any integer between 3.5 and 7, including 7
c) Any integer between 3.5 and 7, excluding 7
d) The integer closest to the mean of 3.5 and 7

Answer : B

Question. What will be the output after the following statements?
import random as rd
print(rd.random())
a) A random float value between 0 and 1
b) A random integer value between 0 and 1
c) A random float value between 0 and 10
d) A random integer value between 0 and 10

Answer : A

Question. What will be the output after the following statements?
import random
print(int(random.random()*10))
a) 10
b) A random integer number within the range of 0 to 9
c) None
d) A random floating point number within the range of 0 to 9

Answer : B

Question. What is the output of the program given below:
import random
x = random.random()
y= random.randint(0,4)
print(int(x),”:”, y+int(x))
a) 0: 0
b) 2 : 4
c) 1: 6
d) 0 : 5

Answer : A

Question. Which type of elements are accepted by random.shuffle()?
a) strings
b) Lists
c) tuples
d) integers

Answer : B

Question. Which of the following can be a possible output after the following statements?
from random import
print(sample(range(0,10), 3))
a) [4, 11, 30]
b) [3, 15, 10]
c) [1, 5, 7, 4]
d) [1, 5, 0]

Answer : D

Question. What will be the output after the following statements?
import random
print(int(random.random()*10) + 1)
a) 11
b) A random integer number within the range of 0 to 11
c) None
d) A random whole number within the range of 1 to 10

Answer : D

Question. What is the output of the function shown below (random module has already been imported)?
>>>random.choice(‘sun’)
a) sun
b) u
c) either s, u or n
d) Error

Answer : C

Question. What will be the output after the following statements?
import random
x = [3, 8, 6, 5, 0]
print(random.choice(x))
a) A random element from the list x
b) The list x
c) A random element from the list x, excluding 3 and 0
d) A random element from the list elements 3 and 0

Answer : A

Question. What will be the output after the following statements?
import random
x = [‘Monday’, ‘Tuesday’, ‘Wednesday’, ‘Thursday’, ‘Friday’,
‘Saturday’, ‘Sunday’]
print(x[random.randint(0, len(x) – 1)])
a) IndexError
b) A random day from all the seven days
c) A random day from all the days except Sunday
d) A random day from all the days except Monday

Answer : D

Multiple Choice Questions (MCQs) for Class 11 Computer Science Random Function

Chapter MCQs with Answers for Class 11 Computer Science

Explore reliable practice questions for Random Function tailored for Class 11 Computer Science learners. Use these multiple-choice formats to evaluate preparedness and strengthen problem-solving skills.

Expert Practice Material for Class 11 Computer Science

Built using the official NCERT book for Class 11, these Computer Science objective sets provide reliable academic guidance. Pair your practice with our recommended NCERT solutions to master optimal problem-solving approaches.

Complete Your Chapter Revision

Wrap up your chapter revision by testing your knowledge against standard question formats. Everything on our platform is provided free of charge.

FAQs

Where can I access latest CBSE Class 11 Computer Science Random Function MCQs?

You can get most exhaustive CBSE Class 11 Computer Science Random Function MCQs for free on StudiesToday.com. These MCQs for Class 11 Computer Science are updated for the 2026-27 academic session as per CBSE examination standards.

Are Assertion-Reasoning and Case-Study MCQs included in the Computer Science Class 11 material?

Yes, our CBSE Class 11 Computer Science Random Function MCQs include the latest type of questions, such as Assertion-Reasoning and Case-based MCQs. 50% of the CBSE paper is now competency-based.

How do practicing Computer Science MCQs help in scoring full marks in Class 11 exams?

By solving our CBSE Class 11 Computer Science Random Function MCQs, Class 11 students can improve their accuracy and speed which is important as objective questions provide a chance to secure 100% marks in the Computer Science.

Do you provide answers and explanations for CBSE Class 11 Computer Science Random Function MCQs?

Yes, Computer Science MCQs for Class 11 have answer key and brief explanations to help students understand logic behind the correct option as its important for 2026 competency-focused CBSE exams.

Can I practice these Computer Science Class 11 MCQs online?

Yes, you can also access online interactive tests for CBSE Class 11 Computer Science Random Function MCQs on StudiesToday.com as they provide instant answers and score to help you track your progress in Computer Science.