Nothing Special   »   [go: up one dir, main page]

2

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 11

SET-1

KENDRIYA VIDYALAYA SANGATHAN, RAIPUR REGION


Class- XII Computer Science (083)
(2022-23)
Maximum Marks: 70 Time Allowed: 3
hours 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. Find the invalid identifier from the following 1
a) KVS_Jpr b) false c) 3rdPlace d) _rank
2. Consider a string t = “hello” . Identify the statements that will result in an error. 1
i. print (t(0)) ii. print(min(t)) iii. t[3]= ‘k’ iv.
print (max(t))
a. only ii b. both ii and iv c. iii d. both ii and iii
3. Identify the output of the following Python statements, where L1 is a List 1
L1=[6,4,2,9,7]
print(L1[3:]= “100”)
(a) [6,4,2,9,7,100] (b) [6,4,2,100] (c) [6,4,2,1,0,0] (d) [6,4,2,
‘1’,’0’,’0’]
4. Identify the Invalid relational operator in Python from the following. 1
a) <= b) > c) == d) <>
5. Which of the following statements create a dictionary? 1
a) d = {}
b) d = {“john”:40, “peter”:45}
c) d = {40:”john”, 45:”peter”}
d) All of the mentioned above
6. A text file is opened using the statement f = open(‘story.txt’). The file has a total 1
of 10 lines.Which of the following options will be true if statement 1 and
statement 2 are executed in order.
Statement 1: L1 =
f.readline( )
Statement 2: L2 =
f.readlines( )
a. L1 will be a list with one element and L2 will be list with 9 elements.
b. L1 will be a string and L2 will be a list with 10 elements.
c. L1 will be a string and L2 will be a list with 9 elements.
d. L1 will be a list with 10 elements and L2 will be an empty list.
8
7. Fill in the blank: command is used to remove database from MySQL. 1
(a) update (b)remove (c) alter (d)drop
8. Which one of the following functions is used to find the largest value from 1
the given data in MySQL?
i. MAX( )
ii. MAXIMUM( )
iii. BIG( )
iv. LARGE( )
9. What will be the output of this Python line? 1
print("This is Delhi. # Delhi is the capital of India.") # This is a comment.
a. This is Delhi.
b. This is Delhi. # Delhi is the capital of India. # This is a comment.
c. This is Delhi. # Delhi is the capital of India.
d. This is Delhi. This is a comment.
10. Which SQL statement do we use to find out the total number of records present in 1
the table ORDERS?
i. SELECT * FROM ORDERS;
ii. SELECT COUNT (*) FROM ORDERS;
iii. SELECT FIND (*) FROM ORDERS;
iv. SELECT SUM () FROM ORDERS;
11. Which of the following is not a function/method of a file object in python? 1
a.read( )
b.writelines( )
c.dump( )
d.readlines( )
12. If column “Fees” contains the data set (5000,8000,7500,5000,8000), what will be 1
the output after the execution of the given query? SELECT SUM (DISTINCT
Fees) FROM student;
i. 20500
ii. 10000
iii. 20000
iv. 33500
13. is the trail of data we leave behind when we visit any website (or 1
use any online application or portal) to fill-in data or perform any transaction.
i. Offline phishing
ii. Offline footprint
iii. Digital footprint
iv. Digital phishing
14. What will the following expression be evaluated to in Python? 1
print(15.0 / 4 + (8 + 3.0))
(a) 14.75 (b)14.0 (c) 15 (d) 15.5
15. Which one of the following is not an aggregate function? 1
i. ROUND()
ii. SUM()
iii. COUNT()
iv. AVG()
16. To establish a connection between Python and SQL database, connect() is used. 1
Which of the following arguments may not necessarily be given while calling
connect() ?

