CBSE Class 12 Computer Science
Question 25 of 44
Solved 2025 Sample Question Paper CBSE Class 12 Computer Science (083) — Question 4
Back to all questionsW#, W#s#
Minimum and maximum possible values of the variable b is 1, 6.
Reason — The code imports the random module and initializes a string variable a with the value "Wisdom". It then generates a random integer b between 1 and 6, inclusive. A for loop iterates over a range from 0 to b in steps of 2, which means it only considers even indices (0, 2, 4) of the string a. In each iteration, it prints the character at the current index i of the string a, followed by a '#' character, without moving to a new line.
For possible values of b:
For b = 1:
- Range:
range(0, 1, 2)→ Only includes 0 - Step 1:
i = 0→ Prints W# - Final Output:
W#
For b = 2:
- Range:
range(0, 2, 2)→ Only includes 0 - Step 1:
i = 0→ Prints W# - Final Output:
W#
For b = 3:
- Range:
range(0, 3, 2)→ Includes 0, 2 - Step 1:
i = 0→ Prints W# - Step 2:
i = 2→ Prints s# - Final Output:
W#s#
For b = 4:
- Range:
range(0, 4, 2)→ Includes 0, 2 - Step 1:
i = 0→ Prints W# - Step 2:
i = 2→ Prints s# - Final Output:
W#s#
For b = 5:
- Range:
range(0, 5, 2)→ Includes 0, 2, 4 - Step 1:
i = 0→ Prints W# - Step 2:
i = 2→ Prints s# - Step 3:
i = 4→ Prints o# - Final Output:
W#s#o#
For b = 6:
- Range:
range(0, 6, 2)→ Includes 0, 2, 4 - Step 1:
i = 0→ Prints W# - Step 2:
i = 2→ Prints s# - Step 3:
i = 4→ Prints o# - Final Output:
W#s#o#