Professional Documents
Culture Documents
083 - CS - With - Python - Class 12 - Sample Paper 1 - Unsolved
083 - CS - With - Python - Class 12 - Sample Paper 1 - Unsolved
Year: 2022-23
Class 12
General Instructions:
4. Section B has 07 Very Short Answer type questions carrying 02 marks each.
7. Section E has 02 questions carrying 04 marks each. One internal choice is given in Q35 against part c only.
ps
8. All programming questions are to be answered using Python Language only.
Ki
3. Which of the following options will not result in an error when performed on tuples in Python 1
where tupl=(5,2,7,0,3)?
a) tupl[1]=2
b) tupl.append(2)
c) tupl1=tupl+tupl
d) tupl.sort()
4. What is the value returned by find() function for an unsuccessful search of sequence in the given 1
string?
a) Error
b) False
5.
c) 0
d) -1
car = {
ps
Choose the appropriate statement to change the "year" value from 2000 to 2015.
}
Ki
a) car["year"] = 2015
b) car.year = 2015
c) car.year[2015]
d) year = 2015
7. To give a temporary name to a table or a column in a table for more readability, what is used? 1
a) SQL Wildcards
b) SQL aliases
c) SQL LIKES
d) SQL Comments
8. By using an aggregate function, the __________clause filters the results of the GROUP BY 1
clause.
a) HAVING
a) Error
b) No Error
11. To read two characters from a file object infile, we use ____________. 1
a) infile.read(2)
12.
ps
b) infile.read(0,3)
c) infile.readline(2)
d) infile.readlines()
13. In an environment with many high-voltage devices, the best transmission medium would be 1
Ki
_______.
a) Twisted-pair cable
b) Coaxial cable
c) Optical fibre
d) None of these
14. Observe the given SQL query and choose the correct option. 1
a) Mysql-connector
b) Connector-Python
c) Python-connector
d) Mysql-Python-connector
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 , but 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): The scope refers to different parts of the function and program within which a 1
variable or value is legal and accessible.
Reason (R): Global is a keyword to create global variable.
18. Assertion (A): The pickling module consist of two main functions. load() is used during the 1
19.
ps
pickling process, whereas dump() is used during unpickling process.
Reason (R): You can use load() and dump() function by adding pickle module. You can use
"import pickle" statement to include the pickle module in your program.
Part- B
Sejal has written a code to print prime numbers between given range. Her code is having errors.
Rewrite the correct code and underline the corrections made.
2
def prime(lower,up)
Print("Prime numbers between", lower, "and", upper, are:)
Ki
for num in range(lower, upper + 1):
if num > 1:
for i in range(2, num)
if (num % i) = 0:
break:
else:
print(num)
def prime(10,20)
20. Your friend wishes to install a wireless network in his office. Explain to him the difference 2
between guided and unguided media.
OR
22. What is the difference between the primary key and unique key? 2
24.
ps
Predict the output of the Python code given below:
dic1={10:0, 20:2}
dic2={30:3, 40:4}
dic3={50:5,60:6}
dic4 = {}
for d in (dic1, dic2, dic3):
dic4.update(d)
print(dic4)
OR
2
Ki
def Display(str):
m=""
for i in range(0,len(str)):
if(str[i].isupper()):
m=m+str[i].lower()
elif str[i].islower():
m=m+str[i].upper()
else:
if i%2==0:
m=m+str[i-1]
else:
m=m+"#"
print(m)
Display('Fun@Python3.0')
25. Differentiate between fetchone() and fetchall() methods with suitable examples for each. 2
OR
Differentiate between degree and cardinality.
26. 1+1+
a) 1
SELECT *
FROM foods
NATURAL JOIN company;
b) ps
Twinkle is using a table EMPLOYEE. It has the following columns:
Code, Name, Salary, Dept code. She wants to display maximum salary Department wise.
She wrote the following command:
27. Write a function in Python to count and display the total number of words in a text file. 3
OR/
Write a function display_words() in Python to read lines from a text file "poem.txt", and display
those words, which are less than 4 characters.
28. a) Write SQL queries for (i) to (iv), which are based on the following tables. 3
TABLE : ACCOUNT
i. To display the details of all the transactions of TYPE Deposit from Table TRANSACT.
ii. To display the ANO and AMOUNT of all Deposits and Withdrawals done in the month
of October 2017 from table TRANSACT.
iii. To display the last date of transaction (DOT) from the table TRANSACT for the
Accounts having ANO as 103.
iv. To display all ANO, ANAME and DOT of those persons from tables ACCOUNT and
TRANSACT who have done transactions less than or equal to 3000.
29. Write a Python program using the function to accept characters in a list, then find and display 3
30.
ps
vowels present in the list.
Write a menu-based program to add, delete, and display the record of hostel using list as stack
data structure in Python. Record of hostel contains the following fields: Hostel number, Total
Students, and Total Rooms.
OR
3
Ki
Write push(rollno) and pop() method in Python:
a) push(rollno) --add roll number in Stack.
b) pop() --- remove roll number from Stack.
Part- D
31. Western School in Mumbai is starting up the network between its different wings. There are four
buildings, named as SENIOR, JUNIOR, ADMIN, and HOSTEL as shown below:
1
1
a) Suggest the cable layout of connections between the buildings.
b) Suggest the most suitable place (i.e., building) to house the server of this school and 1
ps
provide a suitable reason.
c) Suggest the placement of the following devices with justification:
• Repeater
• Hub/Switch
d) The organisation also has an inquiry office in another city about 50-60 km away in a hilly
region. Suggest the suitable transmission media to interconnect to school and inquiry
office out of the following:
• Fibre optic cable
• Microwave
• Radio waves
1
e) Suggest a protocol that shall be needed to provide video conferencing solution between
Ki
various buildings.
def calcSquare(a):
a = power(a, 2)
return a
def power (b , p):
r = b**p
return r
n=5
result = calcSquare(n)
print(result)
RollNo – integer
Name – string
OR
ps
a) Predict the output of the code given below:
s="PyThontest2"
n = len(s)
m=""
for i in range(0, n):
if (s[i] >= 'a' and s[i] <= 'm'):
m = m +s[i].upper()
elif (s[i] >= 'n' and s[i] <= 'z'):
m = m +s[i-1]
elif (s[i].isupper()):
Ki
m = m + s[i].lower()
else:
m = m +'&'
print(m)
RollNo – integer
Name – string
Age – integer
Write the following missing statements to fetch all records of a table Student at run time:
Statement 1 – to form the cursor object
import mysql.connector
mydb=mysql.connector.connect(host="localhost",user="root",passwd="
123" ,database="school")
mycursor=_________________________# Statement 1
mycursor._____________________ # Statement 2
myrecords=___________________ # Statement 3
for x in myrecords:
print (x)
33. Write a program to search the record from “data.csv” according to the admission number input 5
from the user. The structure of record saved in “data.csv” is Adm_no, Name, Class, Section, and
Marks. Also, write a function ADD() to accept and add data of an employee to a CSV file
‘data.csv’. Each record consists of a list with field elements as Adm_no, Name, Class, Section, and
Marks, respectively.
OR
1, Amit, 87
2, Aman, 98
3, Pooja, 85
ps
a) Give any one point of difference between a binary file and a csv file.
b) Write a program to show the details of the student who scored the highest marks. Data
stored in “Details.csv” is given below:
4, Sandhya, 80
PART E
Ki
34. 1. Write SQL queries for (i) to (iv), which are based on the tables Account and Transact. 4
TABLE : ACCOUNT
TABLE : TRANSACT
35. Harsh is working on his class project and wrote the following program to write Name and Roll 4
numbers into a binary file. As a Python expert, help him to complete the following code based on
the requirement given above:
import _________________#statement 1
with open ("file.dat", "wb") as ____________#Statement 2:
while True:
op = int (input ("Enter 1 to add data, 0 to quit"))
if (op == 1):
name = input ("Enter name : ")
rollno = int (input ("Roll no : "))
____________._______([name,rollno],F1) # statement 3
ps
elif op == 0:
break