0% found this document useful (0 votes)
98 views32 pages

10th 11th and 12th Paper

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
98 views32 pages

10th 11th and 12th Paper

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 32

SAMPLE PAPER SET-10

Class: XII Session SUBJECT : Computer Science(083)


TIME : 3 HOURS MM : 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 marks each.
4. Section B has 07 very Short Answer type question carrying 02 marks each
5. Section C has 05 Short Answer type question carrying 03 marks each.
6. Section D has 03 Long Answer types question 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 Which of the following in not a valid variable name in python? 1
(i) Peacock (iii) Pea Cock
(ii) Peacock5 (iv) Peacock_

2 Write the type of tokens from the following: 1


(i) if (ii) roll_no

3. If the following code is executed, what will be the output of the following 1
code?
name="IlovemyCountry"
print(name[3:10])

4. Find and write the output of the following Python code: 1


def Change(P ,Q=40):
P=P+Q
Q=P-Q
print( P,"#",Q)
return (P)
R=100
S=200
R=Change(R,S)
print(R,"#",S)
S=Change(S)

1
5. Select the correct output of the following code
Fp.seek(5,1)

a) Move file pointer five character ahead from the current postion
b)Move file pointer five character ahead from the beginning of a file
c)Move file pointer five character behind from the current postion
d)Move file pointer five character behind ahead from the end of a file

6. Select the correct method to write a list of line to a file 1


a) write(list)
b)writelines(list)
c)writelist(list)
d) None

7. Select the correct output of the following string operations 1

mystring = “Pynative”
stringList = [ “abc”, “Pynative”,”xyz”]
print(stringList[1] == mystring)
print(stringList[1] is mystring)

a) True b) False c) False d) Ture


False True Flase Ture

8. What will be the output of the following Python code snippet? 1

D1={“John”:40 , “Peter” : 45}


D2= { “John”: 466, “Peter” : 45}
Print(D1>D2)

a) Ture b) False c) Error d) Non


9 Write a python command to create list of keys from a dictionary. 1
dict={‘a’:’A’, ‘b’:’B’, ‘c’:’C’, ‘d’:’D’}
a)dict.keys() b)keys() c) key.dict() d) None of these

10. The role of the statement 1


‘cursor=db.cursor’ is:
a) Create an instance of a cursor

b) Move cursor row wise


c) Connects cursor to database
d) Prepare cursor to move

11. ………………..is a set of attributes in a relation , for which no two tuples in a 1


relation state have the same combination of values.
a) Super Key
b) Candidate Key
c) Primary Key
d) All of the above

12 Evaluate the following expressions: 1


10 > 5 and 7 > 12 or not 18 > 3

a) Ture b) Flase C) 25 D) 0

13 The SELECT statement when combined with............clause,return records 1


without repletion.
a) NULL
b)UNIQUE
c)DESCRIBE
d) DISTINCT

14 Consider the following query: 1


SELECT name FROM class WHERE subject……NULL;
Which comparison operator may be used to fill the blank space in above
query?
a) = b)LIKE c)IS d)IS NOT

15. Which portion of the URL below records the directory or folder of the 1
desired resource?
https://www.nishantsingh.com/ghagwal/pgt.htm
a) http b) ghagwal c) www.nishantsingh.com d) pgt.htm

16 …………….Protocol is used to send the email to another email user. 1

a) FTP b)POP c) IMAP d) SMTP

Q17 and Q18 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):- Key word arguments are related to function calls. 1
Reasoning(R ):- When you use keyword arguments in funation call, the caller
identifies the arguments by the parameter name.

18 Assertion(A) : The tell method will stores/get the current location of the file 1
pointer.
Reasoning(R): Python seek method returns the current position of the file
read/write pointer with the file.

Section B
19. Mr. Akash has written a code , His code is having errors , Rewrite the correct code 2
and underline the correction s made.

5x=input(“Enter a number”)
If(abs(x)=x):
Print(“You Entered a positive number..”)
Else:
x=x-1
print(“Number made positive:”x)

20 Differentiate between default parameter(s) and keyword parameter(s) with a 2


suitable example for each.
Or
What is the difference between Local Variable and Global Variable?

21 a) If the following code is executed, what will be the output of the following 1
code?
mystr1 = ‘Sequence with labels’
mystr2 = ‘$’
print(mystr2*6+mystr1+mystr2*5)
1
b) What will be the output of the following code snippet?
init_tuple_a =( 'a', '3’)
init_tuple_b = ('sum', '4')
print (init_tuple_a + init_tuple_b)

22. What is the purpose of the following clauses in a select statement? 2


a) ORDER BY b) HAVING

23. What is the full forms of the following : 2


a) IMAP b) POP
24. Predict the output of the python code given below:- 2
def changedata(str1):
length=len(str1)
temp=""
for i in range(0, length):
if str1[i].islower():
temp=temp+str1[i].upper()
elif str1[i].isupper():
temp=temp+str1[i].lower()
elif str1[i].isdigit():
temp=temp+str(int(str1[i])+1)
else:
temp=temp+'^'
print(temp)
changedata("Kvs_nishant@2023")
25 Study the following program and select the possible output(s) from options (i) to 2
(iv) following it. Also, write the maximum and the minimum values that can be
assigned tovariable Y.
import random
X= random.random()
Y= random.randint(0,4)
print(int(X),":",Y+int(X))
(i) 0 : 0 (ii) 1 : 6 (iii) 2 : 4 (iv) 0 : 3
Section c
26 Write the outputs of the SQL queries (i) to (iii) based on the given tables: 3
Watches
Watchid Watch_name Price Type Qty_store
W001 High Time 10000 Ladies 100
W002 Life Time 15000 Gents 150
W003 Wave 12500 Ladies 200
W004 High Fashion 13500 Ladies 135
W005 Golden Time 14000 Unisex 150
Sale
Watchid Qty_sold Quarter
W001 10 1
W002 8 2
W003 15 1
W001 12 3
W003 11 2
W004 9 1
W002 15 1
i. SELECT MAX (PRICE), MIN(QTY_STORE) FROM WATCHES;

