You are on page 1of 14

CHENNAI SAHODAYA SCHOOLS COMPLEX

COMMON EXAMINATION
CLASS XII
COMPUTER SCIENCE (083)
Time : 3 hours Maximum Marks:70
General Instructions
❖ This Question paper contains 14 printed pages.
❖ This Question paper contains 35 Questions.
❖ Write down the question number before attempting.
❖ An additional reading time of 15 minutes.
General Instruction to answer this Question paper
1. This Question paper contains Five Sections, Section A to E.
2. All Question are compulsory.
3. Section A have 18 questions carrying 01 mark each.
4. Section B has 07 Very Short Answer Type Questions carrying 02 marks each.
5. Section C has 05 Short Answer type questions carrying 03 marks each.
6. Section D has 03 Long Answer type questions carrying 05 marks each.
7. Section E has 02 questions carrying 04 marks each. One internal choice is given in
Q34 against part (iii) only.
8. All Programming questions are to be answered using python language only.

SECTION A

1. Which of the following is an unordered collection of elements in python? 1


(a)List (b) Tuple (c) Dictionary (d) String

2. Identify the invalid variable name from the following. 1


Adhar@Number, none, 70outofseventy, mutable

3. Consider the coding given below and fill in the blanks: 1


Dict_d={‘BookName’:’Python’,’Author’:”Arundhati Roy”}
Dict_d.pop() # Statement 1
List_L=[“java”,”SQL”,”Python”]
List_L.pop() # Statement 2
(i) In the above snippet both statement 1 and 2 deletes the last element
from the object Dict_d and List_L________(True/False).
(ii) Statement_______(1/2) alone deletes the last element in its object.

4. Evaluate the following expression: 1


False and bool(15/5*10/2+1)

Page 1 of 14
5. Write the output for the following python snippet. 1
LST=[1,2,3,4,5,6]
for i in range(6):
LST[i-1]=LST[i]
print(LST)

6. Out of the following file mode which opens the file and delete all its contents 1
and place the file pointer at the beginning of the file.
(a) a (b) w (c) r (d) a+

7. (a) In an SQL table, if the primary key is combination of more than one 1
field, then it is called as _____________.
(b) _________ command is used to make an existing column as a primary
key.

8. In MYSQL state the commands used to delete a row and a column 1


respectively
(a) DELETE,DROP
(b) DROP,DELETE
(c) DELETE,ALTER
(d) ALTER,DROP

9. Debug the following code and underline the correction made: 1


d=dict{}
n=input("enter number of terms")
for i in range(n):
a=input("enter a character")
d[i]=a

10. In MYSQL _____ clause applies the condition on every ROW and ______ 1
clause applies the condition on every GROUP.

11. Complete the following snippet to open the file and create a writer object for 1
a csv file “emp.csv” with delimiter as pipe symbol ‘|’ to add 5 more records
into the file using the list named “e_rec”.
emp_file=___________
csv_writer=csv.writer( ____________ )

12. _________ Operator is used to compare NULL value in MYSQL table. 1


(a) = = (b) IN (c) IS (d) LIKE

Page 2 of 14
13. Name any two protocols used for video conferencing. 1

14. Write output for the following code: 1


list1=[x+2 for x in range(5)]
print(list1)

15. Which command is used to display the structure of the table? Write the 1
syntax of the command.

16. Which function of mysql.connector library lets you check if the connection 1
to the database is established or not?
(a) connectionobject.is_connected()
(b) mysql.connector,connect()
(c) mysql.connector()
(d) mysql.connector

Q17 and Q18 are ASSERTION and REASONING based questions.


Mark the correct choice as
(a) Both A and B are true and R is the correct explanation for A.
(b) Both A and R are true and R is not the correct explanation for A.
(c) A is True but R is False
(d) A is False but R is True

17. Assertion(A) : 1
When we open the file in write mode the content of the file will be erased if
the file already exist.
Reasoning(R):
Open function will create a file if does not exist, when we create the file both
in append mode and write mode.

18. Assertion(A): 1
Keyword argument were the named arguments with assigned values being
passed in the function call.
Reasoning (R):
Default arguments cannot be skipped while calling the function while
keyword arguments are in function call statement.

