Python Modules MCQs with Answers Set 02

Practice Python Modules MCQs with Answers Set 02 provided below. The MCQ Questions for [current-page:node:field_class] Modules [current-page:node:field_subject] with answers and follow the latest [current-page:node:field_board]/ NCERT and KVS patterns. Refer to more Chapter-wise MCQs for [current-page:node:field_board] [current-page:node:field_class] [current-page:node:field_subject] and also download more latest study material for all subjects

MCQ for [current-page:node:field_class] [current-page:node:field_subject] Modules

[current-page:node:field_class] [current-page:node:field_subject] students should review the 50 questions and answers to strengthen understanding of core concepts in Modules

Modules MCQ Questions [current-page:node:field_class] [current-page:node:field_subject] with Answers

Question. What is the result of math.trunc(3.1)?
(a) 3.0
(b) 3
(c) 0.1
(d) 1
Answer: b
Explanation: The integral part of the floating point number is returned.

Question. What is the output of print(math.trunc(‘3.1’))?
(a) 3
(b) 3.0
(c) error
(d) none of the mentioned
Answer: c
Explanation: TypeError, a string does not have __trunc__ method.

Question. Which of the following is the same as math.exp(p)?
(a) \( e ** p \)
(b) \( math.e ** p \)
(c) \( p ** e \)
(d) \( p ** math.e \)
Answer: b
Explanation: math.e is the constant defined in the math module.

Question. What is returned by math.expm1(p)?
(a) \( (math.e ** p) – 1 \)
(b) \( math.e ** (p – 1) \)
(c) error
(d) none of the mentioned
Answer: a
Explanation: One is subtracted from the result of math.exp(p) and returned.

Question. What is the default base used when math.log(x) is found?
(a) e
(b) 10
(c) 2
(d) none of the mentioned
Answer: a
Explanation: The natural log of x is returned by default.

Question. Which of the following aren’t defined in the math module?
(a) log2()
(b) log10()
(c) logx()
(d) none of the mentioned
Answer: c
Explanation: log2() and log10() are defined in the math module.

Question. What is returned by int(math.pow(3, 2))?
(a) 6
(b) 9
(c) error, third argument required
(d) error, too many arguments
Answer: b
Explanation: math.pow(a, b) returns \( a ** b \).

Question. What is output of print(math.pow(3, 2))?
(a) 9
(b) 9.0
(c) None
(d) None of the mentioned
Answer: b
Explanation: math.pow() returns a floating point number.

Question. What is the value of x if x = math.sqrt(4)?
(a) 2
(b) 2.0
(c) (2, -2)
(d) (2.0, -2.0)
Answer: b
Explanation: The function returns one floating point number.

Question. What does math.sqrt(X, Y) do?
(a) calculate the Xth root of Y
(b) calculate the Yth root of X
(c) error
(d) return a tuple with the square root of X and Y
Answer: c
Explanation: The function takes only one argument.

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: a
Explanation: The command import random is used to import the random module, which enables us to use the functions which are present in the random library.

Question. The output of the following Python code is either 1 or 2.
import random
random.randint(1,2)

(a) True
(b) False
Answer: a
Explanation: The function random.randint(a,b) helps us to generate an integer between ‘a’ and ‘b’, including ‘a’ and ‘b’. In this case, since there are no integers between 1 and 2, the output will necessarily be either 1 or 2’.

Question. What will be the output of the following Python code?
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: c
Explanation: The code shown above displays the incorrect syntax of the function random.choice(). This functions takes its numeric parameter in the form of a list. Hence the correct syntax world be: random.choice([2,3,4]).

Question. What will be the output of the following Python code?
import random
random.choice([10.4, 56.99, 76])

(a) Error
(b) Either 10.4, 56.99 or 76
(c) Any number other than 10.4, 56.99 and 76
(d) 56.99 only
Answer: b
Explanation: The function random.choice(a,b,c,d) returns a random number which is selected from a, b, c and d. The output can be either a, b, c or d. Hence the output of the snippet of code shown above can be either 10.4, 56.99 or 76.

Question. What will be the output of the following Python function (random module has already been imported)?
random.choice('sun')

