Professional Documents
Culture Documents
Max Marks:50: Computer Science
Max Marks:50: Computer Science
General Instructions:
1. This question paper contains five sections, Section A to
2. All questions are compulsory.
E
3. Section A have 17 questions carrying 01 mark each.
4. Section B has 06 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 01 Long Answer type questions carrying 05 marks each.
7. Section E has 01 questions carrying 04 marks each.
8. All programming questions are to be answered using Python Language only.
Section A
print (b)
(a) Year.0. at All the best
(b) Year 0. at Al the best
(c) Year. 2.022 at All the best
(d) Year. 022. at all the best
paeve
Which of the following commands will delete the record from the MYSQL table?
9 Which of the following statement(s) would give an error after executing the following 1
code?
S= (2, "HELLO", 4, 56.7) #Statement 1
print (S) #Statement 2
S[2]="Thank you" # Statement 3
S[1][0] = '@ # Statement 4
S-S+"Thank you" #Statement 5
(a) Statement 3 (b) Statement 4 (c) Statement 1 (d) Statement 3 and 4
2
13 What will the following expression be 1
evaluated to in Pythoní
print (3--10*2+99/11)
Reason (R): The information is organized with one record on each line
and each field is
separated by comma.
16 ASsertion (A):-If the arguments in function call statement match the number and order Of 1
arguments as defined in the function definition, such arguments are called positional
arguments.
Reasoning (R):- During a function call, the argument list first contains
default argument{s) followed by positional argument(s).
Section B
Shristi has written a Python program to add all the numbers ofthe list. Her code is having 2
18 errors. Rewrite the correct code and underline the corrections made.
returns amount
the output of
() Writeprint mySubject[-27:-10:2)
> aj0:2}=[100,1000]
>a[0:2=[10000]
>>> pintfa)
2
below:
Predict the output ofthe Python
code given
21
def remainf (N1, N2) :
if N1>N2:
return N18N2
else:
return N28N1
Write the output of the queries (i) to (iv) based on the table, STOCK
given below:
Table: STOCK
L ItemNo Item Dcode Qty UnitPricee StockDate
bookk 3
to implement a Stack for book details (book
name:
26 Write a program
price) where book name is a key and book price is value.
Write a function in Python, the of
containing details
Push(book_details) where book_details is a dictionary
should push the names of those
books-{book_name book price). The function
books in the stack which have price greater than 500.
MPrice M_Mf_Date
MCompany M_Name
MId 2013-02-12
Samsung8 Galaxy A500
MBO01 2250 2011-04-15
Nokla |N1100
MBO03 4500 2016-10-17
Unite3
MBO04 Micromax 2017-11-20
XperlaM 7500
MBOO5 Sony 8500 2010-08-21
SelfieEx
MBO06 Oppo
Table: MOBILESTOCK
6
eniiiiscienviensesaimiiaea
) SELECT M
MOBILESTOCKConpany, MName,
MS, WHERE MMMMPrice,M Qty FROM MOBILEMASTER MM,
ID- MS.M_ID
(4) SELECT MAX{M_Price) FFROM
n) SELECT M_Supplier, MOBILEMASTER WHERE M_Name LlKE "S9%
M_ Qty FROM MOBILESTOCK WHERE
v) SELECTM_Company FROM M_d="MBO03",
MOBILEMASTER WHERE M_Price
AND 5000 BETWEEN 300
etrn
Section D
Name-string
Ticket Price - integer
No Of_Tickets - integer
Total_Amount - integer
Note the following to establish connectivity between Python and MySQL:
mysql.connector as mysql
1mport
def sql_data ():
con=mysql.connect (host="localhost", user="root"
database="Amusement" )
password="Ticket ",
#Statement l
mycursor=
Ticket Number :: "))
(input("Enter
Ticket No=int
Name-input ("Enter Nane:")
("Enter Ticket Price :: "}
Ticket Price= input
No of tickets ")
No Of Tickets=int (
input ("Enter
No of Tickets
Total Amount Ticket Price
Query="Insert
into Fun City
0)".format (Ticket_No, Name
Values ((}, ' { } ' , 0 ,
No Of Tickets,
Total_Amount)
T1cket_Price,
#statement 2
I#Statement 3
Val 1 0 0 0 0
if N82=#0:
Val = Val ** N
else:
Val = Val * N
display (2)
print(Val)
Section-E
4
that defines and calls the following user defined
29 Write a Program in Python
functions: CSV file 'furdata.csv.
To accept and add data of an furniture to a
(i) append() elements as furid, furname and furprice
to
-