TN Online TestSamacheer Kalvi practice

12th Standard Computer Science — Data manipulation through SQL: Additional MCQs with Answers & Explanations

Share this chapter: Telegram

15 extra multiple-choice questions for Data manipulation through SQL (12th Standard Computer Science, Samacheer Kalvi), beyond the ones printed in the textbook — each with the correct option highlighted and a clear, worked explanation. Free to read in English and Tamil.

Answer key at a glance

Q1
Which Python module is imported natively to work with SQLite databases?
  • A. mysql
  • B. sqlite3Correct
  • C. sql_db
  • D. db_connection
Explanation. Python has a built-in library called sqlite3 that allows developers to connect to and interact with SQLite databases without needing any external server.
Q2
When creating an SQLite database connection using sqlite3.connect("Academy.db"), what happens if the database file does not exist?
  • A. Python raises a FileNotFoundError.
  • B. SQLite opens an in-memory database temporarily.
  • C. Python automatically creates a new database file with that name.Correct
  • D. The connection fails with an AttributeError.
Explanation. The sqlite3.connect() method opens a connection to the specified database file. If the file does not exist, SQLite will automatically create a new empty database file.
Q3
What is the primary purpose of a cursor object in Python's sqlite3 module?
  • A. To establish the physical connection to the database file.
  • B. To automatically save all changes made to database records.
  • C. To configure the database security and license keys.
  • D. To traverse and fetch the records of the database.Correct
Explanation. A cursor is a control structure used to execute SQL queries, traverse the resulting dataset, and retrieve rows from the database.
Q4
In SQLite3, if a column is declared as INTEGER PRIMARY KEY and a NULL value is inserted into it, what does SQLite automatically do?
  • A. It raises an IntegrityError.
  • B. It leaves the value as NULL in the database.
  • C. It converts the NULL into an auto-incremented integer value.Correct
  • D. It assigns a random floating-point number.
Explanation. A column declared as INTEGER PRIMARY KEY automatically auto-increments in SQLite3. If a NULL value is inserted, SQLite converts it into an integer one unit larger than the largest value used so far.
Q5
Which cursor method in the sqlite3 module returns the next single row of a query result set, or None if no rows remain?
  • A. fetchall()
  • B. fetchone()Correct
  • C. fetchmany()
  • D. fetchnext()
Explanation. The fetchone() method is designed to retrieve the next single row from the query results. It returns None if there are no more records available.
Q6
Which symbol is used in Python to unpack database query results when printing them with the sep argument?
  • A. &
  • B. %
  • C. *Correct
  • D. #
Explanation. The asterisk (*) symbol is used as the unpacking operator in Python. When placed before a tuple or list, it unpacks the elements so they can be printed individually.
Q7
Which attribute of the SQLite database connection object can be used to check the total number of database rows that have been modified, inserted, or deleted since the connection was opened?
  • A. total_changesCorrect
  • B. total_rows
  • C. changes_count
  • D. modified_changes
Explanation. The connection.total_changes attribute keeps track of all database modifications that have occurred during the current connection session.
Q8
Which keyword must be used in a Python script to permanently save any modifications made to SQLite database records?
  • A. save()
  • B. commit()Correct
  • C. store()
  • D. apply()