SECTION B

19. Mr. Gupta wants to print the city he is going to visit and the distance to 2
reach that place from his native. But his coding is not showing the correct

Page 3 of 14
output debug the code to get the correct output and state what type of
argument he tried to implement in his coding.
def Travel(c,d)
print(“Destination city is “,city)
print(“Distance from native is “,distance)
Travel(distance=”18 KM”,city=”Tiruchi”)

20. What is meant by domain name? Give an example 2


OR
List any two difference between bridge and router.

21. Write the output for the following python code: 2


def Change_text(Text):
T=""
for K in range(len(Text)):
if Text[K].isupper():
T=T+Text[K].lower();
elif K%2==0:
T=T+Text[K].upper()
else:
T=T+T[K-1]
print(T)
Text="Good go Head"
Change_text(Text)

22. What is the difference between Equi join and Natural join? Give an Example 2

23. (a) Expand the following: 2


(i) IMAP (ii) HTTPS
(b) What is meant by interspace?

24. Write the output for the following python code: 2


def Quo_Mod (L1):
L1.extend([33,52])
for i in range(len(L1)):
if L1[i]%2==0:
L1[i]=L1[i] /5
else:

Page 4 of 14
L1[i]=L1[i]%10
L=[100,212,310]
print(L)
Quo_Mod(L)
print(L)
OR
What possible outputs are expected to be displayed on screen at the time of
execution of the program from the following code? Also specify the
maximum value that can be assigned to each of the variables L and U.
import random
Arr=[10,30,40,50,70,90,100]
L=random.randrange(1,3)
U=random.randrange(3,6)
for i in range(L,U+1):
print(Arr[i],"@",end="")
(i) 40 @50 @ (ii) 10 @50 @70 @90 @
(iii) 40 @50 @70 @90 @ (iv) 40 @100 @

25. What is the difference between column constraint and table constraint? Give 2
an example.
OR
What is the difference between LIKE and IN operator in MYSQL. Give an
example.

SECTION C

26. (a) Consider the following tables FACULTY and STUDENT. Write the 3
output for the MYSQL statement given below and state what type of join
is implemented.
SELECT * FROM FACULTY,STUDENT

FACULTY STUDENT

Faculty_Id Name
Stu_id Stu_Name
F100 Govardhan
12101 Anitha
F101 Janet
12102 Vishnu
F102 Rithu

Page 5 of 14
(b) Write the output for the queries (i) to (iv) based on the table given
below.
SPOTRS

S_ID SNAME FEES START_DT No_of_Players

S1 Foot Ball 5000 2015-01-10 25

S2 Basket Ball 4000 2016-10-10 30

S3 Volley Ball 5000 2017-02-02 25

S4 Kho-Kho 5500 2017-03-20 40

S5 Basket Ball 6000 2016-02-15 50

(i) SELECT MAX(FEES),MIN(FEES) FROM SPORTS.


(ii) SELECT COUNT(DISTINCT SNAME) FROM SPORTS.
(iii) SELECT SNAME,SUM(No_of_Players) FROM SPORTS
GROUP BY SNAME.
(iv) SELECT AVG(FEES*No_of_Players) FROM SPORTS WHERE
SNAME=”Basket Ball”.

27. Write a function named COUNT_CHAR() in python to count and display 3


number of times the arithmetic operators(+,-,*,/) appears in the file
“Math.txt” .
Example:
Solve the following:
1.(A+B)*C/D
2.(A-B)*(A+B)/D-(E/F)
3. A+B+C/D*(E/F)
The function COUNT_CHAR() must display the output as
Number of ‘+’ sign is 4
Number of ‘-‘ sign is 2
Number of ‘*’ sign is 3
Number of ‘/’ sign is 5
OR
Write a function V_COUNT() to read each line from the text file and count
number of lines begins and ends with any vowel.

Page 6 of 14
Example:
Eshwar returned from office and had a cup of tea.
Veena and Vinu were good friends.
Anusha lost her cycle.
Arise! Awake! Shine.
The function must give the output as:
Number of Lines begins and ends with a vowel is 3

28. (a) Write the SQL Queries for (i) to (iii) based on the table EMPLOYEE 3
and DEPARTMENT.
EMPLOYEE