9
(a) host
(b) database
(c) user
(d) 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 but R is False
(d) A is false but R is True
17. Assertion (A):- Pickle is library of Python. 1
Reasoning (R):- This may raise the center of gravity of the boat.
18. Assertion (A):- Dictionaries are mutable. 1
Reason (R):- Individual elements can be changed in dictionary in place.
Section B
19. Find the error(s) in the following code snippet and write the corrected code. 2
Def check():
N=25
for i in range(0,N):
if N%2=0:
print(N*2)
elif N%3==0
print(N*3)
Else:
print(N)
check()
ANS)
Find the error(s) in the following code snippet and write the corrected code.
20. Write one advantage of star topology over bus topology and one advantage of bus 2
topology over star topology
OR
Suzuka, a freelance web site developer, has been assigned a task to design few web
pages for a book shop. Help Suzuka in deciding out of static web page and dynamic
web page, what kind of web pages should be designed by clearly differentiating
between static and dynamic web pages on at least two points.
21. (a) Given is a Python string declaration: 1
myexam="@@CBSE Examination 2023@@"
Write the output of: print(myexam[::-3])

(b) Write the output of the code given below:


my_dict = {"name": "Aman", "age": 26} 1
my_dict['age'] = 27
my_dict['address'] = "Mumbai"
print(my_dict.items())
22. Give difference between primary key and foreign key 2
23 a) Expand the following: 2
FTP , HTML
b) Which type of network (out of LAN, PAN and MAN) is formed, when
you connect two mobiles using Bluetooth to transfer a video?
24 Predict the output of the Python code given below: 2

10
TXT = ["20","50","30","40"]
CNT = 3
TOTAL = 0
for C in [7,5,4,6]:
T = TXT[CNT]
TOTAL = float(T) + C
print(TOTAL)
CNT -= 1
OR
Predict the output of the Python code given below:
def runme(x=1, y=2):
x = x+y
y+=1
print(x, '$', y)
return x,y
a,b = runme()
print(a, '#', b)
runme(a,b)
print(a+b)
25 What is the difference between the order by and group by clause when used along 2
with the select statement. Explain with an example.
OR
Categorize the following commands as DDL or DML:
INSERT, UPDATE, ALTER, DROP
SECTION C
26 a) What is natural join? 1+2
b) Write the output of the queries (a) to (d) based on the table, given below:
MOVIE
NO TITLE TYPE RATING SEATS_LEFT PRICE

1 SANJU BIOPIC A 4 250

2 RAID ACTION B 2 175


3 RACE3 ACTION C 7 245
4 HAAMI COMEDY A 3 130
5 BAHUBALI DRAMA A 3 300

i) Select *
from MOVIE
where PRICE between 200 and 275;

ii) select max(PRICE)


from MOVIE
where RATING=’A’;

iii) select * from MOVIE


where TITLE like ‘%I’ or RATING=’B’;
11
iv)select distinct(RATING)
from MOVIE;
27 Write a function in Python to print those words which contains letter ‘S’ or ‘s’ 3
anywhere in the word in text file “STORY.txt”.
If the “STORY.txt” contents are as follows:
An Old Man is happy today, he doesn’t complain
about anything, smiles, and even his face is
freshened up.
The output of the function should be:
is doesn’t smiles his is freshened
OR
Write a function WordCount() in Python to read a text file “Mydiary.txt” and
display no of words present in each line.
Example:
If the file content is as follows:
Updated information
As simplified by official websites.
The function should display the output as:
Line No 1 : Words=2
Line No 2 : Words=5
28 (a)Consider the following tables. Write SQL commands for the statements (i) to 2+1
(iv).
Table : SENDER
SenderID SenderName SenderAddress SenderCity
ND01 R Jain 2, ABC Appts New Delhi
MU02 H Sinha 12, Newtown Mumbai
MU15 S Jha 27/A, Park Street Mumbai
ND50 T Prasad 122-K, SDA New Delhi