Explanation. DML changes like inserts, updates, and deletes are temporary. The commit() method must be called on the connection object to make those changes permanent in the database file.
Q9
What type of placeholders does the sqlite3 module support for writing parameterized, secure SQL statements?
  • A. Ampersand style (&) and colon style (:)
  • B. Dollar style (\$) and hash style (#)
  • C. Question mark style (?) and named style (:name)Correct
  • D. Percentage style (%) and slash style (/)
Explanation. SQLite3 supports parameterized queries to prevent SQL injection. It allows placeholders using the question mark style (?) and the named placeholder style (:name).
Q10
Which built-in SQLite system table holds key information about the database structure and can be queried to list all user-created tables?
  • A. sql_master
  • B. sqlite_masterCorrect
  • C. sqlite_schema
  • D. database_tables
Explanation. The sqlite_master table is a system-defined master table in SQLite that contains schema definitions and key metadata about all database tables and indexes.
Q11
What does the first element (index 0) of each tuple inside a cursor's description attribute represent?
  • A. The data type of the column
  • B. The total number of rows in the column
  • C. The name of the columnCorrect
  • D. The maximum size of the column
Explanation. The cursor.description attribute provides metadata about the query results. It is a tuple of tuples, where the first element of each sub-tuple is the column name.
Q12
If a student database table contains a column named Average with some NULL values, what is the behavior of the AVG(AVERAGE) aggregate function?
  • A. It raises an error due to the presence of NULL values.
  • B. It includes NULL values in the calculation by treating them as zero.
  • C. It ignores the NULL values completely during calculation.Correct
  • D. It returns NULL as the final average result.
Explanation. In SQL aggregate functions like AVG() and SUM(), any NULL values present in the specified field are ignored during the computation of the final value.
Q13
Why are SQL statement strings in Python often enclosed inside triple quotes (""") when working with the sqlite3 module?
  • A. Because Python requires triple quotes for all database query commands.
  • B. Because the SQL statement might contain single or double quotes within its values.Correct
  • C. To enable automatic execution of multiple statements simultaneously.
  • D. To tell SQLite to compress the database file dynamically.
Explanation. Triple quotes are used because SQL values often contain single quotes or double quotes. Triple quotes allow these characters to exist within the string without escaping.
Q14
Which SQL clause can be used with aggregate functions in Python database queries but cannot be used in a standard SQL WHERE clause?
  • A. DISTINCT
  • B. HAVINGCorrect
  • C. ORDER BY
  • D. GROUP BY
Explanation. The HAVING clause is specifically designed to filter records based on group or aggregate functions, whereas the WHERE clause cannot handle aggregate functions.
Q15
When writing SQLite query results to a CSV file in Python, why is the replace() method commonly used during the subsequent reading of the CSV file?
  • A. To convert the plain text file back into a binary Excel sheet.
  • B. To decrypt the database data that was written to the file.
  • C. To eliminate the default newline character that ends each CSV record.Correct
  • D. To dynamically resize the columns of the spreadsheet.
Explanation. By default, each row written to a CSV file ends with a newline character. When reading the CSV file in Python, the replace method is used to strip these newlines.
Take the Additional practice test → Open the app

More for this chapter

Book Back Questions10 textbook MCQs · solved Practice TestInteractive · instant score Book Back TestTest yourself on the textbook set Additional MCQ TestTest yourself on the extra set Study NotesConcepts & methods Formula SheetAll key formulas

About these Data manipulation through SQL questions

These are the Additional multiple-choice questions for Data manipulation through SQL from the Tamil Nadu State Board (Samacheer Kalvi) 12th Standard Computer Science syllabus. Each question shows the correct option and an original, step-by-step explanation so you understand the method, not just the answer. Use the answer key above to jump to any question, then take the practice test to check yourself under exam-like conditions.

Frequently asked questions

How many MCQs are there in Data manipulation through SQL?

This chapter has 15 book-back multiple-choice questions, each with the correct answer and a step-by-step explanation.

Are these 12th Standard Computer Science MCQs free to practise online?

Yes. Every question, answer and explanation here is free, and you can also take them as a timed practice test.

Where can I find the Data manipulation through SQL book-back answers?

The correct option for each question is highlighted on this page with a worked explanation, plus a quick answer-key summary at the top.

More chapters in Computer Science

View all
1 Function 2 Data Abstraction 3 Scoping 4 Algorithmic Strategies 5 Python -Variables and Operators 6 Control Structures 7 Python functions 8 Strings and String manipulation 9 Lists, Tuples, Sets and Dictionary 10 Python Classes and objects 11 Database Concepts 12 Structured Query Language (SQL) 13 Python and CSV files 14 Importing C++ programs in Python. 16 Data visualization using pyplot: line chart, pie chart and bar chart