TN Board 12th Computer Science Important Questions Chapter 15 Data Manipulation Through SQL

TN State Board 12th Computer Science Important Questions Chapter 15 Data Manipulation Through SQL

Question 1.
What is use of ‘commit’ command in sql?
Answer:

  1. The ‘commit’ command is used to any changes made in the values of the record should be saved.
  2. This command is used before closing the Table connection.

Question 2.
What is mean by populate in SQL?
Answer:

  • Populate mean add record in the Table
  • To populate the table INSERT command is passed to SQLite.

Question 3.
What are Aggregate function used SQL Group?
Answer:
The Aggregate functions are COUNT ( ), SUM ( ), MIN ( ), AUG ( ), MAX ( ).

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 15 Data Manipulation Through SQL

Question 4.
What are clauses that can be used in the SELECT statements in SQL?
Answer:
SQL provides various clauses that can be used in the SELECT statements. This clauses are DISTINCT, WHERE, GROUPBY, ORDERBY and HAVING.

Question 5.
Write the functions of MAX ( ) and MIN ( ) in SQL.
Answer:

  1. MAX ( ) – This function returns the largest value of the selected column.
  2. MIN ( ) – This function returns the smallest value of the selected column.

Question 6.
What is advantage of SQLite?
Answer:

  • SQLite is fast, rigorously tested and flexible, making it easier to work.
  • Python has a native library for SQLite.

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 15 Data Manipulation Through SQL

Question 7.
What is master table?
Answer:
SQLitejmaster is the master table which holds the key information about your database tables.

Question 8.
How the cursor object is created?
Answer:

  • The cursor object is created by calling the cursor ( ). method of connection.
  • The cursor is used to traverse the records from the result set.

Question 9.
List the classes used in the SQL SELECT statement.
Answer:

  1. DISTINCT
  2. WHERE
  3. GROUP BY
  4. ORDER BY
  5. HAVING

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 15 Data Manipulation Through SQL

Question 10.
How will you creating a Database using SQLite?
Answer:
Creating a Database using SQLite, the commands are
import sqlite3 # importing module first
connection = sqliteB.connect (“stud.db”)
# connecting database to be created
Cursor = connection.cursor ( )
In this example, a database name ‘stud.db’ would be created database.

Question 11.
Write an example for creating a table in the SQL database.Table Name student.
Answer:
CREATE TABLE student
(ROLL NO INTEGER PRIMARY KEY,
SName VARCHAR (20),
Grade CHAR(l),
Gender CHAR (1).
Average Float (6,2)
DOB Date);

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 15 Data Manipulation Through SQL

Question 12.
Write a python program to accept data using input () command during run time.
Answer:
# code for executing query using input data import sqlite3
con =sqlite3.connect(“Academy.db”)
cur = con. cursor!) cur.execute(“DROP Table person”)
cur.execute(“create table person (name, age, id)”)
print(“Enter 5 students names:”)
who =[input() for i in range(5)]
print(“Enter their ages respectively:”)
age =[int(input( )) for i in range(5)]
print(“Enter their ids respectively:”)
p_id =[int(input( ))for i in range(5)]
n =len(who)
for i in range(n):
cur.execute(“insert into person values (?, ?, ?)”, (who[i], age[i], p_id[i]))
cur.execute(“select * from person”)
# Fetches all entries from table
print(“Displaying All the Records From Person Table”)
print (*cur.fetchall( ), sep=‘\n’)

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 15 Data Manipulation Through SQL

Question 13.
Write a python program to query more than one table by joing them.
Answer:
(Table name: student, Appointment)
import sqlite3
connection = sqlite3.connect (“Academy, db”)
cursor = connection.cursor( )
cursor.execute(“““DROP TABLE Appointment; ”””)
sqlcommand = “““
CREATE TABLE Appointment (rollnointprimarkey,Duty varchar( 10),age int)”””
cursor.execute(sqlcommand)
sqlcommand = “““INSERT INTO Appointment (Rollno,Duty ,age)
VALUES (“1”, “Prefect”, “17”);”””
cursor.execute(sql_command)
sql_command = “““INSERT INTO Appointment (Rollno, Duty, age)
VALUES (“2”, “Secretary”, “ 16”);”””
cursor. execute(sql_command)
connection.commit( )
cursor. execute(“SELECT student.rollno, student, sname, Appointment.
Duty,Appointment.Age FROM student, Appointment where student.
rollno = Appointment.rollno”)
co = [i[0] for i in cursor.description]
print(co)
result = cursor. fetchall( )
for r in result:
print(r)

