You are on page 1of 11

SET NO-01

Roll No. Candidates must write the Set No. on


the title page of the answer book.

SAMPLE QUESTION PAPER-7 (2022-23)

 Please check that this question paper contains 11printed pages.


 Set number given on the right hand side of the question paper should be
written on the title page of the answer book by the candidate.
 Check that this question paper contains 35 questions.
 Write down the Serial Number of the question in the left side of the margin
before attempting it.
 15 minutes time has been allotted to read this question paper. The question
paper will be distributed 15 minutes prior to the commencement of the
examination. The students will read the question paper only and will not
write any answer on the answer script during this period.

CLASS- XII
SUB : COMPUTER SCIENCE( 083 )
Time : 3 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 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.

SECTION A
1. State True or False: 1
In a Python code, the comments are given by using * and ** signs.
2. The data type of an expression float(m)/int(n) will result in: 1
(a) int (b) float (c) int or float (d) None of these

COMPUTER SCIENCE –XII/SQP-1Page 1 of 11


3. Which of the following statements is correct to display the key:value 1
pairs of a dictionary?
(a) <dictionary name>.values()(b) <dictionary name>.keys()
(c) <dictionary name>.key_values() (d) <dictionary name>.items()
4. Consider the given expression: 1
not(False and True) or not(False)
Which of the following will be correct output if the given expression is
evaluated?
(a) False (b) True (c) NULL (d) None
5. Select the correct output of the code: 1
str="computer is fun"
p=len(str)
substr="FUN"
print(str.find(substr, 0, p))
(a) 13 (b) 12 (c) -1 (d) 0
6. Which of the following mode will open the file in binary and read-write 1
mode?
(a) „r‟ (b) „rb‟ (c) „r+‟ (d) „rb+‟
7. Fill in the blank: 1
DROP TABLE Employee; is a _________ type of statement.
(a) DDL (b) DCL (c) DML (d) TCL
8. Which of the following commands will make changes in the column 1
values of a table in MYSQL database?
(a) CREATE (b) UPDATE (c) ALTER (d) INSERT
9. Which of the following statement(s) would give an error after executing 1
the following code?
Y=(2, 4, 6, 7, 10) #statement 1
Y[3]=8 #statement 2
print(Y*2) #statement 3
(a) statement 1(b) statement 2
(c) statement 3 (d) None of these
10. Fill in the blank: 1
__________ table constraint will prevent the entry of duplicate rows in a
table.
(a) UNIQUE (b) DISTINCT(c)PRIMARY KEY (d) NULL
11. Which of the following will set the file pointer at the beginning of a file? 1
(a) seek(1) (b) seek(-1) (c) seek(0) (d) seek( )
12. Fill in the blank: 1
__________ command is used to change the data type of some columnof
a table in a database.
(a) UPDATE (b) CHANGE (c) ALTER (d) DROP
13. Fill in the blank: 1
__________ TCP/IP protocol is used for transferring files from one
COMPUTER SCIENCE –XII/SQP-1Page 2 of 11
computer to another.
(a) SMTP (b) PPP (c) FTP(d) HTTP
14. What will the following expression be evaluated to in Python? 1
print(20/4+(9.0+4.0))
(a) 18 (b) 18.0 (c) 5.0 (d) 5
15. Which of the following is not an aggregate function? 1
(a) MIN( ) (b) SUM( ) (c) PRODUCT( ) (d) AVG( )
16. Which of the following functions is used to execute Python interfaced 1
MySQL query?
(a) run( ) (b) execute( ) (c) operate( ) (d) None of these
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): When a function is defined with a list of parameters with 1
function name in the function header, it is known as parameterised
function.
Reason (R): A non-parameterised function does not include parameters
with the function name in the function header. Thus, the parentheses
remains empty and no arguments are passed while calling the function.
18. Assertion (A): Python provides a built-in module called csv module to 1
enable reading and writing operation in the CSV file.
Reason (R): It uses mainly the classes viz. csv.writer and csv.reader. The
csv.writer class creates a writer object to write the input data into the file.
Whereas, the csv.reader class returns a reader object to retrieve from a
csv file.
SECTION B

