G12 CS PB2 QP
G12 CS PB2 QP
General Instructions:
s="CBSE Exams2024-25"
What will be the result of the following statement?
s.split('E',1)
(i) ['CBS', 'Exams2024-25']
(ii) ['CBS ', ' Exams2024-25']
(iii) ['CBS', ' Exams2024-25']
(iv) [' CBS ', 'Exams2024-25']
2. Which among the following is not a DML command? 1
(a) SELECT (b) UPDATE (c) DELETE (d) CREATE
3. In which datatype the value stored is padded with spaces to fit the 1
specified length?
(a) DATE (b) VARCHAR (c) FLOAT (d) CHAR
4. What will be the output of the following code:- 1
mystring="Millenium Milestones"
new_string=mystring.replace("le","$")
print(new_string)
tuple1 = tuple("apple")
tuple1 += (4,)
print(tuple1)
stu_stream={"Ravish":"pcm","Rena":"pcb","Sumit":"com",
"Jeevan":"hum"}
(i) stu_stream.get('Veena')
(ii) stu_stream.setdefault("Vani","pcm")
(iii) print(stu_stream["Ravi"])
(iv) print(str(stu_stream))
9. Which of the following keywords are not specific to exception handling? 1
(a) try (b) except (c) else (d) finally
10. What is the output of the program code given below? 1
x=50
def func(x):
x=2
func(x)
print('x is now',x)
a, b=8/4/2, 8/(4/2)
print(a, b)
A. Syntax error
B. 1.0,4.0
C. 4.0,4.0
D. 4,4
12. The term is used to refer to a record in a table. 1
(a) Attribute (b) Tuple (c) Field (d) Instance
13. Which of the following functions header is correct? 1
a) def study(a=2, b=5, c) :
b) def study(a=2, b, c=5) :
c) def study(a, b=2, c=5):
d) none of the above
14. Following code will produce True as output:
x=10>5>1 and -3<-2<-1
print(x)
A. True B. False
15. A school maintains the following table to store student records:- 1
student_data(admno,rollno,sname,marks)
The database admin wants to remove the field rollno from this table.
Which command will be used for this purpose?
22. (a) Give one difference between lists and tuples. 1+1
(b) Suppose a list is given as :-
emp_records=[
['E1','Shalini',5000,'Sales'],
['E2','Drishyam',5500,'Purchase'],
['E3','Rohini',7000,'Purchase'],
['E4','Kalaam',6000,'Finance'],
['E5','Seema',8000,'HR']
]
Write Python code to print salary of employee whose employee code is 'E4'.
(Use list index only)
23. a) List one advantage and disadvantage of Mesh topology. 1+1
b) Expand the terms : SMTP, POP3
24. Find errors, underline them and rewrite the same after correcting the 2
following code:
d1=dict[]
i=1
n=input("Enter number of entries:")
while i<=n:
a=input("Enter name:")
b=input("Enter age:")
dl(a)=b
i = i+1
l = dl.key[]
for i in l:
print(i,'\t', 'dl [i]')
25. There are two lists 1+1
car=['Toyota','Honda','Ford','Chevrolet','BMW','Mercedes-
Benz']
phone=['Apple','Samsung','Google','OnePlus','Oppo','Vivo'
,'Sony','Nokia','Huawei']
1. first + float(second)
2. float(second) + float(third)
3. first + int(third)
4. first + int(float(third))
5. int(first) + int(float(third))
6. 2.0 * second
27. ‘Krazy4Fitness’ is a showroom which sells gyming equipment as shown 1+1
below:-
Table: FITNESS
PCODE PNAME PRICE Manufacturer
PI Treadmill 21000 Coscore
P2 Bike 20000 Aone
P3 Cross Trainer 14000 Reliable
P4 Multi Gym 34000 Coscore
P5 Massage Chair 5500 Regrosene
P6 Belly Vibrator Belt 6500 Ambawya
They need the help of a database expert to manage the database for them.
Help them with the following tasks:-
(i) Write the SQL command to set Pcode as primary key.
Or
Write the SQL command such that Pname field does not accept
NULL values.
(ii) Write the SQL command to add another field named
‘manfc_date’ (manufacture date).
Or
Write the SQL command to change the datatype of Pname field
from char to varchar. (assume any size)
28. Consider the following code: 2
import random
AR [20, 30, 40, 50, 60, 70]
Lower = random.randint(1, 3)
Upper= random.randint(2, 4)
OR
For example:
If the dictionary contains the following data:
Vehicle={"Santro":"Hyundai", "Nexon": "TATA", "Safari":
"Tata"}
Table: SALES
PROD_ID QTY_SOLD QUARTER
P002 4 1
P003 2 2
P001 3 2
P004 2 1
A) Write the SQL queries for the following:-
(i) Display the computer product records in the descending order
of price.
(ii) Display the no.of input and output devices.
(iii) Display the product name, price and quantity of all products
which are made by ‘LOGITECH’.
(iv) Increase the price of all those products by 5% which are made
by ‘CANON’.
OR
B) Write the outputs of the following SQL queries:-
Tcode - String
Traveller_name - String
Source – String
Destination - String
36. Mr. Darvy is a store manager working in a convenience store. She needs 5
to manage the records of inventory. For this, she wants the following
information of each product to be stored:
ProductID - integer
ProductName - string
Quantity - integer
Price – float
Brand - string