Question 14.
Mention the users who uses the Database.
Answer:
Users of database can be human users, other programs or applications.

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 15 Data Manipulation Through SQL

Question 15.
Which method is used to connect a database? Give an example.
Answer:
Connect ( ) method is used to connect a database and pass the name of the database file.
Eg: Connection = sqlite3.connect (“Academy.db”)

Question 16.
What is the advantage of declaring a column as “INTEGER PRIMARY KEY”
Answer:
If a column of a table is declared to be an INTEGER PRIMARY KEY, then whenever a NULL will be used as an input for this column, the NULL will be automatically converted into an integer which will one larger than the highest value so for used in that column.
Eg: RollNo INTEGER PRIMARY KEY.

Question 17.
Write the command to populate record in a table. Give an example.Answer:
(i) INSERT command is to populate record in a Table.
(ii) To populate (add record) the table
INSERT command is passed to SQLite. “execut e” method
executes the SQL command to perform some action.
Eg:
sql_command = “ “INSERT INTO
student (RollNo, sname, Grade)

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 15 Data Manipulation Through SQL

Question 18.
Which method is used to fetch all rows from the database table?
Answer:
Fetchall ( ) method is to fetch all rows from the database table.
Eg: res = cursor.Fetchall ( )

Question 19.
What is SQLite?What is it advantage?
Answer:
(i) SQLite is a simple relational database system, which saves its data in regular data files or even in the internal memory of the computer.
(ii) It is designed to be embedded in applications, instead of using a separate database server program.
(iii) The advantage of SQLite is fast, rigorously tested, and flexible, making it easier to work. Python has a native library for SQLite.

Question 20.
Mention the difference between fetchone( ) and fetchmany( ).
Answer:

fetchone ( )

 fetchmany ( )

The fetchone ( ) method returns the next row of a query result set or none in case there is row left. fetchmany ( ) method that returns the next number of rows (n) of the result set.
Using while loop and fetchone ( ) method we can , display all the records from a table. Displaying specified number of records is done by using fetchmany ( ).
Fetch the next row of a query result set, returning a single tuple, or none when no more data is available. Fetch the next set of rows of a query, returning a list of tuples. An empty list is returned when no more rows are available.
Eg: res = cursor, fetchone ( ) Eg: res = cursor, fetchmany (3)

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 15 Data Manipulation Through SQL

Question 21.
What is the use of Where Clause. Give a python statement Using the where clause.Answer:
(i) The WHERE clause is used to extract only those records that fulfill a specified condition.
(ii) The WHERE clause can be combined with AND, OR and NOT operators.
(iii) WHERE clause cannot be used along with GROUPBY.
(iv) The AND or OR operators are used to . filter records base on more than one condition.
Eg:
cursor.execute(“SELECT ROLLNO, TOTAL FROM student WHERE (Total >=400 AND Total < = 600)”)

Question 22.
Read the following details.Based on that write a python script to display department wise records
database name organization.db
Table nameEmployee
Columns in the table Eno, EmpName, Esal, Dept
Answer:
import sqlite3
connection = sqlite3.connect (“organization, .db”)
cursor = connection, cursor ( )
CREATE TABLE Employee(
Eno INTEGER PRIMARY KEY,
EmPName VARCHAR (20),
Esal DECIMAL (6,2)
Dept VARCHAR (20);
cursor.execute (sql_command)
sql command = “ ” INSERT INTO organization (Eno, EmpName, Esal, Dept)
VALUES (NULL, “GOPU”, “9562.50”, “EDUCATION”);
Cursor, execute(sql_command)
Connection.commit ( )
connection.close( )

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 15 Data Manipulation Through SQL

Question 23.
Read the following details.Based on that write a python script to display records in
descending order of
Eno
database name:- organization.db
Table name:- Employee
Columns in the table:- Eno, EmpName, Esal, Dept.
Answer:
import sqlite3
connection = sqlite3.connect (“organization, db”)
cursor = connection,cursor ( )
CREATE TABLE Employee (
Eno INTEGER PRIMARY KEY,
EmPName VARCHAR (20),
Esal DECIMAL (6, 2)
Dept VARCHAR (20);
cursor.execute(“SELECT * FROM organization ORDER BY NAME DESC”)
sql-command = “ ” INSERT INTO
organization (Eno, EmpName, Esal, Dept)
VALUES (NULL, “GOPU”, “9562.50”, “EDUCATION”);
Cursor.execute(sqlcommand)
Connection.commit ( )
connection.close( )

Question 24.
Write in brief about SQLite and the steps used to use it.
Answer:
(i) SQLite is a simple relational database system, which saves its data in regular data files or even in the internal memory of the computer.
(ii) SQLite is designed to be embedded in
applications, instead of using a separate database server program such as MySQL or Oracle.
(iii) SQLite is fast, rigorously tested and flexible, making it easier to work.
Python has a native library for SQLite.
To use SQLite
Step 1 – import sqlite3
Step 2 – Create a connection using connect ( ) method and pass the name of the database file.
Step 3 – Set the cursor object cursor = connection, cursor ( )
(iv) In python, all the commands will be executed using cursor object only.
(v) To create a table in the database create an object and write the SQL command in it.
Eg: sql_comm = “SQL statement”.

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 15 Data Manipulation Through SQL

Question 25.
Write the Python script to display all the records of the following table using fetchmany( ).
Answer:

Icode  ItemName  Rate
1003  Scanner  10500
1004  Speaker  3000
1005  Printer  8000
1008  Monitor  15000
1010  Mouse  700

import sqlite3
connection = sqlite3.connect (“ITEM”)
cursor = connection,cursor ( )
CREATE TABLE items (
Icode INTEGER PRIMARY KEY,
Item Name VARCHAR (20),
Rate DECIMAL (8,2);
Itemlist = [(“1003”, “scanner”, “10500”),
(“1004”, “Speaker”, “3000”),
(“1005”, “Printer”, “8000”),
(“1008”, “Monitor”, “ 15000”),
(“1010”, “Mouse”, “700”)],
sqlcommand = formatstr.format
(Icode =p[0], ItemName = p[l], Rate = p[2])
Cursor.execute(sql_command)
Connection.commit ( )
cursor.execute (“SELECT * FROM ITEM”)
result = cursor.fetchall ( )
for i in result:
print (r)

Question 26.
What is the use of HAVING clause. Give an example python script.
Answer:
# Example python script using Having clause
import sqlite3
db = sqlite3. connect (“test.sqlite”)
cursor = db.cursor ( )
sql = “SELECT* FROM results”
Cursor.execute(sql)
for row in cursor:
print row
sql = (“SELECT source, receiver, level FROM)
results WHERE percentage > 0.4”
“GROUP BY Source, receiver HAVING Percentage = min (percentage)”)
cursor.execute (sql)
for row in cursor:
print row

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 15 Data Manipulation Through SQL

Question 27.
Write a Python script to create a table called ITEM with following specification.
Add one record to the table.
Name of the database :- ABC
Name of the table :- Item
Column name and specification :-
Answer:

Icode  :-  integer and act as primary key
Item Name  :-  Character with length 25
Rate  :-  Integer
Record to be added  :-  1008, Monitor, 15000

Import Sqlite 3
connection = sqlite3.connect (“ABC .db”)
cursor = connection,cursor ( )
sqlcommand = “ ”
CREATE TABLE item (
Icode INTEGER PRIMARY KEY,
Item Name VARCHAR (25),
Rate INTEGER;
Cursor.execute(sql_command)
“Sql command” = “ ” INSERT INTO Item ( Icode, ItemName,Rate)
VALUES (NULL, “1008”, “Monitor”, “15000”) ”’
Cursor.execute(sql_command)
Connection.commit ( )
connection.close( )

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 15 Data Manipulation Through SQL

Question 28.
Consider the following table Supplier and item. Write a python script for (i) to (ii).
Answer:

TN State Board 12th Computer Science Important Questions Chapter 15 Data Manipulation Through SQL 1

(i) Display Name, City and Itemname of suppliers who do not reside in Delhi.
(ii) Increment the SuppQty of Akila by 40 import sqlite3
connection = sqlite3. connect (“Supplier.db”)
cursor = connection.cursor ( )
item = [(“S001”, “Prasad” “Delhi”, “1008”, “100”),
(“S002”, “Anu”, “Bangalore”, ‘1010’, “200”),
(“S003”, “Sahid”, “Bangalore”, “1008”, “175”),
(“S004”, “Akila”, “Hyderabad”, “1005”, “195”),
(“S005”, “Girish”, “Hyderabad”, “1003”, “25”),
(“S006”, “Shylaja”, “Chennai”, “1008”, “180”),
(“S007”, “Lavanya”, “Mumbai”, “1005′, “325”);
for p in item:
format_str = “INSERT INTO item (suppno, Name, city, Icode, suppQty)
VALUES (NULL, “{suppno}”, “{Name}”, “{city}”, “{Icode}”, “{suppQty}”);“‘ “‘
sql_command = format_str.format (suppno = p[0],
Name = p[l], city = p[2], Icode =p[3], suppQty = p[4])
Cursor.execute(sql_command)
Connection.commit ( )
Cursor. execute(“SELECT Name, city, Icode FROM item WHERE (city < > “Delhi”)”)
Cursor.execute(“SELECT Name, suppQty FROM
item WHERE (Name = “AKILA” And p(4)+40)”)
result = cursor.fetchall ( )
print (result)

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 15 Data Manipulation Through SQL

Question 29.
Create an interactive program to accept the details from user and store it in a csv file using Python for the following table.
Database name;- DB1; Table name: Customer

TN State Board 12th Computer Science Important Questions Chapter 15 Data Manipulation Through SQL 2

Answer:
import sqlite3
import io
import csv
sql_command = “‘ “‘
CREATE TABLE Customer (cust_Id INT PRIMARY KEY),
cust_Name VARCHAR (20),
Address VARCHAR (30),
phoneno VARCHAR (10),
city VARCHAR (10);
sql_command = “ ” INSERT INTO customer (cust_Id, cust_Name, Address, phone no, city)
VALUES (“C008”, “Sandeep”, “141, Pritam pura”, “41206819”, “Delhi”); ”’ “‘
cursor.execute (sql_command)
sql_command = “‘ ”’ INSERT INTO customer(cust_Id, custName, Address, phone_no, city)
VALUES (“C010”, “Anurag Basu”, “15A, park Road”, “61281921”, “Kolkatta”);‘“ ”’
cursor, execute (sql_command)
sql command = “‘ ”’ INSERT INTO customer(cust_Id, custName, Address, phone_no, city)
VALUES (“C012”, “Hrithik”, “7/2 vasant Nagar”, “26121949”, “Delhi”);’” “’
cursor, execute (sql command)
connection. commit( )
# Creating csv file
d = open (‘c:\pyprg\cust.csv’,‘w’)
c = csv.write (d)
connection = sqlirte3.connect (“Dbi.db”)
cursor = connection.cursor ()
Cursor.execute(“SELECT*FROM customer ORDER BY Phone_no”)
Cu = [i[0] for i in cursor.description]
c.writerow(Cu)
data = Cursor.fetchall( )
for item in data:
c. writerow (item)
d. close ( )
with open (‘c: \pyprg\cust.csv’; newline = None) as fd:
for line in fd:
line = line.replace(“\n”,“ ”)
print (line)
Cursor.close ( )
Connection.close ( )

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 15 Data Manipulation Through SQL

Question 30.
Consider the following table GAMES. Write a python program to display the records for question (i) to (iv) and give outputs for SQL queries (v) to (viii).
Answer:

TN State Board 12th Computer Science Important Questions Chapter 15 Data Manipulation Through SQL 3

(i) To display the name of all Games with their Geodes in descending order of their schedule date.
(ii) To display details of those games which are having Prize Money more than 7000.
(iii) To display the name and gamename of the Players in the ascending order of Gamename.
(iv) To display sum of PrizeMoney for each of the Number of participation groupings (as shown in column Number 4}
(v) Display all the records based on GameName.
import sqlite3
connection – sqlite3.connect (“Game.db”)
cursor = connection,cursor ( )
game_data = [(“101”, “Padmaja”, “carom Board”, “2”, “5000”,“01-23-2014”),
(“102”, “Vidhya”, “Badminton”, “2”, “12000”,“ 12-12-2013”),
(“103”, “Guru”, “Table Tennis”, “4”, “ 18000”,“02-14-2014”),
(“105”, “Keerthana”, “carom Board”, “2”, “9000” ,“01-01-2014”),
(“108”, “Krishna”, “Table Tennis”, “4”, “25000”,“03-19-2014”),
for p in game_data:
format_str = ”’ INSERT INTO games
(Geode, Name, GameName, Number, Prizemoney, ScheduleDate)
VALUES (NULL, “{Geode }”, “{Name}”, “{GameName }”, “{Number “{Prizemoney}” “{ScheduleDate}”);’”
sql_command – format_str. format (Geode =p[0],
Name = p[1], GameName = p[2], Number = p[3], prizemoney = p[4], ScheduleDate = P[5])
Cursor.execute(sql_ command)
Connection.commit ( )
Cursor. execute(“SELECT*FROM games ORDER BY scheduledate DESC, Geode,GameN ame”)
Cursor.execute(“SELECT game Name, prizemoney FROM games WHERE (prize money>7000)”)
Cursor.execute(“SELECT*FROM games, game name, gameName ASCN)
Cursor.execute(“SELECT*FROM games GROUPBY
Gamename. HAVING SUM
(Number*prizemoney”)
Cursor.execute(“SELECT*FROM games ORDER BY Game Name ASCE, Game Name”)
result = cursor. fetchall( )
for r in result
print (r)
connection.close ( )

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 15 Data Manipulation Through SQL

Choose the best answer:

Question 1.
Python program can interact as a user of an:
(a) SQL database
(b) MS Word
(c) Star. Writer
(d) None
Answer:
(a) SQL database

Question 2.
Which statement in SQL is used to retrieve or fetch data from the table in a database?
(a) INSERT
(b) SELECT
(c) FROM
(d) ORDERBY
Answer:
(b) SELECT

Question 3.
Which method is returns the next row of a query result set?
(a) fetchall ( )
(b) fetchone ( )
(c) fetchmany ( )
(d) Both A and B
Answer:
(b) fetchone ( )

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 15 Data Manipulation Through SQL

Question 4.
Which method is displaying specified number of records is done?
(a) fetchall ( )
(b) fetchone ( )
(c) fetchmany ( )
(d) Both A and B
Answer:
(c) fetchmany ( )

Question 5.
Which clause is used to extract only those records that fulfill a specified condition in SQL?
(a) WHERE
(b) DISTINCT
(c) HAVING
(d) GROUPBY
Answer:
(a) WHERE

Question 6.
Which clause is used by groups records into summary rows in SQL?
(a) WHERE
(b) DISTINCT
(c) HAVING
(d) GROUPBY
Answer:
(d) GROUPBY

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 15 Data Manipulation Through SQL

Question 7.
Which clause is used to sort the result set in ascending or descending order in SQL?
(a) WHERE
(b) DISTINCT
(c) ORDERBY
(d) HAVING
Answer:
(c) ORDERBY

Question 8.
Which clause is used to filter data based on the group function in SQL?
(a) HAVING
(b) WHERE
(c) DISTINCT
(d) GROUPBY
Answer:
(a) HAVING

Question 9.
Which clause can be combined with AND, OR, NOT operators in SQL?
(a) HAVING
(b) WHERE
(c) DISTINCT
(d) GROUPBY
Answer:
(b) WHERE

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 15 Data Manipulation Through SQL

Question 10.
Which function returns 0 if there were no matching rows in SQL?
(a) COUNT ( )
(b) SUM( )
(c) MIN ( )
(d) MAX ( )
Answer:
(a) COUNT ( )

Question 11.
Match the following:

(i) DISTINCT A. Summary rows
(ii) GROUP BY B. Sort data
(iii) ORDER BY C. Filter data
(iv) HAVING D. Avoid duplicate

(a) (i) – D, (ii) – A, (iii) – B, (iv) – C
(b) (i) – D, (ii) – C, (iii) – B, (iv) – A
(c) (i) – C, (ii) – B, (iii) – A, (iv) – D
(d) (i) – C, (ii) – A, (iii) – D, (iv) – B
Answer:
(a) (i) – D, (ii) – A, (iii) – B, (iv) – C

Question 12.
Match the following:

(i) COUNT ( )  A. Find the sum
(ii) SUM ( )  B. returns number of rows
(iii) MIN ( )  C. Find the mean
(iv) AUG ( )  D. Smallest value

(a) (i) – B, (ii) – C, (iii) – D, (iv) – A
(b) (i) – B, (ii) – A, (iii) – D, (iv) – C
(c) (i) – D, (ii) – C, (iii) – B, (iv) – A
(d) (i) – D, (ii) – B, (iii) – A, (iv) – C
Answer:
(b) (i) – B, (ii) – A, (iii) – D, (iv) – C

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 15 Data Manipulation Through SQL

Question 13.
Choose the incorrect pair:
(a) SQL – database
(b) SQLite – Relation database
(c) Commit – Delete the record
(d) INSERT – Populate
Answer:
(c) Commit – Delete the record

Question 14.
Choose the correct pair:
(a) SELECT – Query
(b) fetchall – Select Rows
(c) fetchone – Next number of rows
(d) fetchmany – Next row
Answer:
(a) SELECT – Query

Question 15.
Choose the incorrect statement.
(a) A database is an organized collection of data.
(b) The database management system is a software application.
(c) Python program cannot be interact as a user of an SQL database.
(d) SQLite is a simple Relational database system.
Answer:
(c) Python program cannot be interact as a user of an SQL database.

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 15 Data Manipulation Through SQL

Question 16.
Choose the correct statement.
(a) sqlite master is a database.
(b) The path of a file can be either represented as ‘/’ or ‘\\’ in python.
(c) Count ( ) function returns the number of Column in a table.
(d) HAVING clause is used to store the data.
Answer:
(b) The path of a file can be either represented as ‘/’ or ‘\\’ in python.

Question 17.
Assertion (A):
SELECT is the most commonly used statement in SQL.
Reason (R):
HAVING clause is used to filter data based on the group functions.
(a) Both A and R are true and R is the correct explanation for A.
(b) Both A and R are true but R is the not correct explanation for A.
(c) A is true But R is false.
(d) A is false But R is true.
Answer:
(b) Both A and R are true but R is the not correct explanation for A.

Question 18.
Assertion (A):
Aggregate function are used to do operations from the values of the column and a single value is returned.
Reason (R):
SUM ( ) function retrieves the largest value of the selected rows.
(a) Both A and R are true and R is the correct explanation for A.
(b) Both A and R are true but R is the not correct explanation for A.
(c) A is true But R is false.
(d) A is false But R is true.
Answer:
(c) A is true But R is false.

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 15 Data Manipulation Through SQL

Question 19.
Assertion (A):
The cursor object is created by calling the cursor ( ) method of connection.
Reason (R):
The cursor is used to traverse the records from the result set.
(a) Both A and R are true and R is the correct explanation for A.
(b) Both A and R are true but R is the not correct explanation for A.
(c) A is true But R is false.
(d) A is false But R is true.
Answer:
(a) Both A and R are true and R is the correct explanation for A.

Question 20.
Pick the odd one out.
(a) DISTINCT
(b) SUM
(c) WHERE
(d) HAVING
Answer:
(b) SUM

Question 21.
Which is SQLite is used create a connection with a database file created?
(a) Cursor ( )
(b) connect ( )
(c) execute ( )
(d) lite ( )
Answer:
(b) connect ( )

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 15 Data Manipulation Through SQL

Question 22.
The WHERE clause cannot be combined with:
(a) XOR
(b) AND
(c) OR
(d) NOT
Answer:
(a) XOR

Question 23.
Which values cannot be counted?
(a) Integer
(b) String
(c) Character
(d) NULL
Answer:
(d) NULL

Question 24.
Carsor.description will be stored as a
(a) list
(b) tuple
(c) set
(d) dictionary
Answer:
(b) tuple

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 15 Data Manipulation Through SQL

Question 25.
The table’s field names can be displayed using:
(a) cursor.description
(b) cursor, connect
(c) cursor.commit
(d) cursor, execute
Answer:
(a) cursor.description

Question 26.
__________ is a simple relational database system.
(a) python
(b) cython
(c) SQLite
(d) MySQL
Answer:
(c) SQLite

Question 27.
What program can interact as a user of a SQL database?
(a) C++
(b) C
(c) java
(d) Python
Answer:
(d) Python

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 15 Data Manipulation Through SQL

Question 28.
Which method run the SQL command to perform some action?
(a) cursor ( )
(b) execute ( )
(c) connect ( )
(d) lite ( )
Answer:
(b) execute ( )

Question 29.
Count ( ) returns ___________ if there were no matching tows.
(a) NULL
(b) NOT NULL
(c) 0
(d) 1
Answer:
(c) 0

Question 30.
Which of the python native library?
(a) SQLite
(b) Oracle
(c) MySQL
(d) Foxpro
Answer:
(a) SQLite

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 15 Data Manipulation Through SQL

Question 31.
Which of the following is MI organized collection of data?
(a) Database
(b) DBMS
(c) Information
(d) Records
Answer:
(a) Database

Question 32.
SQLite falls under which database system?
(a) Flat file database system
(b) Relational Database system
(c) Hierarchical database system
(d) Object oriented Database system
Answer:
(b) Relational Database system

Question 33.
Which of the following is a control structure used to traverse and fetch the records of the database?
(a) Pointer
(b) Key
(c) Cursor
(d) Insertion point
Answer:
(c) Cursor

Question 34.
Any changes made in the values of the record should be saved by the command:
(a) Save
(b) Save As
(c) Commit
(d) Oblige
Answer:
(c) Commit

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 15 Data Manipulation Through SQL

Question 35.
Which of the following executes the SQL command to perform some action?
(a) Execute( )
(b) Key( )
(c) Cursor( )
(d) run( )
Answer:
(c) Cursor( )

Question 36.
Which of the following function retrieves the average of a selected column of rows in a table?
(a) Add( )
(b) SUM( )
(c) AVG( )
(d) AVERAGE( )
Answer:
(c) AVG( )

Question 37.
The function that returns the largest value of the selected column is:
(a) MAX( )
(b) LARGE( )
(c) HIGH( )
(d) MAXIMUM( )
Answer:
(a) MAX( )

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 15 Data Manipulation Through SQL

Question 38.
Which of the following is called the master table?
(a) sqlite_master
(b) sql master
(c) main_master
(d) master_main
Answer:
(a) sqlite_master

Question 39.
The most commonly used statement in SQL is:
(a) cursor
(b) select
(c) execute
(d) commit
Answer:
(b) select

Question 40.
Which of the following clause avoid the duplicate?
(a) Distinct
(b) Remove
(c) Where
(d) GroupBy
Answer:
(a) Distinct

 

TN Board 12th Computer Science Important Questions