🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Design a Ticket Booking System: all 10 questions

Quiz: Design a Ticket Booking System · Question 5 of 10

What does this print? (code)

What does this print?

import sqlite3
db = sqlite3.connect(":memory:")
db.execute("CREATE TABLE s (id TEXT, status TEXT)")
db.execute("INSERT INTO s VALUES ('A1', 'FREE')")
r1 = db.execute("UPDATE s SET status='HELD' WHERE id='A1' AND status='FREE'").rowcount
r2 = db.execute("UPDATE s SET status='HELD' WHERE id='A1' AND status='FREE'").rowcount
print(r1, r2)
  1. A.1 1
  2. B.1 0
  3. C.0 1
  4. D.0 0
Answer & explanation

Correct answer: 1 0

The first update changes the free seat; the second finds no row that is still FREE.

Can you get the rest right without peeking?

Take the timed Quiz: Design a Ticket Booking System quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →