Oswal 36 Sample Question Papers CBSE Class 12 Computer Science Solutions

Section-A

1. False

 Explanation :

A tuple is immutable data structure and cannot be changed.

2. (d) Check

 Explanation :

The check constraint can be used to specify conditions to be implemented on fields.

3. (a) 17.0

 Explanation :

The original expressionis:
225**0.5+12/5+16%7-2
= 15.0 + 2 + 2 - 2
= 17.0

4. False

 Explanation :

The endswith() function checks whether a string ends with a particular substring or not.

5. (d) None of these

 Explanation :

None of these are SQL command categories.

6. (a) Star

 Explanation :

Star topology has independent cables connecting the nodes. Hence it requires more cost for implementation.

7. There is no output

 Explanation :

Because variable i is equal to string value which cannot be used in iteration.

8. (a) True

 Explanation :

The expression is evaluated according to the operator hierarchy. i.e first NOT will be evaluated then AND and then OR.

9. (b) F = open (‘Notes.txt’, ‘A’)

 Explanation :

Option b is invalid because ‘A’ is an invalid mode in Python.
‘w’ Opens a file for write mode.
‘a’ Opens a file for append mode
‘w+’ Opens a file for both writing and reading

10. (b) Southnorthwest

 Explanation :

Maximum value = 3 Minimum value = 1
Only option (b) is possible.

11. (a) Personal area network

 Explanation :

Bluetooth connects personal devices in a short range

12. (c) Runtime error

 Explanation :

Runtime error is when the statement is correct syntactically, but the interpreter cannot execute it. Runtime errors do not appear until the program starts running or executing.

13. (c) Exception

 Explanation :

Reaching the End of file is an exceptional situation sometimes in infinite loops.

14. (b) An attribute which is not a primary key

 Explanation :

All the keys which did not become the primary Key are called alternate keys.

14. (b) An attribute which is not a primary key

 Explanation :

All the keys which did not become the primary Key are called alternate keys.

15. (b) Message

 Explanation :

In message switching technique, no physical path is established between sender and receiver in advance. This technique follows store and forward mechanism.

16. (a) f=open(“stock.csv”,”w”)

 Explanation :

The open() function opens a csv file. The “w” mode allows writing of records.

17. (a) Both A and R are true and R is the correct explanation of A

 Explanation :

A function is a block of organised and reusable code that is used to perform a single, related action, function provides better modularity for your application and a high degree of code reusability. Function begin with the keyword def followed by function name and parenthesis ().

18. (a) Both A and R are true and R is the correct explanation of A

 Explanation :

Access mode 'a' opens a file for appending. The file pointer is at the end of the file if the file exists. That is, the file is in the append mode. If the file does not exist, it creates a new file for writing.

Section-B

19. (i) (a) TCP/IP : Transmission control protocol / Internet protocol
          (b) CDMA : Code division multiple access
(ii) The process of uploading web pages to a public server is called web hosting.

20. C=dict()
n=input(“Enter total number”) # Error 1
i=1
while i<=n
a=input(“enter place”)
b=input(“enter number”)
c[a]=b
i=i+1
print(“place”, “\t”, “number”) # Error 2
for i in c
print(i, “\t”,ca[i]]) # Error 3

21. def ZeroEnding(SCORES) :
SZero=0
for i in SCORES :
if i % 10 == O:
print(“sum of numbers ending with zero : “, SZero)

OR

def big(Lststr):
for s in Lststr :
if s[0] in “aeiou” and s[-1] in “aeiou” :
print(s)

22. 250 # 150
250 # 100
130 # 100

23. (i) Studict[“Roll”]=”SS/1”
(ii) print(“wbreg”.upper())

24. Part I : ALTER TABLE ITEM ADD (Discount INT);
Part II : ALTER TABLE ITEM DROP COLUMN Qty;

25. Output :
20#50@20.

Section-C

26. [[[6, 2, 3, 17, 5], [6, 7, 8]], 200]
[[[6, 2, 3, 17, 5], [6, 7, 8]], 200]
[[6, 2, 3, 17, 5]]

27. 

(i) SUM (DISCOUNT) 29
(ii) MAX (DATEOFPURCHASE) 01-Jan.-2021
(iii) FID
T006
NAME
Console Table
DATEOFPURCHASE
17-Nov.-2019
COST
15,000
DISCOUNT
12

