QP-2 CS

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

अनुक्रम ांक/ROLL NO

केंद्रीय विद्य लय सांगठन ,जयपुर सांभ ग


KENDRIYA VIDYALAYA SANGATHAN, JAIPUR REGION
PRACTICE PAPER-II
कक्ष / CLASS :XII
विषय /SUB : कांप्यूटर विज्ञ नां (83) /COMPUTER SCIENCE (83)
अविकतम अिवि / Time Allowed :03 Hours अविकतम अांक Maximum Marks : 70
स म न्य वनर्दे श / General Instructions

1. This question paper contains five sections, Section A to E.


2. All questions are compulsory.
3. Section A has 21 questions (1 to 21) carrying 01 mark each.
4. Section B has 07 Very Short Answer type questions (22 to 28) carrying 02 marks each.
5. Section C has 03 Short Answer type questions (29 to 31) carrying 03 marks each.
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.
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.

SECTION-A (21*1=21 Marks)


Q.No Question Marks
1. State True or False 1
“continue keyword skips remaining part of an iteration in a loop”
2. Select the correct output of the code: 1
>>> St=”Computer”
>>> print(St[4:])
(a) “Comp” (b) “pmoC” (c) “uter” (d) “mput”
3. 1
print(True or not True and False)
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
4. Given the following dictionaries 1
dict_stud = {"rno" : "53", "name" : ‘Rajveer Singh’}
dict_mark = {"Accts" : 87, "English" : 65}
Which statement will merge the contents of both dictionaries?
(a) dict_stud + dict_mark (b) dict_stud.add(dict_mark)
(c) dict_stud.merge(dict_mark) (d) dict_stud.update(dict_mark)
5. Consider a declaration L=(1,’Python’,’3.14’) 1
Which of the following represents the data type of L?
(a) list (b) tuple (c) dictionary (d) string
6. Given a tuple tupl=(10,20,30,40,50,60,70,80,90) 1
What will be the output of print (tupl[3:7:2])?
(a) (40,50,60,70,80) (b) (40,50,60,70) (c) [40,60] (d) (40,60)
7. When a Python function does not have return statement then what it returns? 1
(a) int (b) float (c) None (d)Give Error
8. What will the following expression be evaluated to in Python? 1

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’)
print(F.load(10)) print(F.dump(10))

(c) F=open(‘Notes.txt’) (d) F=open(‘Notes.txt’)


print(F.read(10)) print(F.write(10))
11. Which Python approach is used for object serialization in handling of Binary File? 1
(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():
n=10
x=5
print( x)
a) n and x both are local variables b) n and x both are global variables
c) n is global and x is local variable d) n is local and x is global variable
13. Fill in the blank: 1
command is used to add a column in a table in SQL.
14. _______Keyword is used to obtain Non-duplicated values in a SELECT query. 1
(a) ALL (b) DISTINCT (c) SET (d) HAVING
15. Which SQL function returns the sum of values of a column of numeric type? 1
(a)total( ) (b)add( ) (c) sum( ) (d) All of these
16 Which of the following is not valid cursor function while performing database 1
operations using python. Here Mycur is the cursor object?
(a) Mycur.fetch() (b) Mycur.fetchone()
(c) Mycur.fetchmany(n) (d) Mycur.fetchall()
17. What Modem does? 1
a) Modulation (b) Demodulation
c) Both Modualtion & Demodulation (d) Not any
18. Fill in the blank: 1
______is the first page that normally view at a website.
(a) First Page (b) Master Page (c) Home Page (d) Login Page

19. Fill in the blank: 1


_______ is the way of connecting the networking devices.
Q20 and Q21 are ASSERTION AND REASONING byased questions. Mark the correct choice as
(a) Both A and R are true and R is the correct explanation for A

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
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
(ii)Write any 2 operators name used in python.
24. Write the Python statement for each of the following tasks using BUILT_IN 1+1=2
functions/ methods only:
i) str="PYTHON@LANGUAGE"
(A) To print the above string from index 2 onwards.
OR
(B) To initialize an empty dictionary named as d.

ii) Write the Python statement for each of the following tasks using BUILT_IN
functions/ methods only:
(A) s=”LANGUAGE"
To convert the above string into list.
OR
(B) To initialize an empty tuple named as t.
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
AR=[20, 30, 40, 50, 60, 70];
Lower =r.randint(1,3)
Upper =r.randint(2,4)
for K in range(Lower, Upper +1):
print (AR[K],end=”#“)
(i) 10#40#70# (ii) 30#40#50#
(iii) 50#60#70# (iv) 40#50#70#
26. Differentiate between COUNT(* ) and COUNT(COLUMN_NAME) with example. 2
27. (i) 2
A) What constraint should be applied on a table’s column to provide it the
default value when column does not have any value.
OR
B) What constraint should be applied on a table’s column so that NULL
value is allowed in that column and duplicate values are not allowed.