(a) sun
(b) u
(c) either s, u or n
(d) error
Answer: c
Explanation: The above function works with alphabets just as it does with numbers. The output of this expression will be either s, u or n.

Question. What will be the output of the following Python function, assuming that the random module has already been imported?
random.uniform(3,4)

(a) Error
(b) Either 3 or 4
(c) Any integer other than 3 and 4
(d) Any decimal value between 3 and 4
Answer: d
Explanation: This question depicts the basic difference between the functions random.randint(a, b) and random.uniform(a, b). While random.randint(a,b) generates an integer between ‘a’ and ‘b’, including ‘a’ and ‘b’, the function random.uniform(a,b) generates a decimal value between ‘a’ and ‘b’.

Question. What will be the output of the following Python function if the random module has already been imported?
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: a
Explanation: The function random.randint() does not accept a decimal value as a parameter. Hence the function shown above will throw an error.

Question. Which of the following functions helps us to randomize the items of a list?
(a) seed
(b) randomise
(c) shuffle
(d) uniform
Answer: c
Explanation: The function shuffle, which is included in the random module, helps us to randomize the items of a list. This function takes the list as a parameter.

Question. 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)

(a) 3
(b) 2
(c) Any integer between 1 and 5, including 1 and 5
(d) Any integer between 1 and 5, excluding 1 and 5
Answer: b
Explanation: We use the seed function when we want to use the same random number once again in our program. Hence the output of the code shown above will be 2, since 2 was generated previously following which we used the seed function.

Question. What is the interval of the value generated by the function random.random(), assuming that the random module has already been imported?
(a) (0,1)
(b) (0,1]
(c) [0,1]
(d) [0,1)
Answer: d
Explanation: The function random.random() generates a random value in the interval [0,1), that is, including zero but excluding one.

Question. What will be the output of the following Python code?
random.randrange(0,91,5)

(a) 10
(b) 18
(c) 79
(d) 95
Answer: a
Explanation: The function shown above will generate an output which is a multiple of 5 and is between 0 and 91. The only option which satisfies these criteria is 10. Hence the only possible output of this function is 10.

Question. Both the functions randint and uniform accept ____________ parameters.
(a) 0
(b) 1
(c) 3
(d) 2
Answer: d
Explanation: Both of these functions, that is, randint and uniform are included in the random module and both of these functions accept 2 parameters. For example: random.uniform(a,b) where ‘a’ and ‘b’ specify the range.

Question. The randrange function returns only an integer value.
(a) True
(b) False
Answer: a
Explanation: The function randrange returns only an integer value. Hence this statement is true.

Question. What will be the output of the following Python code?
random.randrange(1,100,10)

(a) 32
(b) 67
(c) 91
(d) 80
Answer: c
Explanation: The output of this function can be any value which is a multiple of 10, plus 1. Hence a value like 11, 21, 31, 41…91 can be the output. Also, the value should necessarily be between 1 and 100. The only option which satisfies this criteria is 91.

Question. What will be the output of the following Python function, assuming that the random library has already been included?
random.shuffle[1,2,24]

(a) Randomized list containing the same numbers in any order
(b) The same list, that is [1,2,24]
(c) A list containing any random numbers between 1 and 24
(d) Error
Answer: d
Explanation: The function shown above will result in an error because this is the incorrect syntax for the usage of the function shuffle(). The list should be previously declared and then passed to this function to get an output. An example of the correct syntax:
>>> l=['a','b','c','d']
>>> random.shuffle(l)
>>> print(l)

Question. What the does random.seed(3) return?
(a) True
(b) None
(c) 3
(d) 1
Answer: b
Explanation: The function random.seed() always returns a None.

Question. Which of the following cannot be returned by random.randrange(4)?
(a) 0
(b) 3
(c) 2.3
(d) none of the mentioned
Answer: c
Explanation: Only integers can be returned.

Question. Which of the following is equivalent to random.randrange(3)?
(a) range(3)
(b) random.choice(range(0, 3))
(c) random.shuffle(range(3))
(d) random.select(range(3))
Answer: b
Explanation: It returns one number from the given range.

