Computer Science - Class 12
Solutions to CBSE Sample Paper - Computer Science Class 12

Assertion(A): Python standard library consists of number of modules.

Reasoning(R): A function in a module is used to simplify the code and avoids repetition.

Answer

Answer by student

(b) Both A and R are true and R is not the correct explanation for A

Detailed answer by teachoo

  • The assertion (A) is true because Python standard library consists of a number of modules that provide built-in functionality for various tasks and purposes. For example, the math module provides mathematical functions, the random module provides random number generation, the os module provides operating system interfaces, and so on. A module is a file that contains Python code, such as definitions of functions, classes, and variables. To use a module in a Python program, we can import it using the import statement.
  • The reasoning (R) is also true because a function in a module is used to simplify the code and avoid repetition . A function is a block of code that performs a specific task and can be reused multiple times in a program. A function can take some parameters as input and return some value as output. A function can also be defined in a module and imported in another program.
  • However, the assertion and the reasoning are not related to each other. The assertion is about the Python standard library, which is a collection of modules that provide built-in functionality. The reasoning is about functions, which are blocks of code that perform specific tasks and can be defined in any module. The reasoning does not explain why the Python standard library consists of a number of modules.

Therefore, the correct choice is (b) Both A and R are true and R is not the correct explanation for A.

Go Ad-free
Davneet Singh's photo - Co-founder, Teachoo

Made by

Davneet Singh

Davneet Singh has done his B.Tech from Indian Institute of Technology, Kanpur. He has been teaching from the past 14 years. He provides courses for Maths, Science and Computer Science at Teachoo