13th 14th and 15th Paper
13th 14th and 15th Paper
13th 14th and 15th Paper
SECTION-A
1. Name the Python library module needed to be imported to invoke following functions: 1
a. floor ( )
b. randomint ( )
2. To use function of any module, we have to use (command) before the use 1
of function of a module
3. Identify the key and values from the dictionary given below? 1
a. D = {“Rohan”:{“Manager”:427, “SBI”, 05884 } }
4. Which of the following is/are not assignment operator? 1
a) **= b) /= c) == d) %=
5. Find the output of the code: 1
num = 7
def func ( ) :
num = 27
print(num)
6. Which statement is used to retrieve the current position within the file: 1
a. fp.seek( ) b. fp.tell( ) c. fp.loc d. fp.pos
7. Clause used in select statement to collect data across multiple records and group the 1
results by one or more columns:
a. order by
b. group by
c. having
d. where
8. Which keyword eliminates redundant data from a SQL query result? 1
9. What does the following code print to console? 1
if True:
print(50)
else:
print(100)
a. True b. False c.50 d.100
10. Fill in the blank: 1
No. of rows in a relation is called ………………….. .
(a) Degree b. Domain c. Cardinality d. Attributes
11. Which of the following is not a correct Python statement to open a test file “Students.txt” 1
to write content into it :
a. f= open(“Students.txt”, ‘a’)
b. f= open(“Students.txt”, ‘w’)
c. f= open(“Students.txt”, ‘w+’)
d. f= open(“Students.txt”, ‘A’)
Q17 and 18 are ASSERTION AND REASONING based questions. Mark the correct choice as
(a) Both A and R 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): Dictionaries are enclosed by curly braces { } 1
Reason(R): The key-value pairs are separated by commas ( , )
18. Assertion(A): The random module is a built-in module to generate the pseudo-random 1
variables.
Reason(R): The randrange() function is used to generate a random number between the
specified range in its parameter.
SECTION-B
19. Yuvika has to complete her computer science assignment of demonstrating the use of if-else 2
statement. The code has some error(s). Rewrite the correct code underlining all the
corrections made.
marks = int(“enter marks”)
temperature = input(“enter temperature”)
if marks < 80 and temperature >= 40
print(“Not Good”)
else
print(“OK”)
20. Write a short note on web hosting. 2
OR
What is work of TCP / IP explain.
21. Write the output after evaluating he following expressions: 1
a) k= 7 + 3 **2 * 5 // 8 – 3
print(k)
b) m= (8>9 and 12>3 or not 6>8)
print(m) 1
22. What do you understand by table constraint in a table? Give a suitable example in support 2
of your answer.
23. Expand the following terms: 2
a. PAN b. HTML c. URL d. POP
24. Predict the output of the Python code given below: 2
def func(n1 = 1, n2= 2):
n1= n1 * n2
n2= n2 + 2
print(n1, n2)
func( )
func(2,3)
OR
26. (a) Observe the following table and answer the question accordingly 1+2
Table:Product
Pno Name Qty PurchaseDate
101 Pen 102 12-12-2011
102 Pencil 201 21-02-2013
103 Eraser 90 09-08-2010
109 Sharpener 90 31-08-2012
113 Clips 900 12-12-2011
What is the degree and cardinality of the above table?
(b) Write the output of the queries (i) to (iv) based on the table, STUDENT given
below: S.NO NAME STIPEND SUBJECT AVERAGE DIV
1 KARAN 400 PHYSICS 68 I
2 DIWAKAR 450 COMP Sc 68 I
3 DIVYA 300 CHEMISTRY 62 I
4 REKHA 350 PHYSICS 63 I
5 ARJUN 500 MATHS 70 I
6 SABINA 400 CHEMISTRY 55 II
7 JOHN 250 PHYSICS 64 I
8 ROBERT 450 MATHS 68 I
9 RUBINA 500 COMP Sc 62 I
10 VIKAS 400 MATHS 57 II
(i) Select MIN(AVERAGE) from STUDENT where SUBJECT=”PHYSICS”;
(ii) Select SUM(STIPEND) from STUDENT WHERE div=’II’;
(iii) Select AVG(STIPEND) from STUDENT where AVERAGE>=65;
(iv) Select COUNT(distinct SUBJECT) from STUDENT;
Write a function count( ) in Python that counts the number of “the” word present in a text
file “STORY.TXT”.
If the “STORY.TXT” contents are as follows:
This is the book I have purchased. Cost of the book was Rs. 320.
Then the output will be : 2
28. (a) Write the outputs of the SQL queries (i) to (iii) based on the tablesEmp: 3
29. Write definition of a Method MSEARCH(STATES) to display all the state names from a 3
list of STATES, which are starting with alphabet M.
For example:
If the list STATES contains[“MP’,”UP”,”MH”,”DL”,”MZ”,”WB”]
The following should get displayed
MP
MH
MZ
30. Write a function in Python push(S,item), where S is stack and item is element to be 3
inserted in the stack.
OR
Write a function in Python pop(S), where S is a stack implemented by a list of items. The
function returns the value deleted from the stack.
SECTION-D
31. A software organization has to set up its new data center in Chennai. It has four blocks of
buildings – A, B, C and D.
32. (a) Find and write the output of the following python code: 2+3
def change(s):
k=len(s)
m=" "
for i in range(0,k):
if(s[i].isupper()):
m=m+s[i].lower()
elif s[i].isalpha():
m=m+s[i].upper()
else:
m=m+'is'
print(m)
change('kv@onTHEtop')
(b) The given program is used to connect with MySQL abd show the name of the all the
record from the table “stmaster” from the database “oraclenk”. You are required to
complete the statements so that the code can be executed properly.
import .connector pymysql
dbcon=pymysql. (host=”localhost”, user=”root”,
=”kvs@1234”)
if dbcon.isconnected()==False
print(“Error in establishing
connection:”) cur=dbcon. ()
OR
(a) Write output of the following
code: def func(a):
s=m=n=0
for i in (0,a):
if i%2==0:
s=s+i
elif i%5==0:
m=m+i
else:
n=n+i
print(s,m,n)
func(15)
(b) Avni is trying to connect Python with MySQL for her project. Help her to write
the python statement on the following:-
(i) Name the library, which should be imported to connect MySQL with Python.
(ii) Name the function, used to run SQL query in Python.
(iii) Write Python statement of connect function having the arguments values
as: Host name :192.168.1.101
User : root
Password:
Admin
Database : KVS
33. Divyanshi writing a program to create a csv file “a.csv” which contain user id and 5
name of the beneficiary. She has written the following code. As a programmer help
her to successfully execute the program.
import #Line 1
with open('d:\\a.csv','w') as
newFile:
newFileWriter = csv.writer(newFile)
newFileWriter.writerow(['user_id','beneficiary'])
newFileWriter. ([1,'xyz']) #Line2
newFile.close()
35. (a) What is the difference between 'w' and 'a' modes? 1+1+2
Anshuman is a Python learner, who has assigned a task to write python
Codes to perform the following operations on binary files. Help him in writing codes to
perform following tasks (b) & (c):
(b) Write a statement to open a binary file named SCHOOL.DAT
in read mode. The fileSCHOOL.DAT is placed in D: drive.
(c) Consider a binary file “employee.dat” containing details such
as empno:ename:salary (separator ':'). Write a python function
to display details of those employees who are earning between 20000 and 30000 (both
values inclusive).
SAMPLE PAPER SET 14
CLASS – XII SUBJECT: Computer Science-083
Total Time- 3 Hours Total Marks- 70
------------------------------------------------------------------------------------------------------------------------------------------
General Instructions:
1. This question paper contains five sections, Section A to E.
2. All questions 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 Q35 against part c only.
8. All programming questions are to be answered using Python Language only.
7 A tuple is declared as T = (20,5,16,29,83) What will be the problem with the code 1
T[1]=100
8 Name the built-in mathematical function / method that is used to return greatest 1
common divisor of x and y.
9 Identify the data type of X: 1
X = tuple(list( (1,2,3,4,5) ) )
11 Sunita executes following two statements but got the variation in result 6 and 5 why? 1
(i) select count(*) from user ;
(ii) select count(name) from user ;
13 Write a command to add new column marks in table ‘student’ data type int. 1
17 Assertion (A): writerow( ) function helps us to write multiple rows in a csv file at a 1
time.
Reason (R) : Writing one row at a time in a csv file is not possible, we must write
multiple rows at a time.
18 Assertion (A) : With statement can be used to open any file, be it csv file or 1
binary file and while using with statement to open any file there is no need to close the
file.
Reason (R) : With statement groups all the statements related to file handling and
makes sure to close the file implicitly. It closes the file even when any error occurs
during the execution of statements in a with statement.
Attempt any 4 sub parts from each question. Each question carries 1 mark
19 A school KV is considering to maintain their eligible students’ for scholarship’s data using SQL 4
to store the data. As a database administer, Abhay has decided that:
• Name of the database - star
• Name of the table - student
• The attributes of student table as follows:
No. - numeric
Name – character of size 20
Stipend - numeric
Stream – character of size 20
AvgMark – numeric
Grade – character of size 1
Class – character of size 3
Table ‘student’
No. Name Stipend Stream Avgmarks Grade Class
1 Karan 400.00 Medical 78.5 B 12B
2 Divakar 450.00 Commerce 89.2 A 11C
3 Divya 300.00 Commerce 68.6 C 12C
4 Arun 350.00 Humanities 73.1 B 12C
5 Sabina 500.00 Nonmedical 90.6 A 11A
6 John 400.00 Medical 75.4 B 12B
7 Robert 250.00 Humanities 64.4 C 11A
8 Rubina 450.00 Nonmedical 88.5 A 12A
9 Vikas 500.00 Nonmedical 92.0 A 12A
10 Mohan 300.00 Commerce 67.5 C 12C
(b) In which mode, Ranjan should open the file to add data into the file.
(c) Fill in the blank in Line 3 to read the data from a csv file.
a) 6 * 3 + 4**2 // 5 – 8
What is scope of a variable in python and write basic scopes of variables in Python
23 Rewrite the following code in python after removing all syntax errors. Underline each 2
correction done in the code:
Def func(a):
for i in (0,a):
if i%2 =0:
s=s+1
else if i%5= =0
m=m+2
else:
n=n+i
print(s,m,n)
func(15)
24 What possible outputs(s) are expected to be displayed on screen at the time of execution of 2
the program from the following code. Select which option/s is/are correct import random
print(random.randint(15,25) , end=' ')
print((100) + random.randint(15,25) , end = ' ' )
print((100) -random.randint(15,25) , end = ' ' )
print((100) *random.randint(15,25) )
(i) 15 122 84 2500 (ii) 21 120 76 1500
(iii) 105 107 105 1800 (iv) 110 105 105 1900
OR
Predict the output of the following code.
def swap(P ,Q):
P,Q=Q,P
print( P,"#",Q)
return (P)
R=100
S=200
R=swap(R,S)
print(R,"#",S)
26 Write the steps to perform an Insert query in database connectivity application. Table 2
‘student’ values are rollno, name, age (1,’AMIT’,22)
27 Define: 2
1. Repeater 2. Router
28 Differentiate between web server and web browser. Write name of any two browsers. 2
29 Write a function listchange(Arr)in Python, which accepts a list Arr of numbers, the function 3
will replace the even number by value 10 and multiply odd number by 5. Sample Input Data
of the list is:
a=[10,20,23,45]
listchange(a,4)
output : [10, 10, 115, 225]
30 Write a Python program to find the number of lines in a text file ‘abc.txt’. 3
OR
Write a Python program to count the word “if” in a text file abc.txt’.
31 Write the outputs of the SQL queries (i) to (iii) based on the relations Client and Product given 3
below:
Client:
C_ID ClientName City P_ID
01 Cosmetic Shop Delhi TP01
02 Total Health Mumbai FW05
03 Live Life Delhi BS01
04 Pretty Woman Delhi SH06
05 Dreams Delhi TP01
Products:
P_ID ProductName Manufacturer Price Discount
TP01 Talcum LAK 40
Powder
FW05 Face Wash ABC 45 5
BS01 Bath Soap ABC 55
SH06 Shampoo XYZ 120 10
FW06 Face Wash XYZ 95
RollNo – integer
Name – string
Clas – integer
Marks – integer
35 My Pace University is setting up its academic blocks at Naya Raipur and is planning to set up a 5
network. The University has 3 academic blocks and one Human Resource Center as shown in
the diagram below:
function countrec() in Python that would read contents of the file “STUDENT.DAT” and
display the details of those students whose percentage is above 75. Also display number of
OR
A binary file “Stu.dat” has structure (rollno, name, marks). (i) (ii)
I) Write a function in Python add_record() to input data for a record and add to
Stu.dat.
II) Write a function in python Search record() to search a record from binary file
*****
SAMPLE PAPER SET 15
CLASS – XII SUBJECT: Computer Science-083
Total Time- 3 Hours Total Marks- 70
General Instructions:
1. This question paper contains five sections – A to E
2. All questions are compulsory
3. Section A, consists of 18 questions carrying 1 marks 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 Q35 against c
part only.
8. All programming questions are to be answered using Python Language only`
Section-A
(Each question carries 1 mark from question no. 1 to 16)
Q. NO. QUESTION MAR
KS
1 Which of the following is an invalid variable? 1
(a) hello_world_2
(b) 2_hello_world
(c) day_two
(d) _2
2 What data type is the object below? 1
L=1, 'hello',23.5
(a) List
(b) dictionary
(c) tuple
(d) array
(Assertion Reasoning type question - Each question carries 1 marks from question no.
17 to 18)
Q18: Assertion(A): To remove the middle element 3 from the list L= [1,2,3,4,5] the statement 1
L.remove (3) can be used.
Reason(R): The function remove will delete the element 4 in the list as it is placed on the
index no 3.
(a) Both A and R are true and R is the correct explanation of A.
(b) Both A and R are true, but R is not the correct explanation of A.
(c) A is true, but R is false.
(d) A is false, but R is true.
Section-B
(Very short answer question -Each question carries 2 marks from question no. 19 to 26)
32 Which functions can be used as the group functions? What is the use of GROUP BY 3
clause? How are they useful?
Section-D
(Long answer -Each question carries 5 marks from question no. 33 to 34)
33 Write a program to get student data (rollno., name and marks) from user until user 5
wants to add data. Then search for records with roll no 12 or 14. If found display the
records else display an appropriate message.
34 (a) Give one advantage and one disadvantage of optical fibre cable. 5
(b) Differentiate between Tree and Bus topologies of network.
(c) What do email and FTP mean?
(d) Differentiate between repeater and bridge.
(e) Give full form of NFS and FTP.
Section-E
(Case –Study Questions -Each question carries 4 marks from question no. 35 to 36)
35 Rohit, a student of class 12, is learning CSV File Module in Python. During examination, 4
he has been assigned an incomplete python code (shown below) to create a CSV File
'Student.csv' (content shown below). Help him in completing the code which creates the
desired CSV File. Do any 4 out of 5.
CSV File
1,AKSHAY,XII,A
2,ABHISHEK,XII,A
3,ARVIND,XII,A
4,RAVI,XII,A
5,ASHISH,XII,A
Incomplete Code
import #Statement-1
fh = open( , , newline='') #Statement-2
stuwriter = csv. #Statement-3
data = [ ]
header = ['ROLL_NO', 'NAME', 'CLASS', 'SECTION']
data.append(header)
for i in range(5):
roll_no = int(input("Enter Roll Number : "))
name = input("Enter Name : ")
Class = input("Enter Class : ")
section = input("Enter Section : ")
rec = [ ]#Statement-4
data.append( ) #Statement-5
stuwriter. (data) #Statement-6
fh.close()
(i) Identify the suitable code for blank space in the line marked as Statement-1.
(ii) Identify the missing code for blank space in line marked as Statement-2.
(iii) Write the function name (with argument) that should be used in the blank space of
line marked as Statement-3. OR Identify the suitable code for blank space in line marked
as Statement-4.
(iv) Identify the suitable code for blank space in the line marked as Statement-5
36 Write SQL commands for the following queries (i) to (iv) based on the relations Shoppe 4
and Accessories given below:
(i)to display name and price of all the accessories in descending order of their price.
(ii)to display id and sname of all shoppe located in nehru place.
(iii) to display minimum and maximum price of each name of accessories.
(iv) to display name, price of all accessories and their respective sname where they
are available.