CBSE Class 11 Computer Science Question 30 of 40

Data Handling — Question 35

Back to all questions
35
Question

Question 22

Consider the code given below:

import random
r = random.randint(10, 100) - 10
print(r, end = ' ')
r = random.randint(10, 100) - 10
print(r, end = ' ')
r = random.randint(10, 100) - 10
print(r)

Which of the following are the possible outcomes of the above code? Also, what can be the maximum and minimum number generated by line 2?

(a) 12 45 22
(b) 100 80 84
(c) 101 12 43
(d) 100 12 10

Answer

The possible outcomes of the above code can be:

Option (a) — 12 45 22

Maximum number can be 90 and minimum number can be 0.


Source: This question is from Data Handling, Computer Science — Class 11, CBSE Board.

Key Concepts Covered

This question tests your understanding of the following concepts from the chapter Data Handling: Question, Consider, Code, Import, Random, Randint. These are fundamental topics in Computer Science that students are expected to master as part of the CBSE Class 11 curriculum.

A thorough understanding of these concepts will help you answer similar questions confidently in your CBSE examinations. These topics are frequently tested in both objective and subjective sections of Computer Science papers. We recommend revising the relevant section of your textbook alongside practising these solved examples to build a strong foundation.

How to Approach This Question

Read the question carefully and identify what is being asked. Break down complex questions into smaller parts. Use the terminology and concepts discussed in this chapter. Structure your answer logically — begin with a definition or key statement, then provide supporting details. Review your answer to ensure it addresses all parts of the question completely.

Key Points to Remember

  • Write programs with proper indentation and comments.
  • Trace through your code with sample inputs to verify correctness.
  • Explain the logic behind each step of your solution.
  • Familiarise yourself with common library functions and methods.

Practice more questions from Data Handling — Computer Science, Class 11 CBSE