This section contains carefully selected MCQs and Previous Year Questions with explanations to help students understand concepts and prepare effectively for examinations, interviews, and competitive tests.
Q: 1What will be the output of the following Python code?
a = True
b = False
c = False
if not a or b:
print(1)
elif not a or not b and c:
print(2)
elif not a or b or not b and a:
print(3)
else:
print(4)
Option C
The precedence of logical operator in Python is:
Q: 2What is the output of the code in Python language:
for num in range (3):
if num > 0:
print (num*100, end=" ")
Option B
In Python, the range(3) function generates numbers starting from 0 up to 2. So the loop runs for 0,1, and 2.
| num Value | Condition num > 0 | Output |
|---|---|---|
| 0 | False | Nothing Printed |
| 1 | True | 1*100 = 100 |
| 2 | True | 2*100 = 200 |
Therefore, the printed output is 100 200
You have reached the end of this topic. Continue learning with the next topic below.
Thank you so much for taking the time to read my Computer Science MCQs section carefully. Your support and interest mean a lot, and I truly appreciate you being part of this journey. Stay connected for more insights and updates! If you'd like to explore more tutorials and insights, check out my YouTube channel.
Don’t forget to subscribe and stay connected for future updates.