ii. SELECT QUARTER, SUM(QTY SOLD) FROM SALE GROUP BY QUARTER;


iii. SELECT WATCH_NAME, QTY_STORE, SUM (QTY_SOLD) FROM WATCHES
W, SALE S WHERE W. WATCHID = S.WATCHID GROUP BY S.WATCHID;

27 Assume that a text file named TEXT1.TXT already contains some text written 3
into it ,write a function named COPY(),that reads the file TEXT1.TXT and create a
new file named TEXT2.TXT ,which shall contain only those words from the file
TEXT1.TXT which don’t start with an uppercase vowel(i.e. with ‘A’,’E’,’I’,’O’,’U’)
,for example if the file TEXT1.TXT contains
He can appoint any member of the Lok Sabha
then the file TEXT2.TXT shall contain
He can member of the Lok Sabha

OR
write a function countmy() in python to read the text file "DATA.TXT" and
count the number of times "my" occurs in the file

28 Write the outputs of the SQL queries (i) to (iii) based on the relations VEHICLE 3
and TRAVEL given below:
VCODE VEHICLETYPE PERKM
V01 VOLVO BUS 150
V02 AC DELUX BUS 125
V03 ORDINARY BUS 80
V04 CAR 18
V05 SUV 30
NOTE: PERKM is fright charges per kilometer
Table: TRAVEL
CNO CNAME TRAVELDATE KM VCODE NOP
101 K. Niwal 2015-12-13 200 V01 32
103 Fredrick Sym 2016-03-21 120 V03 45
105 Hitesh Jain 2016-04-23 450 V02 42
102 Ravi Anish 2016-01-13 80 V02 40
107 John Malina 2015-02-10 65 V04 2
104 Sahanubhuti 2016-01-28 90 V05 4
106 Ramesh Jaya 2016-04-06 100 V01 25

NOTE: KM is Kilometres travelled and NOP is number of passengers travelled in


vehicle.
a) SELECT COUNT(*), VCODE FROM TRAVEL
GROUP BY VCODE HAVING C0UNT(*)>1;
b)SELECT VCODE,CNAME,VEHICLETYPE FROM TRAVEL A, VEHICLE B
WHERE A.VC0DE=B.VCODE AND KM<90;
c)SELECT DISTINCT VCODE FROM TRAVEL;
29 3
Write a python Function that accepts a string and calculates the number of
uppercase letters and lowercase letters.
Sample String : Python ProgrammiNg
Expected Output:
Original String : Python ProgrammiNg
No. of Upper case characters : 3
No. of Lower case characters :14

30 Write PushOn(Student) and Pop(Student) methods/functions in Python to add a 3


new Student and delete a Student from a list of Student Name, considering
them to act as push and pop operations of the Stack data structure.
31 Hindustan connecting world Association is planning to start their offices in four 5
major cities in India to provide regional IT infrastructure support in the field of
Education And Culture . The company has planned to setup their head office in
New Delhi in three location and have name their New Delhi office as “Sales
Office”, “Head Office” and “Tech Office”. The company’s regional offices are
loacated in “Coimbatore”, “Kolkata”, and “Ahmedabad”.
A rought layout of the same ia as follows

NEW DELHI
Head
INDIA Tech
Office
Sales Office
Office

Kolkata
Ahmedabad Coimbat
ore

Approximate distance between these office as per network survey team is as


follows:

Place From Place TO Distance


Head Office Sales Office 10 km
Head Office Tech Office 70 mtr
Head Office Kolkata Office 1291 Km
Head Office Ahmedabad Office 790 Km
Head Office Coimbatore Office 1952 Km
In continuation of the above , the company expert have planned to install the
following number of computer in each of their offices:

Head Office 100


Sales Office 20
Tech Office 50
Kolkata Office 50
Ahmedabad Office 50
Coimbatore Office 50

a) Suggest network type for connecting each of the following set of their offices:
 Head Office and Tech Office
 Head Office and Coimbatore Office
b) Which device you will suggest to be produced by the company for connecting all the
computers with in each of their offices out of the following device?
i) Switch/Hub ii)Modem iii)Telephone
c) Which of the following communication media, you will suggest to be procured by th
company for connecting their local offices in New Delhi for very effective and fast
communication.
i) Telephone Cable ii) Optical fibre iii) Ethernet cable
d) Suggest a Cable /Wiring layout for connecting the company’s local offices located in
New Delhi . Also, suggest an effective method /technology for connecting the company
‘s regional office at “Kolkata”,”Coimbatore and “Ahmedabad”.
32 Write a function in python, PushEl(element) and MakeEl(element) to add a new 5
element and delete a element from a List of element Description, considering
them to act as push and pop operations of the Stack data structure .
Or
Write a function in Python PUSH(A), where A is a list of numbers. From this list
push all even numbers into a stack implemented by using a list. Display the stack
if it has at least one element, otherwise display appropriate error message
33 Write a function countVowels() in Python, which should read each character of a 5
text file
“myfile.txt”, count the number of vowels and display the count.
Example:If the “myfile.txt” contents are as follows:
This is my first class on Computer Science.
The output of the function should be: Count of vowels in file: 10
Section E

