18 questions · untimed

Python first steps: Values, operators and variables

Pick an option and check it. The explanation shows after each answer. Take as long as you like; nothing is timed and nothing is sent.

18 questions

Question 1 · easy

Ravi and four friends share an auto fare of ₹45 equally. What does this program print?

print(45 / 5)

Question 2 · easy

Nisha writes the value "7.5" (with the quotes) in her program. What kind of value is it?

Question 3 · easy

Arjun hits three sixes in an over. What does this program print?

print("6" * 3)

Question 4 · easy

Which of these is a Boolean value, the kind type() names bool?

Question 5 · easy

Priya is choosing a name for the box that holds an auto fare. Which name does Python accept?

Question 6 · easy

What does this program print?

print(5 ** 2)

Question 7 · medium

Nisha packs 50 eggs into trays that hold 12 eggs each. What does this program print?

eggs = 50
print(eggs // 12, eggs % 12)

Question 8 · medium

What does this program print?

print(36 / 6 * 2)

Question 9 · medium

An auto charges ₹30 to start plus ₹12 a kilometre. Sameer's trip is 8 km, then he adds 5 km more. What does this program print?

km = 8
fare = 30 + km * 12
km = km + 5
print(km, fare)

Question 10 · medium

Asha wants her program to show her cricket score. What happens when it runs?

score = 46
print("Asha scored " + score)

Question 11 · medium

After marks = 62, Sameer's program has the line marks = marks + 5. What does this line do?

Question 12 · medium

Priya buys 4 pens at ₹10 each. What happens when this program runs?

cost = pens * 10
pens = 4
print(cost)

Question 13 · hard

Ravi has 5 marbles and Nisha has 9. This program swaps the two counts without a third box. What does it print?

ravi = 5
nisha = 9
ravi = ravi + nisha
nisha = ravi - nisha
ravi = ravi - nisha
print(ravi, nisha)

Question 14 · hard

Arjun scores 48 runs in the first match and 35 in the second. He expects this program to print 83, but it prints 48. Why?

total_runs = 0
total_runs = total_runs + 48
Total_runs = total_runs + 35
print(total_runs)

Question 15 · hard

Nisha's three test marks are 70, 80 and 90. She wants their average: add the marks, then divide by 3. Which line prints exactly 80.0?

Question 16 · easy

Sameer's program starts with the line fare = 40. What does this line do?

Question 17 · medium

Kabir buys 4 kg of onions at ₹32.5 a kg and 4 pens at ₹10 each. What does this program print?

kg = 4
onion_rate = 32.5
pens = 4
print(kg * onion_rate)
print(pens * 10)

Question 18 · hard

Meera has ₹500. She buys 3 cinema tickets at ₹45 each, then shares what is left among 4 friends in whole rupees. What does this program print?

wallet = 500
wallet = wallet - 3 * 45
share = wallet // 4
extra = wallet % 4
print(share, extra)

Next: Input and conversion