Question. The function random.randint(4) can return only one of the following values. Which?
(a) 4
(b) 3.4
(c) error
(d) 5
Answer: c
Explanation: Error, the function takes two arguments.

Question. Which of the following is equivalent to random.randint(3, 6)?
(a) random.choice([3, 6])
(b) random.randrange(3, 6)
(c) 3 + random.randrange(3)
(d) 3 + random.randrange(4)
Answer: d
Explanation: random.randint(3, 6) can return any one of 3, 4, 5 and 6.

Question. Which of the following will not be returned by random.choice(“1 ,”)?
(a) 1
(b) (space)
(c) ,
(d) none of the mentioned
Answer: d
Explanation: Any of the characters present in the string may be returned.

Question. Which of the following will never be displayed on executing print(random.choice({0: 1, 2: 3}))?
(a) 0
(b) 1
(c) KeyError: 1
(d) none of the mentioned
Answer: a
Explanation: It will not print 0 but dict[0] i.e. 1 may be printed.

Question. What does random.shuffle(x) do when x = [1, 2, 3]?
(a) error
(b) do nothing, it is a placeholder for a function that is yet to be implemented
(c) shuffle the elements of the list in-place
(d) none of the mentioned
Answer: c
Explanation: The elements of the list passed to it are shuffled in-place.

Question. Which type of elements are accepted by random.shuffle()?
(a) strings
(b) lists
(c) tuples
(d) integers
Answer: b
Explanation: Strings and tuples are immutable and an integer has no len().

Question. What is the range of values that random.random() can return?
(a) [0.0, 1.0]
(b) (0.0, 1.0]
(c) (0.0, 1.0)
(d) [0.0, 1.0)
Answer: d
Explanation: Any number that is greater than or equal to 0.0 and lesser than 1.0 can be returned.

MCQs for Modules [current-page:node:field_subject] [current-page:node:field_class]

Students can use these MCQs for Modules to quickly test their knowledge of the chapter. These multiple-choice questions have been designed as per the latest syllabus for [current-page:node:field_class] [current-page:node:field_subject] released by [current-page:node:field_board]. Our expert teachers suggest that you should practice daily and solving these objective questions of Modules to understand the important concepts and better marks in your school tests.

Modules NCERT Based Objective Questions

Our expert teachers have designed these [current-page:node:field_subject] MCQs based on the official NCERT book for [current-page:node:field_class]. We have identified all questions from the most important topics that are always asked in exams. After solving these, please compare your choices with our provided answers. For better understanding of Modules, you should also refer to our NCERT solutions for [current-page:node:field_class] [current-page:node:field_subject] created by our team.

Online Practice and Revision for Modules [current-page:node:field_subject]

To prepare for your exams you should also take the [current-page:node:field_class] [current-page:node:field_subject] MCQ Test for this chapter on our website. This will help you improve your speed and accuracy and its also free for you. Regular revision of these [current-page:node:field_subject] topics will make you an expert in all important chapters of your course.

FAQs

Where can I access latest Python Modules MCQs with Answers Set 02?

You can get most exhaustive Python Modules MCQs with Answers Set 02 for free on StudiesToday.com. These MCQs for are updated for the 2026-27 academic session as per examination standards.

Are Assertion-Reasoning and Case-Study MCQs included in the [current-page:node:field_subject] [current-page:node:field_class] material?

Yes, our Python Modules MCQs with Answers Set 02 include the latest type of questions, such as Assertion-Reasoning and Case-based MCQs. 50% of the paper is now competency-based.

How do practicing [current-page:node:field_subject] MCQs help in scoring full marks in [current-page:node:field_class] exams?

By solving our Python Modules MCQs with Answers Set 02, students can improve their accuracy and speed which is important as objective questions provide a chance to secure 100% marks in the .

Do you provide answers and explanations for Python Modules MCQs with Answers Set 02?

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

Can I practice these [current-page:node:field_subject] [current-page:node:field_class] MCQs online?

Yes, you can also access online interactive tests for Python Modules MCQs with Answers Set 02 on StudiesToday.com as they provide instant answers and score to help you track your progress in .