Class 8 Computer Science
Class 8 Computer Science
Time: 1 Hour
Max Marks: 20
a=5
b=3
print(a * b + b)
o a) 20
o b) 18
o c) 16
o d) 21
o a) my_variable
o b) 5data
o c) data_5
o d) data5
o c) Both a and b
o a) Python is case-sensitive
o a) 19
o b) 17
o c) 23
o d) 25
a=98
b=75
a=a%b
print a+b
a)23
b)27
c)29
d)98
6. Define a conditional statement in Python and write a small code snippet using the if-else
structure.
7. Convert the decimal number 45 to binary. Show the steps involved in the conversion.
9. What does the range() function do in a Python for loop? Write an example that prints numbers
from 1 to 5.
11. Explain the working of the while loop in Python. Write a program using a while loop to print the
first 5 even numbers.