computer science class 12
computer science class 12
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)
1 | Pag
e
(A)LAN (B)WAN (C)MAN (D)PAN
6. To open a file C:\hologram.txt for reading, we should write the code:- 1
f=open("C:\hologram.txt","r") f=open("C:\\
hologram.txt","r") f=open(file="C:\hologram.txt","r")
f=open(file="C:\\hologram.txt","r")
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) :
2 | Page
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?
3 | Page
LAN communications.
Reason: Microwaves are unidirectional and they support one-to-one
unicast communication.
Q.N Section-B ( 7 x 2=14 Marks) Mar
o. ks
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']
4 | Page
end of list car.
26. Which of the following will return the result as a floating point number 2
2.0?
first = 1.0
second = "1"
third = "1.1"
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 1+1
shown 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)
5 | Page
(c) 50#60#70# (d) 40#50#70#
Q.N Section-C ( 3 x 3=9 Marks) Mar
o. ks
29. Predict the output of the following code:- 3
d = {"spade": 15, "club": 7, "heart": 9}
str1 = ""
for key in d:
str1 = str1 + str(key) + "$" + "\n"
str2 = str1[:-1]
print(str2)
OR
Carefully go through the code given below and predict the output if input
given is 'abcd' :-
OR
6 | Page
from a text file named "Words.txt".
31. You have a stack named MovieStack that contains records of various 3
movies. Each movie record is represented as a list containing movie_title,
director_name, and release_year.
Example of one element :- [‘Avatar’, ‘James Cameron’, 2009]
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
7 | Page
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:-
8 | Page
1. Identify the Primay Key from the given table with justification of
your answer.
2. If three more records are added and 2 more columns are added, find
the degree and cardinality of the table.
3. (i) Write SQL command to insert one more data/record to the table
(ii) Increase the price of furniture by 1000, where discount is given more
than 10.
Tcode - String
Traveller_name - String
Source – String
Destination - String
9 | Page
office and web based activities. The company compound has 4 buildings as
shown in the diagram below:
----------------xxxxxxxxxxxxxxxx---------------
10 | P a g
e