Page 284 - Computer Science V2.0 Class 11
P. 284
2. What will be the output produced on execution of the following code snippet?
num1, num2, num3 = 1, 3, 5
if num1 + num2 + num3:
print("if condition holds True")
else:
print("In else clause")
a. if condition holds True
b. In else clause
c. Syntax Error
d. No output
3. Which of the following characters marks the end of the header of a compound statement?
a. : b. # c. * d. ;
4. Which of the following is not a control statement?
a. if statement
b. if-else statement
c. assignment
d. if-elif-else statement
5. Which of the following is a valid keyword?
a. IF b. if c. Elif d. ELSE
6. What will be the output produced on the execution of the following code?
height = 190
if height >= 180:
print("You cross the bar")
print("Good")
print("Sorry")
a. You cross the bar
b. Sorry
c. You cross the bar
Good
d. You cross the bar
Good
Sorry
7. Which of the following statements is not true?
a. An if statement must have an else clause
b. An if statement within an else block forms a nested if statement
c. An if statement can have any number of elif clauses
d. An if statement may not have an else clause.
8.
if num < 0:
print(num, " is a negative number")
if num > 0:
print(num, " is a positive number")
else:
print(num, " is zero")
Assuming the value of the variable num to be 10 in the code above as well as in each of the following code snippets I, II,
and III, determine which of the code snippets will produce the same output on execution as the above code will produce
on its execution?
270 Touchpad Computer Science (Ver. 2.0)-XI