EMP_ID Name DEPT JOIN_DT SALARY

E1 Vanitha 101 2015-01-01 50000

E2 Karthika 102 2015-02-01 75000

E3 Prathiba 103 2014-01-05 85000

E4 Mihika 101 2016-06-10 100000

E5 Mridula 102 2014-10-15 95000

DEPARTMENT

DEPT_ID D_NAME

101 Production

102 Sales

103 Marketing

(i) To display department name and number of employees in each


department where no of employees is greater than one.
(ii) To display department name and sum of the salary spent by the
department, where the total amount spent by the department as
salary is more than 100000.
(iii) To display the name of the employee in descending order of their
seniority.

Page 7 of 14
29. Write a function DIVI_LIST() where NUM_LST is a list of numbers passed 3
as argument to the function. The function returns two list D_2 and D_5 which
stores the numbers that are divisible by 2 and 5 respectively from the
NUM_LST.
Example:
NUM_LST=[2,4,6,10,15,12,20]
D_2=[2,4,6,10,12,20]
D_5=[10,15,20]

30. Mohammed has created a dictionary containing names and marks of 3


computer science as key, value pairs of 5 students. Write a program, with
separate user defined functions to perform the following operations:

● Push the keys (name of the student) of the dictionary into a stack, where
the corresponding value (CS marks) are more than or equal to 90 .