Table : RECIPIENT
RecID SenderID RecName RecAddress RecCity
KO05 ND01 R 5, Central Avenue Kolkata
Bajpayee
ND08 MU02 S Mahajan 116, A Vihar New
Delhi
MU19 ND01 H Singh 2A, Andheri East Mumbai
MU32 MU15 PK B5, C S Terminus Mumbai
Swamy
ND48 ND50 S Tripathi 13, B1 D, Mayur New
Vihar Delhi
(i)To display the names of all Senders from Mumbai.

12
(ii) To display the RecID, SenderName, SenderAddress, RecName, RecAddress
for every Recipient.
(iii) To display Recipient details in ascending order of RecName.
(iv) To display number of Recipients from each City.
(b) Write the command to view the table structure.
29 Write a function LShift(Arr,n) in Python, which accepts a list Arr of numbers and 3
n is a numeric value by which all elements of the list are shifted to left. Sample
Input Data of the list
Arr= [ 10,20,30,40,12,11],
n=2
Output Arr = [30,40,12,11,10,20]
30 Write a function in Python PUSH(Arr), where Arr is a list of numbers. From this 3
list push all numbers divisible by 5 into a stack implemented by using a list. Display
the stack if it has at least one element, otherwise display appropriate error message.
OR
Write a function in Python POP(Arr), where Arr is a stack implemented by a list
of numbers. The function returns the value deleted from the stack.
SECTION D
31 G.R.K International Inc. is planning to connect its Bengaluru Office Setup with its 5
Head Office in Delhi. The Bengaluru Office G.R.K. International Inc. is spread
across an area of approx. 1 square kilometres consisting of 3 blocks. Human
Resources, Academics and Administration. You as a network expert have to suggest
answers to the four queries (i) to (v) raised by them.

Shortest distances between various blocks


Human Resources to Administration 100m
Human Resources to Academics 65m
Academics to Administration 110m
Delhi Head Office to Bengaluru Office 2350
Setup km

Number of computers installed at various blocks


Block Number of
Computers
Human Resources 155
Administration 20
Academics 100
Delhi Head Office 20
(i) Suggest the most suitable block in the Bengaluru Office Setup to host the
server. Give a suitable reason with your suggestion.
(ii) Suggest the cable layout among the various blocks within the Bengaluru
Office Setup for connecting the blocks.

13
(iii) Suggest a suitable networking device to be installed in each of the
blocks essentially required for connecting computers inside the blocks with
fast and efficient connectivity.
(iv) Suggest the most suitable media to provide secure, fast and reliable
data connectivity between Delhi Head Office and the Bengaluru Office
Setup. (v)Which type of network id formed between blocks of Bengaluru
Office.
32 a) What will be the output of the following code? 2+3
value = 100
def display (N):
global value
value = 150
if N%7 ==
0:
value = value + N
else:
value = value - N
print (value, end = '#')
display (50)
print (value)
b) The code given below inserts the following record in the table
Student: RollNo – integer
Name – string
Class – integer
Marks – 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 school.
 The details (RollNo, Name, Clas and Marks) are to be accepted from the
user. Write the following missing statements to complete the code:
Statement 1 – to form the cursor object
Statement 2 – to execute the command that inserts the record in the table Student.
Statement 3- to add the record permanently in the
database import mysql.connector as mysql
def sql_data():
con1=mysql.connect(host="localhost",user="root",password="tiger",
database="school")
mycursor= #Statement 1
rno=int(input("Enter Roll Number :: "))
name=input("Enter name :: ")
class=int(input("Enter class :: "))
marks=int(input("Enter Marks :: "))
querry="insert into student values({},'{}',{},{})".format(rno,name,clas,marks)
#Statement 2
# Statement 3
print("Data Added successfully")
OR
a) Find the output of the following code:
Name = "cBsE@2051"
14
R=" "

