12th Standard Syllabus & Materials
12th Standard
TN 12th Computer Applications மின்னணு தரவு பரிமாற்றம் Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications மின் - வணிக பாதுகாப்பு அமைப்புகள் Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications மின்னணு செலுத்தல் முறைகள் Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications மின் - வணிகம் Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications திறந்த மூல கருத்துருக்கள் Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications வலையமைப்பு வடமிடல் Sample Question Papers Study Material - QB365 Set A

Published on: 03/02/2021
12th Standard Computer Science English Medium Data Manipulation Through SQL Reduced Syllabus Important Questions 2021
Download Tamil Nadu 12th Standard Computer Science question papers, model tests, one-mark questions, important questions, and public exam papers in PDF format. Free study materials and answer keys for TN State Board students.
Questions + Answers key
Take MCQ Computer Science Test

1.
_______ SQlite command contain the details of each table column headings
cursor. description
cursor.connect
cursor.column
cursor.fieldname
2.
All the SQlite commands will be executed using _______ object
connect
cursor
CSV
python
3.
cursor.description will be stored as a
list
set
tuple
dictionary
4.
Which of the following placeholders does the SQlite3 module supports?
q mark style
named style
module style
a and b
5.
How many kinds of placeholders the SQlite3 module supports
1
2
3
5
6.
The command to modify the values in the existing table
MODIFY
SELECT
UPDATE
CHANGE
7.
The WHERE clause cannot be combined with
AND
OR
XOR
NOT
8.
In which class the group functions can be used?
WHERE
HAVING
DISTINCT
GROUP BY
9.
Which SQlite clause is used to filter data base on the group functions?
WHERE
HAVING
ORDER
FILTER
10.
Which of the following clause will not work in SQlite?
DISTINCT
HAVING
FETCHALL
WHERE
11.
Which SQlite method is used to fetch the required number of rows in the database table?
fetch ( )
fetchamany ( )
fetchrows ( )
tablerows ( )
12.
Which sqlite method is used to fetch all rows from the database table?
fetch ( )
fetchrowsAll ( )
fectchmany ( )
fetchall ( )
13.
A table column will be automatically auto incremented in SQlite3 by giving
KEY
PRIMARY KEY
PRIMARY COLUMN
KEY PRIMARY
14.
Which of the following is called the master table?
sqlite_master
sql_master
main_master
master_main
15.
SQLite falls under which database system?
Flat file database system
Relational Database system
Hierarchical database system
Object oriented Database system
16.
How the SQL DISTINCT class is helpful to you?
17.
How the cursor object is created?
18.
Write the placeholders which supported by SQlite3 module Execute.
19.
Write a note or cursor. description.
20.
What is the use of AND, OR operators combined with WHERE clause?
21.
How will you sort the data in a table in an ordered way?
22.
What is master table?
23.
What is the reason behind defining a SQL command with triple quotes?
24.
What is a cursor in SQL and databases?
25.
Which method is used to fetch all rows from the database table?
26.
Write the command to populate record in a table. Give an example.
27.
What is the advantage of declaring a column as “INTEGER PRIMARY KEY”
28.
Which method is used to connect a database? Give an example.
29.
Mention the users who uses the Database.
30.
List the classes used in the SQL SELECT statement.
31.
Write a note on SELECT statement in SQL.
32.
What is the purpose of using
(i) COUNT ( )
(ii) AVG ( )
(iii) SUM ( )
(iv) MAX ( )
(v) MIN ( )
33.
What is the use of aggregate functions used along with SELECT statement? What are they?
34.
Explain how a connect to be made to a database (Academy through python SQlite3.
35.
Write the sqlite steps to connect the database.
36.
Explain how the SELECT statement can be used along with GROUP BY class.
37.
Read the following details.Based on that write a python script to display records in desending order of
Eno
database name :- organization.db
Table name :- Employee
Columns in the table :- Eno, EmpName, Esal, Dept
38.
Read the following details. Based on that write a python script to display department wise records
database name:- organization.db
Table name:- Employee
Columns in the table:- Eno, EmpName, Esal, Dept
39.
What is the use of Where Clause.Give a python statement Using the where clause.
40.
What is SQLite?What is it advantage?
41.
Consider the following table Supplier and item .Write a python script for (i) to (ii)
| SUPPLIER | ||||
| Suppno | Name | City | Icode | SuppQty |
| S001 | Prasad | Delhi | 1008 | 100 |
| S002 | Anu | Bangalore | 1010 | 200 |
| S003 | Shahid | Bangalore | 1008 | 175 |
| S004 | Akila | Hydrabad | 1005 | 195 |
| S005 | Girish | Hydrabad | 1003 | 25 |
| S006 | Shylaja | Chennai | 1008 | 180 |
| S007 | Lavanya | Mumbai | 1005 | 325 |
i) Display Name, City and Itemname of suppliers who do not reside in Delhi.
ii) Increment the SuppQty of Akila by 40
42.
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 :-
| I code | :- | Integer and act as primary key |
| Item Name | :- | Character with length 25 |
| Rate | :- | Integer |
| Record to be added | :- | 1008, Monitor, 15000 |
43.
hat is the use of HAVING clause. Give an example python script
44.
Write the Python script to display all the records of the following table using fetchmany()
| Icode | ItemName | Rate |
| 1003 | Scanner | 10500 |
| 1004 | Speaker | 3000 |
| 1005 | Printer | 8000 |
| 1008 | Monitor | 15000 |
| 1010 | Mouse | 700 |
45.
Write in brief about SQLite and the steps used to use it.
1.
(a)
cursor. description
2.
(b)
cursor
3.
(c)
tuple
4.
(a)
q mark style
5.
(b)
2
6.
(c)
UPDATE
7.
(c)
XOR
8.
(b)
HAVING
9.
(b)
HAVING
10.
(c)
FETCHALL
11.
(b)
fetchamany ( )
12.
(d)
fetchall ( )
13.
(c)
PRIMARY COLUMN
14.
(a)
sqlite_master
15.
(b)
Relational Database system
16.
The DISTINCT clause is helpful when there is need of avoiding the duplicate values present in any specific columns/table. When we use distinct keyword only the unique values are fetched.
17.
The cursor object is created by calling the cursor ( ) method of connection. The cursor is used to traverse the records from the result set.
18.
Execute (sql[, parameters]) :
(i) Executes a single SQL statement. The SQL statement may be parameterized (i.e. placeholders instead of SQL literals).
(ii) The SQlite3 module supports two kinds of placeholders: question marks? ("qmark style") and named placeholders: name ("named style").
19.
cursor. description contains the details of each column headings. It will be stored as a tuple and the first one that is 0(zero) index refers to the column name. Using this command you can display the table's Field names.
20.
(i) The WHERE clause can be combined with AND, OR, and NOT operators.
(ii) The AND and OR operators are used to filter records based on more than one condition.
21.
(i) The ORDER BY clause can be used along with the SELECT statement to sort the data of specific fields in an ordered way.
(ii) It is used to sort the result-set in ascending or descending order.
22.
SQlite_master is the master table which holds the key information about your database tables.
23.
The reason behind the triple quotes is sometime the values in the table might contain single or double quotes.
24.
(i) A cursor in SQL and databases is a control structure to traverse over the records in a database. So it's used for the fetching of the results.
(ii) The cursor object is created by calling the cursor( ) method of connection. The cursor is used to traverse the records from the result set.
25.
The fetchall() method is used to fetch all rows from the database table.
result = cursor. fetchall()
26.
To populate the table "INSERT" command is passed to SQLite."execute" method executes the SQL command to perform some action.
Example:
Sql_command =" " INSERT INTO student (Rollno, Sname, Grade, Gender, Average, birth_date) values (NULL, "Akshay", "B", "M", "87.8", "2001-12-12");" " cursor.execute(sql_command)
27.
If a column of a table is declared to be an INTEGER PRIMARY KEY, then whenever a NULL is used as an input for this column, the NULL will be automatically converted into an integer which will be one larger than the highest value so far used in that column.
28.
Create a connection using connect() method and pass the nanie of the database file.
Example:
#connecting to the database
connection = sqlite3.connect ("Academy.db")
#cursor
cursor = connection.cursor()
29.
Users of database can be human users or programmers, other programs or applications.
30.
(i) DISTINCT
(ii) WHERE
(iii) GROUP BY
(iv) ORDER BY.
(v) HAVING
31.
(i) "SELECT" is the most commonly used statement in SQL.
(ii) The SELECT Statement in SQL is used to retrieve or fetch data from a table in a database.
(iii) The syntax for using this statement is "Select * from table_name" and all the table data can be fetched in an object in the form of list of lists. List the classes used in
32.
(I) COUNT ( ) function returns the number of rows in a table.
(ii) AVG ( ) function retrieves the average of a selected column of rows in a table.
(iii) SUM ( ) function retrieves the sum of a selected column of rows in a table.
(iv) MAX( ) function returns the largest value of the selected column.
(v) MIN( ) function returns the smallest value of the selected column.
33.
Aggregate functions are used to do operations from the values of the column and a single value is returned.
(i) COUNT ( )
(ii) AVG ( )
(iii) SUM ( )
(iv) MAX ( )
(v) MIN ( )
34.
# Python code to demonstrate table creation and insertions with SQL
# importing module
import sqlite3
# connecting to the database
connection = sqlite3.connect ("Academy.db")
# cursor
cursor = connection.cursor ( )
35.
Step 1: Import sqlite3
Step 2: Create a connection using connect o method and pass the name of the database File
Step 3: Set the cursor object cursor = connection. cursor ( )
36.
(i) The SELECT statement can be used along with GROUP BY clause.
(ii) The GROUP BY clause groups records into summary rows. It returns one records for each group.
(iii) It is often used with aggregate functions (COUNT, MAX, MIN, SUM, AVG) to group the result -set by one or more columns.
37.
Program: Display the records in descending order using python script
import mysqldb
db = mysqldb.connect ("local host", "user", "123", "organization")
cursor = db.cursor()
cursor.execute ("SELECT *FROM Employee ORDER BY Name DESC")
result = cursor.fetchall()
for row in results:
ENO = row[0], EmpName = row[1], EmpDept = row[2]
print ENO, EmpName, EmpDept
db.close()
38.
Db: Organization.db
Table name: Employee
Column: Eno, EmpName, Esal, Dept
Program:
import mysqldb
db = mysqldb.connect("localhost, "user", "123", "organization")
cursor= db.cursor()
Cursor.execute ("SELECT *FROM Employee")
results = cursor.fetchall()
for row in results:
Eno = row[0], EmpName = row[1], EmpDept = row[2]
print Eno, EmpName, EmpDept
db.close()
39.
The WHERE clause is used to extract only those records that fulfill a specified condition. In this example we are going to display the different grades scored by male students from "student table.
import sqlite3
connection = sqlite3.connect ("Academy.db")
cursor = connection.cursor()
cursor.execute ("SELECT DISTINCT (Grade) FROM student where gender = "M")
result = cursor.fetchall()
print(* result, sep ="\n")
Output:
('B,')
('A,')
('C,')
('D,')
40.
(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 such as MySQL or Oracle.
Advantages:
SQLite is fast, rigorously tested, and flexible, making it easier to work.
Python has a native library for SQLite.
41.
(i) Program to Display Name, city and Item Name of suppliers who do not reside in Delhi:
import mysqldb
db = mysqlkdb.Connect ("Supplier.db")
cursor = db.cursor()
cursor. execute ("'SELECT NAME, CITY, ICode FROM Supplier WHERE CITY <> "Delh")
db. commit()
result=cursor.fetchall()
print ("result, sep = "\n")
db. close()
(ii) Program to Increment the suppQty of Akila by 40:
import mysqldb
db = mysqldb.Connect ("ltem.db"')
cursor = db.cursor()
cursor. execute ("UPDATE Item SET Name = 'Akila' WHERE SuppQty = 235)
db. commit()
cursor. execute ("SELECT * FROM Item")
result = cursor.fetchall()
print ("result, sep ="\n")
db. close()
42.
Program:
import mysql db
db = mysqldb.connect ("local host", "user", "123", "organization'")
cursor = db.cursor()
item table creation
database: ABC, table: Item, lcode: int, ItemName: Char
Rate: int. Record: 1008, Monitor: 15000
cursor.execute ("Create table item(icode int, item Name char (25), Rate int"));
db.close
cursor. execute ("insert into item values ("1008", 'Monitor', '15000" ));
db.commit()
43.
HAVING clause is used to filter data based on7the group functions. This is similar to WHERE condition but can be used , only with group functions. Group functions cannot be used in WHERE Clause but can be used in HAVING clause.
Example:
import sqlite3
connection = sqlite3.connect("Academy.db")
cursor = connection.cursorO
cursor.execute("SELECT GENDER,COUNT(GENDER) FROM Student GROUP BY GENDER HAVING COUNT( GENDER> 3")
result = cursor.fetchall( )
co = [i[o] for i in cursor. description]
print(co)
print(result)
Output:
['gender', 'COUNT(GENDER)']
[('M', 5)]
44.
Creating database:
Sql_command = " "
CREATE TABLE Hardware (
lcode INTEGER PRIMARY KEY.
ltem_Name VARCHAR(20),
Rate DEClMAL(5,2));" "
Program: To display the records using fetchmany()
import sqlite3
connection = sqlite3.connect ("Material.db")
cursor = connection.cursor()
cursor. execute ("SELECT * FROM Hardware")
print("fetching first 5 records:")
result = cursor.fetchmany(5)
print(result)
Output:
fetching first 5 records:
[(1003, 'Scanner', "10500'), (1004, 'Speaker', '3000'), (1005, 'Printer', '8000'), (1008, 'Monitor', '15000'),
(1010, 'Mouse', '700')]
45.
(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 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) Connecting to a database in step 2 means passing the name of the database to be accessed. If the database already exists the connection will open the same. Otherwise, Python will open a new database file with the specified name.
(v) Cursor in step 3 is a control structure used to traverse and fetch the records of the database.
(vi) Cursor has a major role in working with Python. All the commands will be executed using cursor object only.
(vii) To create a table in the database, create an object and write the SQL command in it.
Example: sql_comm = "SQL statement"
(viii) For executing the command use the cursor method and pass the required sql command as a parameter. Many number of commands can be stored in the sql comm and can be executed one after other.
(ix) Any changes made in the values of the record should be saved by the commend "Commit" before closing the "Table connection" .
12th Standard Syllabus & Materials
12th Standard
TN 12th Computer Applications களப்பெயர் முறைமை (DNS) Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications வலையமைப்பு எடுத்துக்காட்டுகள் மற்றும் நெறிமுறைகள் Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications கணினி வலையமைப்பு ஓர் அறிமுகம் Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications PHP-உடன் MySQL-ஐ இணைத்தல் Sample Question Papers Study Material - QB365 Set A
Tamilnadu Stateboard 12th Standard Subjects

Maths

Chemistry

Physics

Biology

Computer Science

Business Maths and Statistics

Economics

Commerce

Accountancy

History

Computer Applications

Biology

Computer Technology

Computer Applications

Computer Science

Business Maths and Statistics

Commerce

Economics

Maths

Chemistry

Physics

Computer Technology

History

Accountancy

Tamil

English

French
Tamilnadu Stateboard Standards