19. Rewrite the following code in Python after removing all syntax error(s). 2
Underline each correction done in the code.
value=30
for res in range(0, value)
If res%4==0:
print(res*4)
Elseif res%5==0:
print(res+3)
Else:
print(res+10)
20. Write two points of difference between Hub and Switch. 2

COMPUTER SCIENCE –XII/SQP-1Page 3 of 11


OR
Write two points of difference between LAN and WAN.
21. (a) Given is a Python string declaration: 1
Exam= "AISSCE 2022-23"
Predict the output of the following statement:
>>>Exam[ : : -2] 1
(b) Write the output of the following code snippet:
D={1:11, 2:20, 3:33, 4:40, 5:55}
for a in D:
if (D[a]%2==0):
D[a]*=3
else:
D[a]+=10
print(D)
22. Differentiate between COUNT() and COUNT(*) functions in SQL with 2
appropriate example.
23. (a) Write the full forms of the following: 2
(i) GSM (ii) TELNET
(b) What is a Server?
24. Predict the output of the following code snippet: 2
def Display():
a=0
print(“Output:”)
while(a<8):
a=a+1
if(a%2= = 0):
continue
print(a)
return
Display()
OR
Predict the output of the following code snippet:
TP = (15, 12, 14, 12, 15, 12, 12, 16, 12)
print(TP.count(12) + TP.index(15))
print(max(TP)-min(TP))

25. Differentiate between Candidate key and Primary key.


2
OR

(i) What is the default order of displaying the records of a table


while using ORDER BY clause?
(ii) Name any two logical operators used in SQL.

COMPUTER SCIENCE –XII/SQP-1Page 4 of 11


SECTION C
26. (a) Refer the tables given below: 1+2
Table A: Book
Code Sub
B1 English
B2 Physics
B3 History
B4 Science
Table B: Stock
SCode Pub Qty Code
P01 Gyan Chand 250 B1
P02 Pustak House 340 B2
P03 Arora 470 B3
P04 Sonka 245 B5
Predict the output for the following query:
SELECT * FROM Book INNER JOIN Stock
ON Book.Code=Stock.Code;
(b) Write the output of the queries (i) to (iv) based on the following
tables:

(i) Select DESIGNATION, COUNT (*) From ADMIN Group By


DESIGNATION Having COUNT (*) <2;
(ii) SELECT MAX (EXPERIENCE) FROM SCHOOL;
(iii) SELECT TEACHER FROM SCHOOL WHERE
EXPERIENCE >12 ORDER BY TEACHER;
(iv) SELECT COUNT (*), GENDER FROM ADMIN
GROUP BY GENDER;
27. Write a user defined function Display() in Python that displays the lines 3
ending with „h‟ or „e‟ in the file STORY.txt.
E.g: If the file contains:

COMPUTER SCIENCE –XII/SQP-1Page 5 of 11


Whose woods these are I think I know
His house is in the village though
He will not see me stopping here
To watch his woods fill up with snow
Then the function must display the following lines:
His house is in the village though
He will not see me stopping here
OR
Write a function countmy( )in Python to read the text file “Data.txt” and
count the number of times “my” or “My” occurs in the file.
For example if the file “Data.txt” contains:
“This is my website. I have displayed my preferences in the CHOICE
section.”
The countmy( ) function should display the output as:
my occurs 2 times.
28. (a) Write the outputs of the SQL queries (i) to (iv) based on the relations 3
COMPANY and CUSTOMER.

(i) SELECT COUNT(*) , CITY FROM COMPANY


