CBSE Class 11 Computer Science Question 6 of 80

Conditional and Looping Constructs — Question 6

Back to all questions
6
Question

Question 6

Assertion (A): The range() method is used with both for and while loops.

Reasoning (R): By default, the values for start and step are 0 (zero) and 1 (one), respectively.

  1. Both A and R are true and R is the correct explanation of A.
  2. Both A and R are true but R is not the correct explanation of A.
  3. A is true but R is false.
  4. A is false but R is true.
Answer

A is false but R is true.

Explanation
The range() function is used with for loops to iterate over a sequence of numbers, not with while loops. By default, the values for start and step are 0 (zero) and 1 (one), respectively.