28. def countvowels():
str=""
ctr=0
F=open("Rhymes.txt","r")
str=F.read()
for i in str:
if i in "aeiou" or i in "AEIOU":
ctr+=1
print("Count of vowels :",ctr)
countvowels()

OR

def countlines():
count=0
f=open(“Notes.txt”,”r”)
lines=f.readlines()
for line in lines:
if line[0] ==”a” and line[-1]==”a” :
count+=1

print(“Number of lines starting and ending with ‘a’ :”,count)

29. (i) Select Name, Class from Students where Address IS NOT NULL;
(ii) Alter table Students DROP Phone;
(iii) Primary Key : ADMNO

30. (i) def PUSH(Arr, value) :
s = []
for x in range (0, len(Arr)):
if Arr [x]%5==0 :
s.append(Arr[x])
if len(s)==0 :
print(“EMPTYStack”)
else :
print(s)

(ii) def popstack(st) : #if stack is empty
if len(st)==NULL :
print(“Underflow”)
else :
l = len (st)
val = st (1 – 1)
print (val)
st.pop (1 – 1)
return val

Section-D

31. (i) Movie editing block is the most appropriate to house the server as it has the maximum number of computers.
(ii) Firewall
(iii) Ethernet Cable
Layout:

(iv) Switch/hub will be placed in all blocks to have connectivity within the block. Repeater is not required between the blocks as the distances are less than 100 mts.
(v) Protocol: VoIP

32. (i) The r mode allows only reading of files. Whereas the r+ mode allows both reading and writing..
(ii) def convert():
import pickle
f=open(“Aadhar.dat”,”r”)
f1= open(“wbaadhar.dat”,”w”)
alist=[]
nalist=[]
alist=pickle.load(f)
for rec in alist:
if rec[2]==”WB”:
nalist.append(rec)
pickle.dump(nalist,f1)
f.close()
f1.close()

OR

def search(cno):
import pickle
f=open(“consumtion.dat”,”r”)
clist=[]
clist=pickle.load(f)
for rec in clist:
if rec[0]==cno:
print(rec)
f.close()

33. (a) Alter table Hospital Add Primary key(PatId);
(b) import mysql.connector
mycon=mysql.connector.connect(host=”localhost”,User=”root”,passwd=”system”,database=”Educ ation”)
cursor=mycon.cursor()
sql=”Insert into teacher(T_ID, Fname, Lname, Hiredate, Salary, subject) values (“%s %s %s %s %s %s)”
val=[(101,”Arnab”,”Chowdhury”,”2016-09-12”,85000,”Electrical”),
(102,”Susmita”,”Sen”,”2012-09-22”,56000,”Civil”)]
try:
cursor.executemany(sql,val)
mycon.commit()
except :
mycon.rollback()
finally:
mycon.close()

Section-D

34. (i) Select name, game from students, sports where students.Admno=sports.Admno and address is not null;
(ii) Alter table students drop phone;
(iii) Select count(*) from students, sports where game=”volleyball” and students.Admno = sports.
Admno;
(iv) Primary key for table STUDENTS : ADMNO

35. (i) import csv
def Add_data( ):
fobj=open("product.csv","a",newline="\n")
fwriter=csv.writer(fobj)
pid=int(input("Enter product id :: "))
pn=input("Enter product name :: ")
pq=int(input("Enter quantity :: "))
plst=[pid,pn, pq]
fwriter.writerow(plst)
fobj.close()

(ii) def Search_data(p):
fin=open("product.csv ","r",newline="\n")
data=csv.reader(fin)
for rec in data:
if rec[0]==p:
print(rec[0])
print(rec[1])
print(rec[2])
fin.close()
Add_data( )
r=int(input(“Enter product id to search :”))
Search_data(r)

CBSE 36 Sample Question Papers Commerce Stream

All Subjects Combined for Class 12 Exam 2024

CBSE 36 Sample Question Papers Science Stream (PCB)

All Subjects Combined for Class 12 Exam 2024

CBSE 36 Sample Question Papers Science Stream (PCM)

All Subjects Combined for Class 12 Exam 2024

The dot mark field are mandatory, So please fill them in carefully
To download the Sample Paper (PDF File), Please fill & submit the form below.