GROUP BY CITY;
(ii) SELECT MIN(PRICE), MAX(PRICE) FROM CUSTOMER
WHERE QTY>10;
(iii) SELECT AVG(QTY) FROM CUSTOMER WHERE
NAMELIKE “%R%”;
(iv) SELECT PRODUCTNAME,CITY, PRICE
FROM COMPANY, CUSTOMER WHERE
COMPANY. CID=CUSTOMER.CID AND
PRODUCTNAME= “MOBILE”;
(b) Write any two Table constraints in SQL.
29. Write a function INDEX_LIST(L), where L is the list of elements passed 3
as argument to the function. The function returns another list named
„indexList‟ that stores the indices of all those elements of L that ends
with 7.

COMPUTER SCIENCE –XII/SQP-1Page 6 of 11


For example:
If L contains [5, 7, 21, 27, 47, 14, 17]
The indexList will have [1,3,4,6]
30. Mayank has created a dictionary containing names and marks as key 3
value pairs of 6 students. Write a function in Python PushName(S) to
Push the keys (name of the student) of the dictionary S into a stack,
where the corresponding value (marks) is greater than 75. Also display
the count of elements pushed into the stack.
For example: If the sample content of the dictionary is as follows
S={"OM":66,"JAI":45,"BOB":95,"ALI":65,"ANU":90,"TOM":82}

The stack should contain


TOM
ANU
BOB
The output should be:
The count of elements in the stack is 3

OR

Sohan has a list containing 8 integers as marks of subject Science. You


need to help him to create a program with separate user defined function
to perform the following operations based on the list.
 Push those marks into a stack which are greater than 75.
 Pop and display the content of the stack.
Sample Input:
Marks = [75, 80, 56, 90, 45, 62,76, 72]
Sample Output:
76 90 80
SECTION D
31. The University is planning to start its academic blocks at Navi Mumbai 5
to setup a network. The University has 3 different blocks(Block A, Block
B, Block C) and one Administrative Block, as shown in the diagram
below:

Block A Block B Block C

Administrative Block

COMPUTER SCIENCE –XII/SQP-1Page 7 of 11


The distances between various blocks are as follows:
FROM TO DISTANCE
Block A Administrative Block 80 m
Block A Block C 80 m
Block B Administrative Block 45 m
Block B Block C 30 m
Block C Administrative Block 35 m
Block A Block B 15 m

No. of computers installed in each of the following blocks are as follows:


Name of Block No. of Computers
Block A 15
Block B 40
Block C 20
Administrative Block 80
(a) Suggest the most suitable place (i.e., Block) to install the server of
this University with a suitable reason.
(b) Suggest the ideal layout for connecting these blocks for a wired
connectivity.
(c) Which device will you suggest to be placed/installed in each of these
blocks to efficiently connect all the computers within these blocks?
(d) Suggest the placement of a repeater in the network with justification.
(e) The University is planning to connect its admission office in Delhi,
which is more than 1250 km from University. Which type of
network out of LAN, MAN, or WAN will be formed? Justify your
answer.
32. (a) Predict the output of the following program snippet. 2+3
def Case_Convert(str):
p=len(str)
str1= „‟
for i in range(0, p):
chr=str[i]
if (chr>= „a‟ and chr<= „z‟):
chr1=chr.upper()
str1=str1+chr1
elif (chr>= „A‟ and chr<= „Z‟):
chr1=chr.lower()
str1=str1+chr1
else:
str1=str1+chr
print(“The new string :”,str1)

COMPUTER SCIENCE –XII/SQP-1Page 8 of 11


str=“Python for class 12”
Case_Convert(str)

(b) The code given below intends to delete a record from the table
„Employee‟ available in the database „Company‟, whose „Dept‟ is „Elect‟
and Grade is „G4‟. Write the following missing statements to complete
the code:
Statement 1-To form the cursor object
Statement 2-To execute the command that will delete the desired record
from the table „Employee‟.
Statement 3-To make the changes after deletion of record permanently in
the database.
import mysql.connector as mycon
mydb=mycon.connect(host=„localhost‟, database=„Company‟,
user= „root‟, passwd= „1234‟)
mycursor=______________ #Statement 1
mycursor.execute ( _______________________ ) #Statement 2
mydb.____________ #Statement 3

