Class XII - Computer Science QP 1
Class XII - Computer Science QP 1
SECTION - A
State True or False:
1 1
“Python has a set of keywords that can also be used to declare variables”
a. Primary Key
2 1
b. Foreign Key
c. Candidate Key
d. Alternate Key
27 % 7 // (3 / 2)
3 1
a. 2 b. 2.0
c. 4.0 d. 4
4 Select the correct output of the code: 1
[1]
a = "assistance"
a = a.partition('a')
b = a[0] + "-" + a[1] + "-" + a[2]
print (b)
Options:
a. -a-ssistance
b. -a-ssist-nce
c. a-ssist-nce
d. -a-ssist-ance
Fill in the blank: For each attribute of a relation, there is a set of
permitted values, called the _______of that attribute.
5 1
a. cardinality b. degree
c. domain d. tuple
Kriya wants to send mail to her friend. Which type of protocol will be
used in this case?
6 1
a. SMTP b. FTP
c. POP d. HTTPS
Given the following dictionaries
dict_student = {"rno" : "53", "name" : ‘Rajveer Singh’}
dict_marks = {"Accts" : 87, "English" : 65}
Which statement will merge the contents of both dictionaries?
7 1
a. dict_student + dict_marks
b. dict_student.add(dict_marks)
c. dict_student.merge(dict_marks)
d. dict_student.update(dict_marks)
Consider the statements given below and then choose the correct
output from the given options:
8 1
a= "Year 2022 at All the best"
a = a.split('2')
[2]
b = a[0] + ". " + a[1] + ". " + a[3]
print (b)
a. Statement 3
b. Statement 4
c. Statement 5
d. Statement 4 and 5
import random
10 1
points=[20,40,10,30,15]
points=[30,50,20,40,45]
begin=random.randint(1,3)
last=random.randint(2,4)
[3]
for c in range(begin,last+1):
print(points[c],"#")
Options:
a. 20#50#30#
b. 20#40#45
c. 50#20#40#
d. both (b) and (c)
Which switching technique follows the store and forward mechanism?
a. Circuit switching
b. message switching
11 1
c. packet switching
d. All of these
a. 5 5 1 2 3
b. 5 1 2 3 4
c. 2 3 4 5 1
d. 2 3 4 5 5
[4]
a. There can be only one Foreign Key in a table.
a. str
16 b. a list of lines 1
The code given below accepts a number as an argument and returns the
reverse number. Observe the following code carefully and rewrite it after
removing all syntax and logical errors. Underline all the corrections made.
a=5
work=true
20 2
b=hello
c=a+b
FOR i in range(10)
if i%7=0:
continue
OR
Write a function called rem_keys( D,keylist) that accepts two
parameters: a dictionary called D and a list called keylist. Function
rem_keys(D,keylist) should remove all the keys contained in the
passed keylist from the dictionary D and return the dictionary.
Predict the output of the following code:
22 2
t1=("Sahodya",[1,2,'3'],'S',(3,4,6),"Exam",10)
[6]
print(t1[-5:-3]+t1[3])
OR
What are aggregate and scalar functions in MYSQL? Give one example for
each
OR
a. Sonal needs to display name of teachers, who have “0” as the third
character in their name. She wrote the following query.
24 2
[7]
if i==3:
x=int(i)
x+=x-3
str1[i]=x
elif (str1[i].islower()):
str1[i]=str1[i].upper()
else:
str1[i]=str1[i]*2
print(str1)
SECTION - C
Predict the output of the Python code given below:
z= 100
def f( ):
global z
print('z is:', z)
26 3
z=50
f( )
print('Value of z is:', z)
[8]
27 1*3=3
Consider the above table CLUB, COACHES given below and write the
output of the SQLqueries that follow.
[9]
Write a method countcap( ) in python to count the number of upper case
alphabets present in a text file “ARTICLE.txt”
Example :
If the file contains the given below content:
A piece of writing other than fiction or poetry that forms a separate part of
a publication (as a Magazine or Newspaper)
Then the countcap( ) has to give output as :
The number of capital case alphabets are : 3
Consider the table Store given below:
29 1*3=3
Based on the given table, write SQL queries for the following:
(a) Identify the attribute best suitable to be declared as primary key
(b) Write the query to add the row with following details
(2010,”Notebook”,23,155)
(c) (i) Now Abhay wants to display the structure of the table STORE i.e.
name of the attributes and their respective data types that he has used in the
table. Write the query to display the same.
(ii) Abhay wants to remove the table STORE from the database MyStore,
Help Abhay in writing the command for removing the table STORE from
the database MyStore.
[10]
least one element otherwise display an appropriate message.
OR
The function should push the names of those payers into the stack where the
name starts with letter ‘R’. Also display the count of elements pushedinto the
stack.
For example:
RahulDravid
R Pragnananda
SECTION - D
Table: ACTIVITY
[11]
Write SQL queries for the following:
(i) To display the name of all activities with their Acodes in descending
order.
(iii) To display the coach’s name and ACodes in acending order of ACode
from the table COACH.
[12]
SECTION - E
Ravya Industries has set up its new center at Kaka Nagar for its office and
web based activities. The company compound has 4 buildings as shown in
the diagram below:
33 1*5=5
[13]
A binary file “STUDENT.DAT” has structure (admission_number,
Name, Percentage).
Write a function addrec() in Python that would read contents of
the file “STUDENT.DAT”
Write function countrec() to display the details of those students
whose percentage is above 75. Also display number of students scoring
above 75%
OR
34 5
A binary file “BOOK.dat” has structure [BookNo, Book_Name, Author,
Price]
Write a user defined function Createfile( ) to input data for a record and
add to Book.dat
ii) What is resultset? Write code to execute the query “Select * from student”
and store the retrieved record in the cursor object after creating cursor.
OR
[15]