34 Consider the following tables MobileMaster and MobileStock. Write SQL 5


commands for the statements (i) to (v) .
Table: MobileMaster
M_Id M_Company M_Name M_Price M_Mf_Date
MB001 Samsung Galaxy 4500 23-Jan-2004
MB003 Nokia N1100 2250 12-Dec-2003
MB004 Micromax Unite3 4500 14-Feb-2004
MB005 Sony XperiaM 7500 01-Jan-2004
MB006 Oppo SelfieEx 8500 19-Mar-2004

Table: MobileStock
S_Id M_Id M_Qty M_Supplier
S001 MB004 450 New Vision
S002 MB003 250 Praveen Gallery
S003 MB001 300 Classic Mobile Store
S004 MB006 150 A-one-Mobiles
S005 MB003 150 The Mobile
S006 MB006 50 Mobile Centre
i) Display the Mobile company, Mobile Name & Price in descending order of their
manufacturing date.
ii) List the details of mobile whose name starts with s
iii) Display the mobile supplier and quantity of all mobiles except MB003.
iv) Display the name of mobile company having price between 3000 and 5000

v) Display the name of company, supplier and Price by joining the joining the two
tables where price is more than 5000.
35 Pushpa writing a program to create a CSV file “item.csv” which will contain item 5
name, Price and quantity of some entries. He has written the following code. As
a programmer, help him to successfully execute the given task.
import # Line
def addInCsv(item,price,qty): # to write / add data into the CSV file
f=open(' item.csv',' ') # Line
csvFileWriter = csv.writer(f)
csvFileWriter.writerow([item,price,qty])
f.close()
#csv file reading code
defreadFromCsv(): # to read data from CSV file
with open(' item.csv','r') as csvFile:
newFileReader = csv. (csvFile) # Line
for row in newFileReader:
print (row[0],row[1],row[2])
csvFile. # Line
addInCsv('Note Book',45,100)
addInCsv('Text Book',60,150)

addInCsv('Ball Pen',10,100)
addInCsv('Pencil', 5,200)

readFromCsv() #Line
(a) Name the module he should import in Line 1.
(b) In which mode, Pushpa should open the file to add data into the file
(c) Fill in the blank in Line 3 to read the data from a csv file.
(d) Fill in the blank in Line 4 to close the file.
(e) Write the output he will obtain while executing Line 5.
SAMPLE PAPER SET-11
Class: XII Session SUBJECT : Compute
Science(083) TIME : 3 HOURS MM : 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
The value of the expression 5/(6*(4-2)) and 5/6*(4-2) is the same.

2. Which of the following is the data type of value, returned by input( ) method in 1
Python?
(a ) Boolean (b) String (c) Int (d) Float
3. Given the following dictionaries 1

Dict1={‘Tuple’:’immutable’,’List’:’mutable’,’Dictionary’:’mutable’,’String’:’immu
table’}