OR
(a) Predict the output of the following program snippet.
x=5
def func2():
x=3
x=x+1
print(float(x),end=„$‟)
func2()
print(x)

(b) The management of a company has decided to increase the salary by


20% of all those employees who belong to the „Dept‟ (IT). Now, write
the following missing statements to complete the code:
Statement 1-To form the cursor object
Statement 2-To execute the command that will increase the salary by
20% of all those employees who belong to the „Dept‟ (IT).
Statement 3-To make the changes after deletion of record permanently in
the database.
import mysql.connector as mycon
mydb=mycon.connect(host=„localhost‟, database=„Company‟,
user= „root‟, passwd= „1234‟)
mycursor=______________ #Statement 1
mycursor.execute ( _______________________ ) #Statement 2
mydb.____________ #Statement 3

COMPUTER SCIENCE –XII/SQP-1Page 9 of 11


33. Name the default „delimiter‟ used in a CSV file. 5
Write a program in Python that defines and calls the following user
defined functions:
(a) ADD() – To accept and add data of Indian state to a CSV file
„Indian_Cap.csv‟. Each record consists of a list with field
elements as S.No., Indian State, Capital and Pincode
respectively.
(b) COUNT() – To count the number of records present in the CSV
file named „Indian_Cap.csv‟.
OR
What is a CSV file?
Write a program in Python that defines and calls the following user
defined functions:
(a) ADD() – To accept and add data of students to a CSV file
„student.csv‟. Each record consists of a list with field elements
as Rollno, Name, Marks respectively.
(b) Display() – To read all content of “student.csv” and display
records of only those students who scored more than 80 marks.
Records stored in students is in format : Rollno, Name, Marks.

SECTION E
34. Observe the following table and answer the parts (a) to (c): 1+1+
2

(a) Identify the most appropriate column, which can be considered as


Primary key of the Table Store.
(b) If three columns are added and one row is deleted from the table
Store, then what will be the new degree and cardinality of the
above table?
(c) Write the statements to:
(i) Insert the following record into the table:
Item Code-17, Item-CD Marker, Qty-50, Rate-10
(ii) Increase the Item Rate by 10% where the Item Code is 11.
OR(Option for Part (c) only)

(c) Write the statements to:

COMPUTER SCIENCE –XII/SQP-1Page 10 of 11


(i) Delete the record of Item having Rate less than 10.
(ii) Add a column Distributer in the table with data type as
varchar with 40 characters.
35. A binary file „Result.dat‟ contains the records(each containing names and 1+1+
marks in English, Maths and Computer Science) of all the students of 2
Class-XII. Write a function def Result( ) in Python to display the names
of all the students who have secured 90% and above in English, Maths
and Computer Science.
[Assume that the file is already present in the system.]
The code is written as follows:
# To display the records of the binary file
import __________ #Statement 1
def Result( ):
f=open( __________________ ) #Statement 2
print(“Content of the file:”)
try:
while True:
Record=________________ #Statement 3
print(Record)
print(“Name\t\t”, “English\t\t”, “Maths\t\t”,“Computer\t\t”)
for i in Record:
m1=i[1]; m2=i[2]; m3=i[3]

if( ______________________ ): #Statement 4


print(i[0], „\t‟, i[1], „\t‟, i[2], „\t‟, i[3])
except:
f.close()
print(“Program Ends!”)
# main program
Result()
(a) Which module should be imported in the program?(Statement 1)
(b) Write the correct statement required to open the
file Result.dat.(Statement 2)
(c) Which statement should be filled in Statement 3 to read a Record
from the binary file and in Statement 4 to check who have secured
90% and above in English, Maths and Computer Science from
the binary file State.dat

COMPUTER SCIENCE –XII/SQP-1Page 11 of 11

You might also like