QP-XII-CS-SET-1
QP-XII-CS-SET-1
General Instructions:
● This question paper contains 37 questions.
● All questions are compulsory. However, internal choices have been provided in some questions.
Attempt only one of the choices in such questions
● The paper is divided into 5 Sections- A, B, C, D and E.
● Section A consists of 21 questions (1 to 21). Each question carries 1 Mark.
● Section B consists of 7 questions (22 to 28). Each question carries 2 Marks.
● Section C consists of 3 questions (29 to 31). Each question carries 3 Marks.
● Section D consists of 4 questions (32 to 35). Each question carries 4 Marks.
● Section E consists of 2 questions (36 to 37). Each question carries 5 Marks.
● All programming questions are to be answered using Python Language only.
● In case of MCQ, text of the correct answer should also be written.
A string can be surrounded by three sets of single quotation marks or by three sets of double
quotation marks.
4 Consider the statements given below and then find the correct output . 1
pride="Malayalam@3"
print(pride[-2:2:-2])
T1=(1,2,[1,2],3)
T1[2][1]=3.5
print(T1)
s = [3,0,[2,1,2,3],1]
print(s[s[len(s[2])-2][1]])
a.0 b. 1 c. [2,1,2,3] d. 2
(a) Statement 2
(b) Statement 3
(c) Statement 4
10 Which of the following will delete key-value pair for key = “Red” from a dictionary COLOR? 1
a. delete COLOR("Red") b. del COLOR["Red"]
c. del.COLOR["Red"] d. COLOR.del["Red"]
11 tell() is a method of: 1
(a) pickle module (b) csv module (c) file object (d) seek( )
12 def func(S): 1
m= ‘ ‘
for i in range(0,len(S)):
if S[i].isalpha( ):
m=m+S[i].upper( )
elif S[i].isdigit( ):
m=m+’0’
else:
m=m+”#”
print(m)
func(“Python 3.9”)
(i) python0#0#
(ii) Python0#0#
(iii) PYTHON#0#0
(iv) PYTHON0#0#
15 Choose correct SQL query which is expected to delete all rows of a table emp without deleting its 1
structure.
a)DELETE TABLE;
17 Shanu wants to transfer pictures from her mobile phone to her laptop. She uses Bluetooth 1
Technology to connect two devices. Which type of network will be formed in this case?
18 What out of the following, will you use to have an audio-visual chat with an expert sitting in a far- 1
away place to fix-up a technical issue?
19 Which devices modulates digital signals into analog signals that can be sent over traditional 1
telephone lines?
No. 20 and 21 are ASSERTION ( A ) and REASONING ( R ) based questions.
21 Assertion (A): A foreign key in the relational data model is a set of attributes in one 1
Reason (R): Foreign keys are used to establish relationships between tables.
SECTION-B (7 x 2 =14M)
22 Rewrite the following code in python after removing all syntax errors. Underline each 2
correction done in the code:
Def Calc(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) Calc(15)
functions/methods only:
OR
25 What possible outputs(s) are expected to be displayed on screen at the time of execution of 2
the program from the following code? Also specify the maximum values that can be assigned
to each of the variables BEG and END.
import random
heights=[10,20,30,40,50]
beg=random.randint(0,2)
end=random.randint(2,4)
for x in range(beg,end):
print(heights [x],end=’@’)
(a) 30 @
(b) 10@20@30@40@50@
(c) 20@30
(d) 40@30@
26 Explain the Relational Database Management System terminologies- Degree and Attribute of 2
a relation. Give example to support your answer
OR
Explain the use of ‘Foreign Key’ in a Relational Database.Give an example to support your
answer.
27 Give difference between DROP and DELETE command in SQL 2
OR
Name the aggregate functions which work only with numeric data, and those that work with
any type of data.
28 Differentiate between Star Topology and Bus Topology. Write two points of difference. 2
OR
SECTION-C (3 x 3 = 9 M)
29 Write a user defined function in python that displays the number of lines starting with word 'It' 3
in the file Poetry.txt
OR
write a user defined function Transfer() that copies a text file "source.txt" onto “destination.txt"
barring the lines starting with # sign.
30 A list named as Record contains following format of for students: [student_name, class, city]. 3
Write the following user defined functions to perform given operations on the stack named
‘Record’:
[“Rahul”, 12,”Delhi”]
Stack Empty
OR
Mr. Rakesh has created a list of elements. Help him to write a program in python with
functions, PushElement(element) and PopElement(element) to add a new element and
delete an element from a List of element Description, considering them to act as push and
pop operations of the Stack data structure . Push the element into the stack only when the
element is divisible by 7.
For eg:if LIST=[1,9,12,48,56,63]
then stack content will be 63 56
31 Ridhi is working in a mobile shop and assigned a task to create a table MOBILES with record 3
of mobiles as Mobile code, Model, Company, Price and Date of Launch. After creation of the
table, she has entered data of 5 mobiles in the MOBILES table.
MOBILES
SECTION-D (4 x 4 = 16 M)
ii. Give an example code to handle TypeError ? The code should display the message "
Invalid input. Please Input a valid number " in case of TypeError exception, and the
message "Some error occurred" in case of any other exception.
OR
ii.Write a code to accept two numbers and display the quotient. Appropriate exception
should be raised if the user enters the second number (denominator) as zero (0).
33 A CSV file ‘empdata.csv’ consists of a list with field elements as Eid, Ename, Salary and 4
City to store employee id , employee name, employee salary and city. Write a Program in
Python that defines and calls the following user defined functions:
SEARCH()- To display the records of the employees whose salary is more than 25000.
COUNTROW() – To count the number of records present in the CSV file named
‘empdata.csv’.
Table: Garment
Table: Cloth
CCode CName
C01 Polyester
C02 Cotton
C03 Silk
C04 CottonPolyester
Write SQL queries for the following:
ii. Display sum of quantities for each CCODE whose numbers of records are more than 1.
iii. Display GNAME, CNAME, RATE whose garments name starts with S.
iv. Display average rate of garment whose rate ranges from 1200 to 2000 (both values
included)
- Username: root
- Password: school123
- Host: localhost
Write the following Python function to perform the specified operation: ChecknDisplay():
To input details of an employee and store it in the table EMPLOYEES. The function should
then retrieve and display all records display details of all such employees from the table
EMPLOYEES whose salary is more than 50000.
SECTION-E (2 x 5 = 10 M)
ii. AddStudents() is a function to input the data of a students and append it in the file
STUDENT.DAT containing student information – roll number, name and marks (out of 100)
of each student.
iii.GetStudents() is a function Write a function to read the data from the file to display the
name and percentage of those students who have a percentage greater than 75. In case
there is no student having percentage > 75, the function displays an appropriate message.
37 Anant National University is setting up its academic blocks at Ahmedabad and is planning to 5
set up a network. The University has 3 academic blocks and one Human Resource Center
as shown in the diagram below: Study the following structure and answer questions (a) to (e)
a) Suggest the most suitable place (i.e., Block/Center) to install the server of this University
with a suitable reason.
b) Suggest an ideal layout for connecting these blocks/centers for a wired connectivity.
e) The university is planning to connect its admission office in Delhi, which is more than
1250km from university. Which type of network out of LAN, MAN, or WAN will be formed?
Justify your answer.