Which of the following will delete key:value pair for key=‘Dictionary’ in the
above mentioned dictionary?
a. del Dict1[‘Dictinary’]
b. Dict1[‘Dictionary’].delete( )
c. delete (Dict1.[“Dictionary”])
d. del(Dict1.[‘Dictionary’])
4. Consider the given expression: 1
print(2**5+8//3*7-2)
Which of the following will be correct output if the given expression evaluated?
(a) 44
(b) 34
(c) 42
(d) 36

5. Select the correct output of the code: 1


L1, L2 = [10, 23, 36, 45, 78], [ ]
for i in range :
L2.insert(i, L1.pop( ) )
print( L1, L2, sep=’@’)

(A) [78, 45, 36, 23, 10] @ [ ]


(B) [10, 23, 36, 45, 78] @ [78, 45, 36, 23, 10]
(C) [10, 23, 36, 45, 78] @ [10, 23, 36, 45, 78]
(D) [ ] @ [78, 45, 36, 23, 10]

6 If a file is opened for writing, which of the following statement is false 1


(a) If the file exists at the specified path, the file is successfully opened.
(b) Python gives error if the file does not exit at the specified path.
(c) The existing contents of the file will be erased as soon as you open the file.
(d) Python will create a new empty file at the specified path if the file does not
exist at the specified path.
7 A column added via ALTER TABLE command initially contains value for 1
all existing rows.
8 Which of the following is the correct command to delete an attribute Salary 1
from relation Employee.
(A) DELETE SALARY FROM EMPLOYEE;
(B) ALTER TABLE EMPLOYEE DELETE SALARY;
(C) ALTER TABLE EMPLOYEE DROP SALARY;
(D) DROP COLUMN SALARY FROM EMPLOYEE;
9 To include integrity constraint in an existing relation, we should use 1
statement.

(A) UPDATE TABLE


(B) ALTER TABLE
(C) MODIFY TABLE
(D) EDIT TABLE
10. The operator when used with a string and an integer gives an 1
error.
11 What is the significance of the seek method ? 1
(A) It seeks the absolute path of the file.
(B) It tells the current byte position of the file pointer within the file.
(C) It places the file pointer at a desired offset within the file
(D) It seeks the entire content of the file.
12 The sysntax of seek( ) method in Python is :- 1
File.object.seek(offset [, reference point])
In the above syntax the offset refers to :-
(A) Specifying Initial position of the file pointer.
(B) Specifying number of bytes.
(C) Specifying file opening mode.
(D) None of the above
13. The is a networking device that regenerates or recreates a 1
weak signal into its original strength and form.
14 What will be the output of the following Python code ? 1
T1= ( )
T2=T1 * 2
print(len(T2))

(A) 0
(B) 2
(C) 1
(D) Error
15 All aggregate function except ignore NULL values in order the 1
produce the output.
(A) AVG( )
(B) COUNT( )
(C) COUNT(*)
(D) TOTAL( )
16 To establish a connection between Python and SQL database, connect() 1
method is used. Identify the correct syntax of connect( ) method from the
followings.
(A) Connect(user=”user name”, passwd=”password”, host=”host
name”, database= “database name”)
(B) Connect(host=”host name”, user=”user name”,
password=”password”, database= “database name”)
(C) Connect(host=”host name”, user=”user name”, passwd=”password”,
database= “database name”)
(D) Connect(host=”host name”, database= “database name”, user=”user
name”, password=”password”)
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 and R is False.
(D) A is False and R is True.
17 Assertion (A) : A function is a block of organized and reusable code that is used 1
to perform a single related action.
Reason (R) : Function provides better modularity for your application and a
high degree of code reusability.
18 Assertion (A) : Text file stores information in ASCII or Unicode characters. 1
Reason (R) : CSV stands for comma separated value. These files are common
file format for transferring and storing data.
SECTION B

19 Anshika has written a code to calculate the factorial value of a number, but her 2
code is having some errors. Rewrite the correct code and underline the
corrections made.

def Factorial(Num)
1=fact
While num=>0:
fact=fact*num
num=-1
print(“Factorial value is =”,fact)
20. Differentiate between Viruses and Worms in context of networking and data 2
communication threats.
OR

Differentiate between Web server and web browser. Write any two popular
web browsers.
21 (A) Given is a Python List declaration : 1
L1=[11,23,16,28,55,37,61,89]
write the output of the code given below
: print(L1[-3:8])
(B) Given is a Python Dictionary : 1
Lib={“Novel”:152,”Magzine”:20,”Newspaper”:10,”Books”:250}
Write Python statement to delete key:value pair for key=”Novels”.
22 What is the difference between UNIQUE and PRIMARY KEY constraints in an 2
RDBMS.
23 (A) Expand the following terms :- 1
(I) FTP (II) GSM
(B) Danish has to share the data among various computers of his two offices 1
branches situated in the same city. Name the type of network which is being
formed in this process.
24 Predict the output of the Python code given below: 2
def Update(str1):
length=len(str1)
temp=""
for i in range(0, length):
if str1[i].islower():
temp=temp+str1[i].upper()
elif str1[i].isupper():
temp=temp+str1[i].lower()
elif str1[i].isdigit():
temp=temp+str(int(str1[i])+1)
else:
temp=temp+'#'
print(temp)
Update("CBSE-2023 Exams")

OR
Mydict={}
Mydict[(1,2,3)]=12
Mydict[(4,5,6)]=20
Mydict[(1,2)]=25
total=0
for i in Mydict:
total=total+Mydict[i]
print(total)
print(Mydict)
25 Define the following terms in context with RDBMS:- 2
(I) Degree (II) Cardinality

OR
Write the full form of DDL and DML. Also write any two examples of DDL and
DML.
SECTION C

26 (A) Consider the following tables – Employee and Department 1+2


EMPLOYEE
Ecode Ename
M01 Bhavya
M02 Krish
S01 Mehul
S03 Sanket
A05 Vansh
H03 Pallavi

DEPARTMENT
Ecode Department
M01 Marketing
S01 Sales
A05 Accounts
H03 HR
What will be the output of the following statement?
SELECT E.Ecode,E.Ename,D. Department FROM EMPLOYEE E,
DEPARTMENT D WHERE E.Ecode = D.Ecode;

(B) Write the output of the queries (i) to (iv) based on the table PRODUCT and
CUSTOMER given below :
PRODUCT
P_ID P_Name Manufacturer Price Discount
TP01 Talcum Powder LAK 40
FW05 Face Wash ABC 45 5
BS01 Bath Soap ABC 55
SH06 Shampoo XYZ 120 10
FW12 Face Wash XYZ 95

CUSTOMER
C_ID C_Name City P_ID
01 Cosmetic Shop Delhi TP01
02 Total Health Mumbai FW05
03 Live Life Delhi BS01
04 Pretty Woman Delhi SH06
05 Dreams Delhi TP01
i. SELECT P_Name, count(*) FROM Product GROUP BY P_Name;

ii. SELECT Max(Price), Min(Price) FROM Product;

iii. SELECT Product.P_Name, Client.C_Name FROM Product, Client


WHERE Product.P_ID = Client.P_ID AND Client.City=”Mumbai”;
iv. SELECT P.P_Id, P.P_Name, C.C_Name, C.City, P.Price FROM Product P, Client
C WHERE Product.P_ID = Client.P_ID AND Client.City=”Mumbai” ORDER BY
P.Price DESC.;
27 Write a method COUNT_UPPER() in Python to read lines from Text File 3
“CONTENT.TXT” and display the count of uppercase alphabets in the File.

Example :
If the file contents are as follows:-

All India Senior Secondary Certificate Examination.

The COUNT_UPPER() function should display the output as :


The number of uppercase alphabets in the file :- 6

OR
Write a method COUNT_WORD()in Python to read lines from a text file
“PLEDGE.TXT” and count and display the occurrences of the word “country” in
the file.
Example :-
If the content of the file are as follows :-

India is my country and all Indians are my brothers and sisters. I love my country
and I am proud of its rich and varied heritage. I shall always strive to be worthy
of it.
I shall give respect to my parents, teachers and elders and treat everyone with
courtesy.
To my country and my people, I pledge my devotion. In their well being and
prosperity alone, lies my happiness.
The COUNT_WORD() function should display the output as :
Total Occurrences of word “country” = 3
28 (A) Write the outputs of the SQL queries (i) to (iv) based on the relations CAR 2+1
and OWNER given below:-

CAR
C_code Carname Make Color Capacity Charges
501 Ignis Suzuki Blue 5 14
503 Saltoz Tata White 5 16
502 Innova Toyota Silver 7 18
509 SX4 Suzuki Black 5 20
510 NIOS Hyundai Grey 5 15

CUSTOMER
C_Id Cname C_code
1001 Vansh Sharma 501
1002 Shivanand 509
1003 Tanish Sharma 503
1004 Palak 502
(i) SELECT COUNT(DISTINCT Make) FROM CAR;
(ii) SELECT MAX(Charges), MIN(Charges) FROM CAR;
(iii) SELECT COUNT(*), Make FROM CAR;
(iv) SELECT Carname FROM CAR WHERE Capacity=7;

(B) Write SQL Command to show the list of all the databases.

29 Write a function R_Shift(Arr,n) in Python, which accepts a list Arr of numbers 3


and n is a numeric value by which all elements of the list are shifted to right and
the last element removed should be added in the begining.
Sample Input Data of the list
Arr=[ 1,2,3,4,5,6], n=2
Output
Arr = [5, 6, 1, 2, 3, 4]

30. A List contains following record of a Book : 3


[Book Name, Write Name, Price]
Write the following user defined functions to perform given operations on the
stack named “BOOK” :
(i) Push_Rec( ) – To push the record containing Book name and author
name of Books having price > 500 to the stack.
(ii) Pop_Rec( ) – To pop the objects from the stack and display them. Also
display “STACK UNDERFLOW” when there are no elements in the Stack.
OR
Write a function in Python, Push(Item) where Item is a list containing the details
of Bakery Items – [[Name, Price], [Name, Price], [Name, Price]]
The function should push the names of those items in the Stack who have price
less than Rs. 50. Also display the count of elements pushed into the Stack.
Example:
If the list contains the following items :
l=[['ravi',26],['raman',36],
['chaman',56]] The Stack should contain :
Ravi
Raman
The output should be :
The number of elements in stack is : 2
31 Rising Sun Corporation is a professional IT company. The company is planning to
set up their new offices in India with its hub at Hyderabad. The company has 03
Block named Conference Block, Finance Block, and Human Resource Block.
Suggest them the best available solutions based on the queries (i) to (v) as
mentioned below :
Block to Clock distance in Meters :
 Human Resource to Conference Block – 55 mtr.
 Human Resource to Finance – 110 mtr
 Conference to Finance – 90 mtr.
No. of computers to be installed in each block :-
 Human Resource – 150
 Finance - 45
 Conference – 75

(i) What will be the most appropriate block, where RSC should plan to 1
house the server?
(ii) Suggest the cable layout to connect al the buildings in the most 1
appropriate manner for efficient communication.
(iii) What will the best suitable connectivity out of the following to 1
connect the offices in Bangalore with its New York based office.
(a) Infrared (b) Satellite Link (c ) Ethernet Cable
(iv) Suggest the placement of the following devices with justification.
(a) Hub / Switch (b) Repeater 1
(v) Which service / protocol will be most helpful to conduct the live
interactions of Experts from New York to Human Resource Block. 1
32 (A) Write the output of the Python code given below 2+3
: a=10
def fun(x=10,y=5):
global a
a=y+x-3
print(a,end="@")
i=20
j=4
fun(i,j)
fun(y=10,x=5)
(B) The code given below inserts th following record in the table Employee:
ECode – Integer
EName – String
Deptt – String
Salary – Float
Note the following to establish connectivity between Python and MYSQL :
 Username is admin
 Password is Hello123
 Database is KVS
 The Department of the employee will be entered by the user in order
to get the list of employees in the department.
Write the following missing statements to complete the code:
Statement 1 – To form the cursor object.
Statement 2 – To execute th command that searches for the employee code in
the table Employee.
Statement 3 – To show all the records returned by the query.
import mysql.connector as con
def Emp_data():
mycon=con.connect(host=”localhost”,user=”admin”,passwd=”Hello123
”,database=”KVS”)
mycursor= # Statement 1
Dept=input(“Enter Department name to be searched for =”)
Qry_Str=”Select * from Employee where deptt=”+Dept
# Statement 2
Mydata= # Statement 3
for row in Mydata:
print(row)
mycon.close()
OR
(A) Predict the output of the code given below:
x=[1,2,3]
ctr=0
while ctr<len(x):
print(x[ctr]*’#’
for y in x:
print(y*’$ ‘)
ctr+=1

(B) The code give below reads the following record from the table
named “SALES” and update those records who have Sale>50000 in
order to provide commission 4% of Sale amount.
Scode – integer
Sname- String
Saleamt – Float
Commission – Float
Note the following to establish conectivity between Python and MySQL :
 Username is root
 Password is Scott
 Database Name : Company
Write the following missing statements to complete the code :
Statement 1 – to form the cursor object
Statement 2 – to execute the query to update the commission column as 4% of
Saleamount for those records only who have Sale>50000.
Statement 3 – to add the data parmanently in the database.

import mysql.connector as con


def Sale_data():
mycon=con.connect(host=”localhost”,user=”root”,passwd=”Scott”,data
base=”Company”)
mycursor= # Statement 1
Qry_Str=”Update SALES set commission = Saleamt*4/100 where
Saleamt>50000;”
# Statement 2
# Statement 3
mycon.close()
33 What is a reader object in CSV files? 5
Write a program in Python that defines and calls the following user defined
functions:-
(a) AddUser() – to accept and the username and password to a CSV file
“Users.CSV”. Each record consists of a list with field elements as UID
and PWD to store User ID and Password respectively.
(b) Search() – To search and display the password of the given User ID.

OR

(a) What is a CSV file?


(b) Write a program in Python that defines and calls the following user
defined functions:
WriteCSV() – to accept RollNo, Name and Marks of a student from the
user and Write it to CSV file.
ReadCSV() – To read the contents from the CSV file and display it to the
user.

34. Karan creates a table GAMES with a set of records to store the details of Games 1+1+2
like Name of Game, Type of Game, Prize Money etc. as given below. After
creation of the table, he has entered some records as shown below :
GCode GName Type PrizeMoney ScheduleDate
101 Badminton Outdoor 15000 10-Oct-2021
102 Chess Indoor 20000 01-JUL-2020
103 Table Tennis Indoor 10000 01-Mar-2022
104 Carom Board Indoor 8000 15-AUG-2023
105 Cricket Outdoor 25000 01-DEC-2022

Based on the data given above answer the following questions :-


(i) Identify the column which could be considered as PRIMARY KEY.
(ii) What will be the degree and Cardinality of the above table?
(iii) Write the statement to :
(a) Increase the prize money by 20% for all the Games.
(b) List the name of the Game and Prize Money whose Game name
starts with ‘C’.
OR (Option for part iii only)
(iii) Write statement to :-
(a) Add a new column NoOfPlayers with data type as integer.
(b) Print the sum of the column PrizeMoney.
35 Vanshika is learning Python and working with Binary Files. Her teacher has given 4
her the following incomplete, which is creating a binary file “Student.dat” which
contains student’s details (RNo, Name and Marks) in the form of List.She now
has to open the file, search for the Roll No., which will be entered by the user
and display the Student’s Details, if roll no. found otherwise print the message
“Roll Number Not Found”.
The content of the List are : [Rollno, Name, Marks]
As a Python programmer, help her to complete the following code based on the
requirement given below:
import # Statement 1
def ReadData() :
rec=[]
fin.open( ) # Statement 2
found=False
rno=int(input(“enter the Roll No. of the Student=”))
while True:
try :
rec= # Statement 3
if : # Statement 4
found=True
print(“Student Roll Number=”,rec[0])
print(“Student Name=”,rec[1])
print(“Total Marks obtained=”,rec[2])
except:
print(“File not found”)
if found==False:
print(“Record Not Found”)
fin.close() 1
(i) Which module should be imported in the program? (Statement 1)
(ii) Write the correct statement to open the file Student.dat in the 1
required mode. (Statement 2)
(iii) Write the correct statement to read the data from the binary file and 1
store it in rec. (Statement 3)
(iv) Write the correct condition to match the Roll no of the student in the 1
file with the Roll no. entered by the user.
SAMPLE PAPER SET-12
Class: XII Session SUBJECT : Computer Science(083)
TIME : 3 HOURS MM : 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
Q.1 Which of the following are in-valid operators in 1
Python? (A) += (B) ^ (C) =+ (D) &&
Q.2 Which function is used to remove the given characters from trailing end i.e. right end of a string? 1
(A) strip( ) (B) remove( ) (C) lstrip( ) (D) rstrip( )
Q.3 Predict the output of following python 1
code. SS="PYTHON"
print( SS[:3:])
(A) THON (B) PYT (C) PYTH (D) HON
Q.4 A Python List is declared as Stud_Name = ['Aditya', 'aman', 'Aditi','abhay'] 1
What will be the value of min(Stud_Name)?
(A) abhay (B) Aditya (C) Aditi (D) aman
Q.5 Choose the correct output of following 1
code: Tup=(100)
print(Tup*3)
(A) (300,) (B) (100,100,100) (C) Syntax Error (D) 300
Q.6 In a stack, if a user tries to remove an element from empty stack it is called 1
(A) Underflow (B) Empty (C) Overflow (D) Blank
Q.7 Which method is used for object serialization in Python? 1
(A) Pickling (B) Un-pickling (C) Merging (D) None of the above
Q.8 Which types of arguments/parameters supports by Python? 1

PS-SP-QP-XII-CS-22-23 1 | Page
(A) Positional Argument (B) Default Arguments
(C) Keyword (or named) Arguments (D) All of Above
Q.9 If a function in python does not have a return statement, which of the following does the function 1
return?
(A) int (B) float (C) None (D) Null
Q.10 A is a set of rules that governs data communication. 1
(A) Forum (B) Protocol (C) Standard (D) None of the above
Q.11 Select correct collection of DDL Command? 1
(A) CREATE, DELETE, ALTER, MODIFY (B) CREATE, DROP, ALTER, UPDATE
(C) CREATE, DROP, ALTER, MODIFY (D) CREATE, DELETE, ALTER, UPDATE
Q.12 Which statement is used to display the city names without repetition from table Exam? 1
(A) SELECT UNIQUE(city) FROM Exam; (B) SELECT DISTINCT(city) FROM Exam;
(C) SELECT PRIMARY(city) FROM Exam; (D) All the above
Q.13 Ronak want to show the list of movies which name end with ‘No-1’. Select the correct query if table 1
is MOVIE and field attribute is Movie_Name.
(A) SELECT Movie_Name FROM MOVIE WHERE Movie_Name = ‘%No-1’;
(B) SELECT Movie_Name FROM MOVIE WHERE Movie_Name = ‘No-1%’;
(C) SELECT Movie_Name FROM MOVIE WHERE Movie_Name LIKE ‘%No-1’;
(D)SELECT Movie_Name FROM MOVIE WHERE Movie_Name LIKE ‘No-1%’;
Q.14 Which Constraint not allow to enter repeated values in the table? 1
(A)PRIMARY KEY (B) UNIQUE (C) BOTH A and B (D) None of
above
Q.15 COMMIT command is belongs to 1
(A)DDL Command (B) DML Command (C) TCL Command (D) None of the above
Q.16 Which function is used to create a cursor in Python – SQL connectivity? 1
(A)fetch() function (B) execute() function (C) connect() function (D) curse()
function
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
Q.17 Assertion (A):- In stack, program should check for Underflow condition, before executing the pop 1
operation.
Reasoning (R):- In stack, underflow mean there is no element available in the stack or stack is an
empty stack.
Q.18 Assertion (A):- The readlines() method in python reads all lines from a text file. 1
Reasoning (R):- The readlines() method returns the tuple of lines(string).
SECTION-B
Q.19 A student has written a code to print a pattern of even numbers with equal intervals. His code is 2
having errors. Rewrite the correct code and underline the corrections made.
def pattern(start=0, end, interval):

PS-SP-QP-XII-CS-22-23 2 | Page
for n in range(start: end, interval):
if(n%2==1):
print(n)
else
pass
x=int(input("Enter Start Number: "))
y=int(input("Enter End Number: "))
z=int(input("Enter Interval: "))
pattern(x,y,z)
Q.20 (A) line="T-20 Cricket World Cup 2022" 2
x=line[::-1]
print(a[0:4:1][::-1])
(B)
India={"Animal":"Tiger","Bird":"Peacock","Flag":"Tri-Color"}
India["Capital"]="New Delhi"
print(India.values())
Q.21 Find and write the output of the following python code: 2
def Alter(P=15,Q=10):
P=P*Q
Q=P/Q
print(P,"#",Q)
return Q

A=100
B=200
A=Alter(A,B)
print(A,"$",B)
B=Alter(B)
print(A,"$",B)
Q.22 Write full form on given abbreviation 2
(i) URL
(ii) SMTP
Q.23 Explain the difference between webpage and website with examples of each. 2
OR
What is the difference between Packet Switching and Circuit Switching?
Q.24 What is the role of connect() and rowcount() methods in python. 2
Q.25 What is the importance of UNIQUE constraints in a table? Give a suitable example. 2
OR
Explain the terms degree and cardinality with example in reference to table.
SECTION-C 2
Q.26 Write a method COUNT_WORDS() in Python to read text file ‘STUDENT.TXT’ and display the
total number of Words in the file which start with ‘S’ and end with ‘R’.
your output should shown like given below:
No. of word found: …….
Q.27 Write definition of a function How_Many(List, elm) to count and display number of times the value 3
of elem is present in the List. (Note: don’t use the count() function)
For example :
If the Data contains [205,240,304,205,402,205,104,102] and elem contains 205
The function should display 205 found 3 Times

PS-SP-QP-XII-CS-22-23 3 | Page
Q.28 Write PUSH_CITY(cities) and POP_CITY(cities) methods/functions in Python to add new city name 3
and delete city name from a List of cities, considering them to act as push and pop operations of the
Stack data structure.
OR
Write a function in Python PUSH_VAL(val), where val is a list of numbers. From this list push all
odd numbers into a stack implemented by using a list. Display the stack if it has at least one element,
otherwise display appropriate messages.
Q.29 Consider the following tables SCHOOL and ADMIN and answer this question :
Give the output the following SQL queries :

(A) SELECT TEACHER, SUBJECT, GENDER FROM SCHOOL , ADMIN


WHERE SCHOOL.CODE=ADMIN.CODE
AND 1
SCHOOL.EXPERIENCE<5 ;
(B)
(i) Select Designation Count (*) From Admin Group By Designation Having Count (*) <2;
(ii) SELECT max (EXPERIENCE) FROM SCH•OOL;
(iii) SELECT TEACHER FROM SCHOOL WHERE EXPERIENCE >12 ORDER
BY TEACHER;
(iv) SELECT COUNT (*), GENDER FROM AD•MIN GROUP BY GENDER;

PS-SP-QP-XII-CS-22-23 4 | Page
PS-SP-QP-XII-CS-22-23 5 | Page
Q.30 Write a output for SQL queries (i) to (iii), which are based on the table: SCHOOL and ADMIN given 3
below:
TABLE: SCHOOL

(a) SELECT SUM (PERIODS), SUBJECT FROM SCHOOL GROUP BY SUBJECT;


b) SELECT TEACHERNAME, GENDER FROM SCHOOL, ADMIN WHERE DESIGNATION = ‘COORDINATOR’
AND SCHOOL.CODE=ADMIN.CODE;
c) SELECT COUNT (DISTINCT SUBJECT) FROM SCHOOL;
SECTION-D
Q.31 Excel Public School, Coimbatore is setting up the network between its different wings of school campus. 5
There are 4 wings namely SENIOR(S), JUNIOR (J), ADMIN (A) and HOSTEL (H).