15
for x in range (len(Name)):
if Name[x].isupper ( ):
R = R + Name[x].lower()
elif Name[x].islower():
R = R + Name[x].upper()
elif Name[x].isdigit():
R = R + Name[x-1]
else:
R = R + "#"
print(R)
b) The code given below reads the following record from the table named student
and displays only those records who have marks greater than 75:
RollNo – integer
Name – string
Clas – integer
Marks – 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 school. Write the following
missing statements to complete the code:
Statement 1 – to form the cursor object
Statement 2 – to execute the query that extracts records of those students
whose marks are greater than 75. Statement 3- to read the complete result of
the query (records whose
marks are greater than 75) into the object named data, from the table student in the
database.
import mysql.connector as
mysql def sql_data():
con1=mysql.connect(host="localhost",user="root", password="tiger",
database="school")
mycursor= #Statement 1
print("Students with marks greater than 75 are :
")
#Statement 2
data= #Statement 3
for i in data:
print(i)
print()
33 What is the advantage of using a csv file for permanent storage? 5
Radha Shah is a programmer, who has recently been given a task to write a python
code to perform the following CSV file operations with the help of two user defined
functions/modules:
a. CSVOpen() : to create a CSV file called BOOKS.CSV in append
mode containing information of books – Title, Author and Price.
b. CSVRead() : to display the records from the CSV file called BOOKS.CSV
where the field title starts with 'R'.
OR
Write the full form of CSV.

16
Amit is a programmer, who has recently been given a task to write a python code to
perform the following CSV file operations with the help of two user defined
functions/modules:
(i) addCsvFile() – To accept and add data of an employee to a CSV file
‘user.csv’. Each record consists of a list with field elements as
UserName,PassWord to store UserName,PassWord respectively.
(ii) readCsvFile()-to read data from CSV file.
SECTION E
34. Navdeep creates a table HOUSE with a set of records to maintain. After creation of 1+1+2
the table, he has entered data of 6 houses in the table.

HID Location Quantity Unit _Price Dcode


H1 Raipur 10 500000 1
H2 Bilaspur 20 300000 2
H3 Bargarh 15 200000 3
H4 Ambikapur 25 250000 2
H5 Raipur 25 280000 2
H6 Bilaspur 20 240000 1

Based on the data given above answer the following questions:


(i) Identify the most appropriate column, which can be considered as Primary key.
(ii) If two columns are added and 2 rows are deleted from the table result, what
will be the new degree and cardinality of the above table?
(iii) Write the statements to:
a. Insert the following record into the table HID – H7, Location -
Chirimiri, Quantity - 10, Unit _Price -600000, Dcode- 3,
b. Increase the unit price of the house by 3% whose name ends with ‘ur’.
OR
(iii) Write the statements to:
a. Delete the record of house location Ambikapur
b. Add a column REMARKS in the table with datatype as varchar with
50 characters
35 A binary file “Book.dat” has structure [BookNo, Book_Name, Author, Price]. i.
Write a user defined function CreateFile() to input data for a record and add to
Book.dat . ii. Write a function CountRec(Author) in Python which accepts the
Author name as parameter and count and return number of books by the given
Author are stored in the binary file “Book.dat”
import #Statement 1
def createFile():
fobj=open( ) # Statement 2
BookNo=int(input("Book Number : "))
Book_name=input("Name :")
Author = input(“Author: “)
Price = int(input("Price : "))
rec=[BookNo,Book_Name,Author,Price]
pickle. #Statement 3
17
fobj.close()
def CountRec(Author):
fobj=open("Book.dat","rb")
num = 0
try:
while True:
rec=pickle. #Statement 4
if Author==rec[2]:
num = num + 1
except:
fobj.close()
return num
(i) Which module should be imported in the program? (Statement 1)
(ii) Write the correct statement required to open a temporary file named Book.dat.
(Statement 2)
(iii) Which statement should be filled in Statement 3 to write the data in the binary
file, Book.dat and in Statement 4 to write the read data in the file, Book.dat?

18

You might also like