2
2
2
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])
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
i) Select *
from MOVIE
where PRICE between 200 and 275;
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.
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.
18