PS-SP-QP-XII-CS-22-23 6 | Page
Distances between various wings are given below:
Wing A to Wing S 100m
Wing A to Wing J 200m
Wing A to Wing H 400m
Wing S to Wing J 300m
Wing S to Wing H 100m
Wing J to Wing H 450m
Number of Computers installed at various wings are as follows:
Wings Number of Computers
Wing A 20
Wing S 150
Wing J 50
Wing H 25
(a) Suggest the best-wired medium and mention the topology or layout to connect
various wings of Excel Public School, Coimbatore.

(b) Name the most suitable wing to house the server. Justify your answer.

(c) Suggest placement of HUB/SWITCH in the network of the School.

(d) Suggest a device that can provide wireless Internet access to all smartphone/laptop
users in the campus of Excel Public School, Coimbatore.

(e) What should be the Network Topology among all blocks of the organization :
(a) LAN (B) MAN (c) WAN (IV) Any of these
Q.32 (A). Write the output of following Python code. 2
def change(): +
Str1="WORLD-CUP2022" 3
Str2=""
I=0
while I<len(Str1):
if Str1[I]>="A" and Str1[I]<="M":
Str2=Str2+Str1[I+1]
elif Str1[I]>="0" and
Str1[I]<="9": Str2=Str2+
(Str1[I-1])
else:
Str2=Str2+"*"
I=I+1
print (Str2)
change():
PS-SP-QP-XII-CS-22-23 7 | Page
PS-SP-QP-XII-CS-22-23 8 | Page
(B). The code given below extract the following record in from the table Emp whose salary is more
than Rs. 50000:
EmpNo – integer
EmpName – string
Age– integer
Salary – integer
Note the following to establish connectivity between Python and MYSQL:
∙ Username is root
∙ Password is tiger
∙ The table exists in a MYSQL database named BIG_COMPANY.
∙ The details (EmpNo, EmpName, EmpAge and EmpSalary) are to be accepted from the
user. Write the following missing statements to complete the code:
Statement 1 – To create the cursor object
Statement 2 – To execute the command that extract the records of those employees whose salary is
greater than Rs. 50000.
Statement 3 -- To store records from cursor to an object named EmpRecord.
import mysql.connector as cntr
def Emp_Big_Company():
con=cntr.connect(
host="localhost",
user="root",
password="tiger",
database="big_company")
EmpCursor= # Statement 1
print("Display Employee whose salary is more than Rs. 50000:")
# Statement 2
EmpRecord= #Statement 3
for record in EmpRecord:
print(record)
Q.33 (A) Write any two difference between text file and binary file?
(B) Write a Program in Python that defines and calls the following user defined functions:
Add_Book():
To accept data of new book and add to ‘library.csv’ file. The record of book consists
book_id, book_name and book_price in form of python list.
Show_Book():
To read the records of books from ‘library.csv’ file and display the record of books
which price is more than Rs. 500.
SECTION-E
Q.34 Lovepreet is a senior clerk in a MNC. He creates a table salary with a set of records to keep ready for 4
tax calculation. After creation of the table, he has entered data of 5 employees in the table.