(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
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”
For example:
If the content of the file is
“THIS IS IMPORTANT TO NOTE THAT SUCCESS IS THE RESULT OF HARD WORK.
WE ALL ARE EXPECTED TO DO HARD WORK.
AFTER ALL EXPERIENCE COMES FROM HARDWORK.”

The method/function should display:


THIS IS IMPORTANT TO NOTE THAT SUCCESS IS THE RESULT OF HARD WORK.
WE ALL ARE EXPECTED TO DO HARD WORK.
30. A) 3
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
function should push all the numbers that are even to the stack.

Write the function pop(stack) that removes the top element of the stack on its each
call.

Also write the function calls.


OR

B)
Write a function in Python push(EventDetails) where EventDetails is a dictionary
containing the number of persons attending the events–
{EventName : NumberOfPersons}.

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
pushed on to the stack.

Write the function pop(EventDetails) that removes the top element of the stack on
its each call.

Also write the function calls.

For example:

If the dictionary contains the following data:


EventDetails ={“Marriage”:300, “Graduation Party”:1500,
“Birthday Party”:80, “Get together” :150}
The stack should contain :-

4 | Page
Marriage
Graduation Party

The output should be:


The count of elements in the stack is 2
31. Mohan is a senior clerk in a MNC. He creates a table salary with a set of records to 3
keep ready for tax calculation. After creation of the table, he has entered data of 5
employees in the Employee table.

Based on the table given above write the SQL Queries:


A)
(i) To Display the Emp_Name and Gross_salary of each employee.
(Gross= basic+da+hra+nps)
(ii) To Increase the DA by 3% of respective basic salary of all
employees.
(iii) To Delete the Attribute emp_desig from the table.

OR
B)
(i) To display the total number of employees in Employee table.
(ii) To display the employees records in descending order of
basic_salary respectively.
(iii) To display the total hra of employees in Employee table.

SECTION-D (4*4= 16 Marks)


32 A) 1+3=4
i) When is IndexError Exception raised in Python?

ii) Give an example code to handle IndexError? The code should display the
message “list index out of range is not allowed” in case of IndexError Exception,
and the message “Some Error occured” in case of any other Exception.
OR
B)
i) When is ZeroDivisionError Exception raised in Python?

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.

For Example: “INDIA”, “NEW DELHI”


“CHINA”, ”BEIJING”
Write python code for these two user defined functions:

(i) AddNewRecord( ): insertion of new records in file.


(ii) ShowRecord( ) : to display all the records from file.

5 | Page
34 Write the SQL queries (i) to (iv) based on the relations SCHOOL and ADMIN given 4
. below:

Write SQL queries for the following:


i) Display total periods subjectwise by framing groups based on subject.
ii) Display minimum experience and maximum code from relation SCHOOL.
iii)Display teachername, gender by joining both tables on the basis of code
ATTRIBUTE and the designation should be “COORDINATOR.
iv)
(A) Display the total number of different subjects in school relation.
OR
(B) To display the total number of Males and Females separately with gender in
ADMIN table.
35 4
. Aarya has created a table named Emp in MySQL:
EmpNo – integer
EmpName – string
Age– integer
Salary – integer
Note the following to establish connectivity between Python and MYSQL:
● Username - root
● Password - tiger
● 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
Block DEVELOPMENT to Block ADM-- 75 m
Block DEVELOPMENT to Block LOGISTICS-- 80 m
Block HUMANRESOURCE to Block ADM-- 110 m
Block ADM to Block LOGISTICS 140 m

Number of computers installed at various blocks


Block Number of Computers
DEVELOPMENT -- 105
HUMANRESOURCE-- 130
ADM-- 190
LOGISTICS-- 55

i) Suggest the most suitable block to host the server. Justify your answer.
ii) Suggest the wired medium and Draw the cable layout (Block to Block) to
economically connect various blocks.
iii) Suggest the placement of the following devices with justification:
(a) Hub/Switch (b)Repeater
iv) Suggest the device that should be placed in the Server building so that they
can connect to Internet Service Provider to avail Internet Services.
v) A) What is the Suggestion for the high-speed wired communication medium
between Bangalore Campus and Mysore campus to establish a data network.
(a) TWP Cable (b)CoAxial Cable (c) OFC (d) UTP Cable
OR
B) What type of network (PAN/ LAN/ MAN/ WAN) will be set up among the
computers connected in the Campus?

----------------*------------*------------------

7 | Page

You might also like