Comp. Sc. Sample Paper-5
Comp. Sc. Sample Paper-5
CLASS :XII
SUBJECT : COMPUTER SCIENCE (83)
Time Allowed :03 Hours Maximum Marks : 70
General Instructions
M
2. All questions are compulsory.
3. Section A has 21 questions (1 to 21) carrying 01 mark each.
O
4. Section B has 07 Very Short Answer type questions (22 to 28) carrying 02 marks each.
C
5. Section C has 03 Short Answer type questions (29 to 31) carrying 03 marks each.
E.
6. Section D has 04 Long Answer type questions (32 to 35) carrying 04 marks each.
7. Section E has 02 questions (36 to 37) carrying 05 marks each.
BS
8. All programming questions are to be answered using Python Language only.
9. In case of MCQ, text of the correct answer should also be written.
Q.No Question
4C
SECTION-A (21*1=21 Marks)
N
Marks
1. State True or False 1
O
Choose one option from the following that will be the correct output after
executing the above python expression.
a) False b) True c) or d) not
E
1 | Page
print(2**3**2)
a) 64 b) 256 c) 512 d) 32
9. Which of the following statement(s) would give an error after executing the 1
following code?
S="Welcome to class XII" #Statement 1
print(S) # Statement 2
S="Thank you" #Statement 3
S[0]= '@' #Statement 4
S=S+"Thank you" #Statement 5
(a) Statement 3 (b) Statement 4
(c) Statement 5 (d) Statement 4 and 5
10. Which of the following option is the correct python statement to read and display 1
the first 10 characters of a text file “Notes.txt”?
(a) F=open(‘Notes.txt’) (b) F=open(‘Notes.txt’)
M
print(F.load(10)) print(F.dump(10))
O
(c) F=open(‘Notes.txt’) (d) F=open(‘Notes.txt’)
C
print(F.read(10)) print(F.write(10))
E.
11. Which Python approach is used for object serialization in handling of Binary File? 1
BS
(a) Pickling (b) Un-pickling (c) Merging (d) None of these
12. In the given program, identify which are local and global variables? 1
def change():
4C
N
n=10
O
x=5
TH
print( x)
a) n and x both are local variables b) n and x both are global variables
PY
15. Which SQL function returns the sum of values of a column of numeric type? 1
.L
16 Which of the following is not valid cursor function while performing database 1
operations using python. Here Mycur is the cursor object?
W
2 | Page
(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
20. Assertion (A): A variable declared as global inside a function is visible outside 1
the function with changes made to it inside the function.
Reasoning (R): global keyword is used to change the value of a global variable.
21. Assertion (A): COUNT(*) function count the number of rows in a relation. 1
Reasoning (R): DISTINCT ignores the duplicate values.
SECTION-B (7 * 2= 14 Marks)
22. Which of the following can be used as valid identifier(s) in Python? 2
(i) Total (ii) @selute (iii) Que$tion (iv) great
M
th
(v) 4 Sem (vi) li1 (vii) No# (viii) _Data
23. (i)Write the names of any two data types available in python. 1+1=2
O
(ii)Write any 2 operators name used in python.
C
24. Write the Python statement for each of the following tasks using BUILT_IN 1+1=2
functions/ methods only:
E.
i) str="PYTHON@LANGUAGE"
BS
(A) To print the above string from index 2 onwards.
OR
(B) To initialize an empty dictionary named as d.
4C
ii) Write the Python statement for each of the following tasks using BUILT_IN
N
functions/ methods only:
(A) s=”LANGUAGE"
O
OR
(B) To initialize an empty tuple named as t.
PY
25. Find possible o/p (s) at the time of execution of the program from the following code? 2
Also specify the maximum values of variables Lower and Upper.
import random as r
N
Lower =r.randint(1,3)
Upper =r.randint(2,4)
E
27. (i) 2
A) What constraint should be applied on a table’s column to provide it the
W
(ii)
A) Write an SQL command to add one more column in previously defined
table, named CELL. Column name is CELL_ID with size 10 of integer
type should be added in the table.
OR
B) Write an SQL command to permanently remove the table CELL from
database.
3 | Page
28. A) Write the full forms of the URL and VoIP and their utility? 2
OR
B) Mention any two differences between IP and MAC address in networking.
SECTION-C (3*3= 9 Marks)
29. A) Write a method /function countlines_et () in python to read lines from a text file 3
report.txt, and COUNT those lines which are starting either with ‘E’ and starting
with ‘T’ respectively. And display the Total count separately.
For example: if REPORT.TXT consists of
“THE PROGRAMMING IS FUN FOR PROGRAMMER.
ENTRY LEVEL OF PROGRAMMING CAN BE LEARNED FROM USEFUL FOR
VARIETY OF USERS.”
Then,
Output will be: No. of Lines with E: 1 No. of Lines with T: 1
OR
M
B) Write a method/function show_todo():in python to read contents from a text file
abc.txt and display those lines which have occurrence of the word “ TO” or “DO”
O
For example:
C
If the content of the file is
“THIS IS IMPORTANT TO NOTE THAT SUCCESS IS THE RESULT OF HARD WORK.
E.
WE ALL ARE EXPECTED TO DO HARD WORK.
AFTER ALL EXPERIENCE COMES FROM HARDWORK.”
BS
The method/function should display:
4C
THIS IS IMPORTANT TO NOTE THAT SUCCESS IS THE RESULT OF HARD WORK.
WE ALL ARE EXPECTED TO DO HARD WORK.
N
30. A) 3
O
A list of numbers is used to populate the contents of a stack using a function
push(stack, data) where stack is an empty list and data is the list of numbers. The
TH
function should push all the numbers that are even to the stack.
PY
Write the function pop(stack) that removes the top element of the stack on its each
call.
N
OR
B)
E
The function should push the names of those events in the stack named ‘BigEvents’
which have number of persons greater than 200. Also display the count of elements
W
Write the function pop(EventDetails) that removes the top element of the stack on
its each call.
For example:
4 | Page
Marriage
Graduation Party
M
O
Based on the table given above write the SQL Queries:
C
A)
E.
(i) To Display the Emp_Name and Gross_salary of each employee.
(Gross= basic+da+hra+nps)
BS
(ii) To Increase the DA by 3% of respective basic salary of all
employees.
4C
(iii) To Delete the Attribute emp_desig from the table.
OR
N
B)
O
32 A) 1+3=4
AR
ii) Give an example code to handle IndexError? The code should display the
E
message “list index out of range is not allowed” in case of IndexError Exception,
.L
and the message “Some Error occured” in case of any other Exception.
OR
W
B)
W
ii) Write a function division( ) that accepts two arguments. The function should be
able to catch an exception such as ZeroDivisionError Exception, and the message
“Some Error occured” in case of any other Exception.
33 Aman has recently been given a task on CAPITAL.CSV which contains Country and 2+2=4
. Capital as data for records insertion.
5 | Page
34 Write the SQL queries (i) to (iv) based on the relations SCHOOL and ADMIN given 4
. below:
M
O
C
E.
BS
Write SQL queries for the following:
4C
i) Display total periods subjectwise by framing groups based on subject.
N
ii) Display minimum experience and maximum code from relation SCHOOL.
O
iii)Display teachername, gender by joining both tables on the basis of code
ATTRIBUTE and the designation should be “COORDINATOR.
TH
iv)
(A) Display the total number of different subjects in school relation.
PY
OR
(B) To display the total number of Males and Females separately with gender in
N
ADMIN table.
35 4
AR
Age– integer
.L
Salary – integer
W
● Password - tiger
W
● Host - localhost
● The Emp table exists in a MYSQL database named company.
● The details (EmpNo, EmpName, Age and Salary) are to be accepted
from the user.
Aarya wants to display All Records of Emp relation whose age is greater than 55.
Help Aarya to write program in python
SECTION-E (2*5= 10 Marks)
36 i. What is Binary File? 1+2+
ii. Consider a binary file stock.dat that has the following data: OrderId, 2=5
MedicineName,Qty and Price of all the medicines of wellness medicos, write the
following functions:
a) AddOrder() that can input all medicine orders.
b) DisplayPrice() to display details of all medicine that have Price more than 500.
6 | Page
37 Hitech Info Limited wants to set up their computer network in Bangalore 5
based
campus having four buildings. Each block has a number of computers
that are required to be connected for ease of communication, resource sharing and
data security.
You as a network expert have to suggest answers to these parts (a) to (e) raised
by them.
DEVELOPMENT HUMANRESOURCE
KVS
LOGISTICS ADM
RO
Shortest distances between various blocks Jaipur
Block DEVELOPMENT to Block HUMANRESOURCE -- 50 m
M
Block DEVELOPMENT to Block ADM-- 75 m
O
Block DEVELOPMENT to Block LOGISTICS-- 80 m
Block HUMANRESOURCE to Block ADM-- 110 m
C
Block ADM to Block LOGISTICS 140 m
E.
Number of computers installed at various blocks
BS
Block Number of Computers
DEVELOPMENT -- 105
HUMANRESOURCE--
ADM--
130
190 4C
N
LOGISTICS-- 55
O
i) Suggest the most suitable block to host the server. Justify your answer.
TH
ii) Suggest the wired medium and Draw the cable layout (Block to Block) to
economically connect various blocks.
PY
iv) Suggest the device that should be placed in the Server building so that they
AR
(a) TWP Cable (b)CoAxial Cable (c) OFC (d) UTP Cable
.L
OR
B) What type of network (PAN/ LAN/ MAN/ WAN) will be set up among the
W
----------------*------------*------------------
W
7 | Page