Based on the data given above answer the following questions


(i) Identify the most appropriate Attribute, which can be considered as Primary key. Also
mention the degree and cardinality of above table.
PS-SP-QP-XII-CS-22-23 9 | Page
(ii) Write SQL Command to drop primary key from emp_id attribute of table.
(iii) Write SQL Command to Increase the HRA by 1% of respective basic salary of all employees.
(iv) Write SQL Chand to Display the Employee Name and their designation whose basic salary
is between 50000 and 80000.
Q.35 Tarun is a student, who wants to make a python program for Sports Department . He is using binary 4
file operations with the help of two user defined functions/modules.
(A) New_Entry() to create a binary file called SPORTS.DAT containing sports related
material information- item_id, item_name and item_qty.
(B) Show_Item() to display the item _name and item_qty of items which item_qty less than 5.
In case there is no item available that which quantity is less than 5 the function displays message.
He has abled to write partial code and has missed out certain statements, so he has left certain queries
in lines. You as an expert of Python have to provide the missing statements and other related queries
based on the following code of Tarun.
Answer any four questions (out of five) from the below mentioned questions.
import pickle
def Add_New_Product():
fopen= #1 statement to open the binary file to write
data
while True:
Prod_id = int (input (“Enter Product ID: ”) )
Prod_name = input (“Enter Product Name: ”) )
Prod_price = float (input(“Enter Product Price: ”))
record = [sid, name , age]
#2 statement to write the list record into the file
Choice = input(“Are hou wants to Enter more Records(y/n): ” )
if (Choice.upper() =='N'):
break
fopen.close( )
def Show_Product():
Total = 0
Count_rec = 0
Count_price = 0
with open(“ PRODUCTS.DAT”, “ rb”) as F:
while True:
try:
Rec= #3 statement to read from the file
Count_rec = Count_rec+1
Total = Total+Rec[2]
if Rec[2] : #4statement product which Prod_price<100
print (Rec[1],“ price is :”,Rec[2])
Count_price+ = 1
except:
break
if Count_price = =0 :
print(“No such product found which price iss less than Rs. 100”)

Add_New_Product()
Show_Product()

PS-SP-QP-XII-CS-22-23 10 |
Page
PS-SP-QP-XII-CS-22-23 11 |
Page

You might also like