Database Basics MCQs | JoinMyTutor

MCQs on Python database programming basics.

Database Basics MCQs cover essential concepts for working with relational databases, SQL queries, and database design. Topics include table creation, CRUD operations, normalization, and data integrity. By practicing these questions, learners strengthen their understanding of database structures, query optimization, and efficient data management, preparing them for backend development and data-driven applications.}

Databases

MCQs on database fundamentals, SQL, and database operations.

  1. Which module provides SQLite support?
    • A. sqlalchemy
    • B. sqlite3
    • C. pysql
    • D. db

    Answer: B — sqlite3 is built-in database module.

  2. Which method executes SQL query?
    • A. cursor.execute()
    • B. db.run()
    • C. sql.query()
    • D. db.exec()

    Answer: A — cursor.execute() is used.

  3. Which method fetches all rows?
    • A. fetch()
    • B. fetchall()
    • C. fetchone()
    • D. fetchmany()

    Answer: B — fetchall() returns all results.

  4. Which method fetches single row?
    • A. fetch()
    • B. fetchone()
    • C. fetchall()
    • D. get()

    Answer: B — fetchone() retrieves one row.

  5. Which method commits changes?
    • A. db.commit()
    • B. cursor.save()
    • C. sql.commit()
    • D. db.save()

    Answer: A — commit() saves changes to DB.

  6. Which method reverts uncommitted changes?
    • A. rollback()
    • B. reset()
    • C. undo()
    • D. revert()

    Answer: A — rollback() cancels uncommitted changes.

  7. Which type of SQL injection is prevented by parameterized queries?
    • A. Time-based
    • B. Union-based
    • C. All types
    • D. None

    Answer: C — Parameterized queries prevent most injections.

  8. What is the placeholder symbol for parameters in sqlite3?
    • A. ?
    • B. %s
    • C. :param
    • D. $

    Answer: A — sqlite3 uses ? placeholders.

  9. Which function closes cursor?
    • A. cursor.close()
    • B. db.close()
    • C. end()
    • D. terminate()

    Answer: A — cursor.close() closes cursor.

  10. Which function closes database connection?
    • A. end()
    • B. db.terminate()
    • C. connection.close()
    • D. shutdown()

    Answer: C — close() method closes connection.

  11. Which SQL command creates a table?
    • A. MAKE TABLE
    • B. CREATE TABLE
    • C. NEW TABLE
    • D. TABLE()

    Answer: B — CREATE TABLE is the correct command.

  12. Which SQL command deletes all rows?
    • A. DELETE TABLE
    • B. DELETE * FROM
    • C. DROP
    • D. CLEAR

    Answer: B — DELETE FROM table removes rows.

  13. Which SQL command deletes structure also?
    • A. DELETE
    • B. DROP TABLE
    • C. REMOVE TABLE
    • D. CLEAR

    Answer: B — DROP TABLE deletes structure.

  14. Which isolation level avoids dirty reads?
    • A. READ UNCOMMITTED
    • B. READ COMMITTED
    • C. NONE
    • D. SHARED

    Answer: B — READ COMMITTED avoids dirty reads.

  15. Which method inserts multiple rows efficiently?
    • A. cursor.executemany()
    • B. cursor.execute()
    • C. db.bulk()
    • D. sql.multi()

    Answer: A — executemany() inserts multiple rows at once.

  16. Which module is standard for SQLite in Python?
    • A. sqlite
    • B. pysqlite
    • C. sqlite3
    • D. db

    Answer: C — sqlite3 is the built-in module for SQLite.

  17. Which method executes SQL commands?
    • A. execute()
    • B. run()
    • C. query()
    • D. commit()

    Answer: A — The execute() method runs SQL statements.

  18. Which method saves changes in a database connection?
    • A. close()
    • B. execute()
    • C. commit()
    • D. save()

    Answer: C — The commit() method saves pending transactions.

  19. Which method fetches all rows of a query?
    • A. fetchall()
    • B. fetch()
    • C. fetchone()
    • D. fetchmany()

    Answer: A — fetchall() retrieves all results from the cursor.

  20. Which SQL command is used to create a table?
    • A. INSERT
    • B. SELECT
    • C. CREATE TABLE
    • D. UPDATE

    Answer: C — CREATE TABLE is used to define a new table.

💡 Tips & Common Mistakes

Remember to review concepts carefully. Fill in custom tips for database-basics here.

📅 Last Updated: November 20, 2026

Vinod Kumar avatar

Vinod Kumar

Senior Full-Stack Instructor

Python & JavaScript Tutor at JoinMyTutor

Vinod teaches practical Python and JavaScript—ranging from basics to advanced web apps—with a focus on clear mental models, code readability, and interview preparation. He authors both the Python and JavaScript tracks on JoinMyTutor.

#Python #Flask #Pandas #JavaScript #Node.js #React #ES6+ #Async/Await #DOM Manipulation
banner