● Pop and display the content of the stack, if the stack is empty display the
message as “UNDER FLOW”
For example: If the sample content of the dictionary is as follows:
CS={"Raju":80, "Balu":91, "Vishwa":95, "Moni":80, “Govind":90}
The push operatio’s output from the program should be:
Balu Vishwa Govind
The pop operation must display
Govind
Vishwa
Balu
“UNDER FLOW”
OR
Dev Anand have a list of 10 numbers. You need to help him create a program
with separate user defined functions to perform the following operations
based on this list.
● Traverse the content of the list and push the numbers divisible by 5 into
the stack.
● Pop and display the content of the stack, if the stack is empty display the
message” STACK EMPTY”
For Example:
If the sample Content of the list is as follows:
N=[2,5,10,13,20,23,45,56,60,78]
After the push operation the list must contain

Page 8 of 14
5,10,20,45,60
And pop operation must display the output as
60
45
20
10
5
STACK EMPTY

31. A professional consultancy company is planning to set up new offices in 5


India with its hub at Chennai. As a network adviser, you have to understand
their requirements and suggest to them the best available solutions.

Distance between Blocks in (Mtrs)

Human Resources - Conference 60

Human Resources - Finance 60

Conference - Finance 120

Expected Number of Computers to be installed in each block:

Block Computers

Human Resources 125

Conference 25

Finance 60

Page 9 of 14
(a) Suggest the most appropriate block where the organization should plan
to install their server?
(b) Draw a block-to-block cable layout to connect all the buildings in the
most appropriate manner for efficient communication.
(c) What will be the best possible connectivity out of the following to
connect the new set-up of offices in Chennai with its London base office?
(i) Infrared (ii) Satellite Link (iii) Ethernet Cable
(d) Which of the following devices will you suggest to connect each
computer in each of the above buildings?
(i) Gateway (ii) Switch (iii) Modem
(e ) Suggest a device/software to be installed for data security in the campus.

32. (a) Find the output for the following python code: 2+3

def LST_ARG(L1):
L2=L1
L3=[0,0,0,0]
print("L2->",L2)
print("L3->",L3)
j=0
L1.append(51)
for i in range(len(L1)):
if L1[i]%5==0:
L2[j]=L2[j]*L2[j]
L3[j]=L2[j]%5
j+=1
print("L1->",L1)
print("L2->",L2)
print("L3->",L3)

L1=[10,15,20]
LST_ARG(L1)
print("L1->",L1)

(b) The Python program establishes connection between python and mysql,
and display the students details where the marks were between 80 to 90.
Write the missing statement to complete the code.

Page 10 of 14
Statement 1 – to check whether connection is not established.
Statement 2 – to create cursor object.
Statement 3 – to retrieve all the data from the cursor object.

import mysql.connector
conn=mysql.connector.connect(host="localhost",user="root",passwd="123
45",database="student")
if______________ # Statement 1
print("Error connecting to MYSQL DATABASE")
________________ # Statement 2
c.execute("select * from student where marks>80 and marks<90")
_____________ # Statement 3
count=c.rowcount
print("total no of rows:",count)
for row in r:
print(row)
OR
(a) Find the output for the following python code :

def OUTER(Y,ch):
global X,NUM
Y=Y+X
X=X+Y
print(X,"@",Y)
if ch==1:
X=inner_1(X,Y)
print(X,"@",Y)
elif ch==2:
NUM=inner_2(X,Y)
def inner_1(a,b):
X=a+b
b=b+a
print(a,"@",b)
return a
def inner_2(a,b):
X=100

Page 11 of 14
X=a+b
a=a+b
b=a-b
print(a,"@",b)
return b
X=100
NUM=1
OUTER(NUM,1)
OUTER(NUM,2)
print(NUM,"@",X)

(b) Consider the following Python code is written to access the details of
employee, whose employee number is given:
Complete the missing statements:
Statement 1 – To create a cursor object to execute the query.
Statement 2 – To execute the query stored in the variable change.
Statement 3 – To make the changes in the database physically.
def Search():
import mysql.connector
mydb=mysql.connector.connect(host="localhost",user="root",
passwd="system",database="DB")
_______________ # Statement 1
change="update employee set salary=salary+5000 where empno=
1011"
_______________ # Statement 2
______________ # Statement 3
results = mycursor.fetchall()
print(results)

33. What is the use of seek() function ? Write a python program that defines and 5
calls the following user defined functions.
Add_book() – To read the details of the books from the user and write into
the csv file named “book.csv”. The details of the books stored in a list are
book_no,name,author.
Search_book() - To read the author name from the user and display the books
written by the author.
OR

Page 12 of 14
How to open the file using with statement? Write a python program that
defines and calls the user defined functions given below.
Add_rating() – To read product name and rating from the user and store the
same into the csv file “product.csv”
Display() – To read the file “product.csv” and display the products where the
rating is above 10.

SECTION E

34. Naveen created a table SALES_DONE to maintain the sales made by his
sales department. The table consists of 10 employees records. To record 1+1+2
every months sales he is adding a new column with first three characters of
that month.

EMP_NO NAME ACCT_NO Jan Feb

101 Naren Kumar 105231 150 300

102 Jaya Deep 510423 120 140

103 Naveen Kumar 20146 210 250

104 Srinikethan 698751 210 140

105 Tharun Venkat 564132 220 230

Based on the above table answer the following questions:


(i) Identify the candidate key, primary key from the above table.
(ii) He added two more employee in the month of February and if a new
column is added for each month, at the end of May month what is the degree
and cardinality of the table.
(iii) Write the SQL statement to do the following
(a) Insert the following record into the above table.
106,”Venkatesh Gour”,256489,200,300
(b) Change the name of the employee as Sri Nikethan” whose emp no is
104.
OR (option for part iii only)
(iii) Write the MYSQL statement for the following
(a) Add a new column Total_sales of type integer with NOT NULL
constraint.
(b) Fill the column Tot_sales by adding values in Jan and Feb columns.

Page 13 of 14
35. Mrs.Renu wrote a python program to update the salary of the employee by 4
reading the employee number. She got some errors while executing the
program so she deleted those lines. As a python programmer guide her to fill
the missing statements.
_____________ # Statement 1
def modify():
e=[ ]
____________ # Statement 2
found=False
T_eno=int(input("enter employee no"))
try:
while True:
____________ # Statement 3
e=pickle.load(f)
if e[0] == T_eno:
e[2]=float(input("enter new salary"))
f.seek(pos)
__________ # Statement 4
found=True
except:
f.close()
if found==True:
print("employee record found and updated")
else:
print("employee record not found and updating not possible")

(i) Write the statement to import the needed module.


(ii) Write the statement to open the file named “emp.bin” as per the
need of the code.
(iii) Write the statement to store the position of the file pointer.
(iv) Complete the blank with the statement to write the object “e” into
the file.

“End of Paper”

Page 14 of 14

You might also like