Oswal 36 Sample Question Papers CBSE Class 12 Computer Science Solutions

Section-A

1. True

Explanation: A dictionary may be updated by the contents of another using the update() method of a dictionary.

2. (a) Logical

3. (b) 4

4. (c) No output

5. (b) [77, 10]

6. (c) r+

7. (a) 1

8. (c) CHECK

9. (a) *

10. (c) More than 2

11. (c) <fileobject>.write(<string>)

12. (d) Multiple

13. (a) RJ45

Explanation: The Registered jack 45 is a network device that connects the network cable to the network interface card.

14. (a) 11.5 <class ‘float’>

15. (d) Group by

16. (a) execute()

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

Explanation: Python allows creating user defined modules , where all the functions of the module can stay.

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

Explanation: For any types of files the default opening mode is taken as read mode if no mode is specified.

Section-B

19. Corrected code :

Lst=[12,15,16,17,19]

for a in Lst :

if a**2 >= 100 :

print(a+2)

else :

print(Lst)

20. URL - http://www.gabsclasses.com/aboutus

Domain name - www.gabsclasses.com14

OR

Yesh, as a location on a web server, which is called a website and each website has a unique address known as URL. So, URL can be used to access a web page.

21. (i) (c) [ ]

Explanation: Since the reverse progression is not given , the output is an empty list.

(ii) 1

Explanation: The for loop checks for existence of the characters of the string in “stuv” , and returns the count.

22. Database: The database is a shared collection of logically related data, designed to meet the information needs of an organisation. A database is computer based record keeping system whose over all purpose is to redord and maintains information. The database holds not only the organisation’s operational data but also a description of this data. For this reason, a database is also defined as a self-describing collection of integrated records. The description of the data is known as the data dictionary or metadata (data about data).

DBMS: A Database Management System (DBMS) is a collection of programs that enables users to store, modify and extract information from a database as per the requirements. It acts as an interface between the application program and the operating system to access or manipulate the database. A database management system is a piece of software that provides services for accessing a database, while maintaining all the required features of the data. Commercially available database management system in the market are dbase, FoxPro, Oracle, MySQL and DB2 etc.

23. (a) (i) TCP/IP : Transmission control protocol , Internet Protocol

(ii) IRCP : Internet relay chat protocol.

(b)  • E-mail is extremely cost effective.

• E-mail takes lesser time for transmitting data than conventional mail.

24. Output

x : 15   y : 3    z : 12

OR

  • (a) Identifier → Sum_1
  • (b) Punctuator → Bracket()
  • (c) Keyword → for
  • (d) Constant → ‘Neha’

25.

Char Varchar
Fixed length Variable length
Wastes unused spaces Uses only as much memory required by the filled data.

OR

DDL (Data Definition Language) is a part of SQL, which provides commands for creating, altering and dropping the tables. Different DDL commands are CREATE, ALTER, DROP and RENAME.

DML (Data Manipulation Language) is a part of SQL, which provides commands for inserting, deleting and updating the information ina database. Different DML commands are SELECT, UPDATe, INSERT.

Section-C

26. (a) Select Name, Type,Income from FAMILY F, OCCUPATION O where F.OccupationId= O. OccupationID where MaleMembers>2;

Select ClientName, City , ProductName , Price from CLIENT , PRODUCT where CLIENT.P_ID= PRODUCT.P_ID;

(b) (i) SELECT * FROM FAMILY WHERE Occupation = ‘Service’;

(ii) SELECT Name FROM FAMILY WHERE Femal Members > 3;

(iii) SELECT Name, Income FROM FAMILY ORDER BY Income;

(iv) SELECT Count(*) FROM FAMILY WHERE Income < 10000;

27. def counts(s):

iscount=0

wascount=0

for w in s.split(‘ ‘):

if w==”is”:

iscount+=1

elif w==”was”:

wascount+=1

print(“ No. of is :”,iscount)

print(“ No. of was :”,wascount)

def main():

counts(“He is a good boy. She was and is a good girl”)

main()

OR

def counts(s):

L1=[]

L2=[]

for w in s.split(‘ ‘):

if w[0] in ‘aeiou’:

L1.append(w)

elif w[0] in ‘AEIOU’:

L2.append(w)

print(“ List of words starting with lowercase vowels”,L1)

print(“ List of words starting with uppercase vowels”,L2)

def main():

counts(“A quick black elephant enters Into a jungle”)

main()

28. (a) (i) SELECT NAME FROM DOCTOR WHERE DEPT, = ‘MEDICINE’ AND EXPERIENCE > 10;

(ii) SELECT AVG(BASIC + ALLOWANCE) FROM, SALARY WHERE SALARY.ID IN(SELECT ID FROM DOCTOR WHERE DEPT = ‘ENT’);

(iii) SELECT MIN(ALLOWANCE) FROM SALARY WHERE SALARY.ID IN(SELECT ID FROM DOCTOR WHERE SEX = ‘F’);

(iv) SELECT MAX(CONSULTATION) FROM SALARY WHERE SALARY.ID IN(SELECT ID FROM DOCTOR WHERE SEX = ‘M’);

(b) Alter table SALARY MODIFY consultation double(8,3);

29.  a = [ ]

n = int(input(“Enter number of elements:”))

for i in range(1, n + 1):

b = int(input(“Enter element:”))

a.append (b)

k = 0

num = int(input(“Enter the number to be counted:”))

for j in a :

if (j == num):

k = k + 1

print (“Number”, num, “is appear”. k. “times.”)

30.  def insert():

name_pattern = re.compile (r “[A-Za-zs.]”)

while True:

n = input (“Enter name:”)

while name_pattern. search (n):

print (“Invalid name”)

print (“Enter name correctly”)

n = input()

Sname. append (n)

c = input (“Enter more name < y/n>”) upper ())

if (c! = “y’);

break

OR

76000

100 → Push

diagram6

8 → Push

diagram7

3 → Push

diagram8

* → Pop 3.8 → Push 24

50 → Push

2 → Push

+ → Pop 2,50 → Push 52

+ Pop 52,24 → Push 76

diagram13

* → Pop 76,100 → Push 7600

diagram14

Final contents of stack

Section-D

31. (i) Building RED is the suitable place to house the server because it has maximum number of computers.

(ii)

diagram5

(iii) (a) Switches are needed in every building as they help share bandwidth in every building.

(b) Repeaters may be skipped as per above layout (because distance is less than 100 m), however if building GREEN and building RED are directly connected, we can place a repeater there as the distance between these two buildings is more than 100 m.

(iv) A Modem is a network device that converts Analog signals to Digital and Digital to Analog.

(v) Firewall prevents the unauthorised access in the network.

  • (a) d1 = {‘A’ : 10, ‘B’ : 20}
  • d2 = {‘C’ : 30, ‘D’ : 40}
  • d3 = {‘E’ : 50, ‘F’ : 60}
  • d4 = { }
  • for i in (d1, d2, d3) :
  • d4, update (i)
  • print(d4)

(b) L1 = [23, 45, 12, 75, 90, 17, 87, 42, 72, 65]

def INPUT (S, L1) :

S. append (L1)

def OUT (S) :

if S! = [ ] :

return S.Pop ()

else:

return None

Stack1 = [ ]

for i in L1 :

if i % 5 == 0:

INPUT (Stack1, i)

while True:

if Stack1 ! = [ ] :

print.(OUT (Stack1), end = “ ”)

else :

break

OR

(a) Difference between logical error and syntax error are as follows:

(b) Marks = [75, 80, 56, 90, 45, 62, 76, 72]

Logical Error Syntax Error
1. It occurs because of wrong implementation of logic. It occurs when statements are wrongly written violating rules of the programming language.
2. With logical errors, the code is syntactically correct and compiler will not show any error message. With syntax errors, the code is not syntactically correct and compiler will show the error messages.
3. It produces the output, but undesired. It does not produce any output.
e.g., in place of
(c = a * b) : if by mistake
(c = a + b); is written, it will be a logical error.
e.g., in place of
(a == b) : if by mistake
(a == b); is written, it will be a syntax error.

def PUSH (St, Marks) :

St. append (Marks)

def POP (St) :

if St ! = [ ] :

return St. pop ()

else;

return None

Stack 1 = [ ]

for x in, Marks :

if x > 75 :

PUSH (Stack 1, x)

while True :

if Stack 1! = [ ] :

print (POP (Stack1), end = “ ”)

else :

break

  • 33. Advantages:
  • (i) One of the advantages of binary files is that they are more efficient. In terms of memory, storing values, etc.
  • (ii) Binary formats also offer advantages in terms of speed of access.
  • (b) Write a python method writecsv() to accept roll , name and percentage of as many students and write them to a csv file “stud.csv” with space as delimiter.

Ans. import csv

defwritecsv():

f=open(“stud.csv”,”w”,newline=’’)

stuwriter=csv.writer(f)

ans=’y’

sturec=[]

while ans==’y’:

roll=input(“Enter roll :”)

name=input(“Enter name :”)

perc=float(input(“Enter percentage :”))

rec=(roll,name,perc)

sturec.append(rec)

ans=input(“Continue(y/n)”)

stuwriter.writerows(sturec)

f.close()

OR

(a) Import CSV

(i) def CSVOpen():

with open (‘books.csv’, ‘______’ newline=‘ ’) as csvf : # Statement 1

cw=________ # Statement 2

_________ # Statement 3

cw.writerow([‘Rapunze’, ‘Jack’, 300])

cw.writerow([‘Barbie’, ‘Doll’, 900])

cw.writerow([‘Johnny’, ‘Jane’, 280])

(ii) def CSVRead():

try:

with open(‘books.csv’, ‘r’) as csvf:

cr = _______ # Statement 4

for r in cr :

if_______ # Statement 5

print(r)

except:

print(‘File Not Found’)

CSVOpen()

CSVRead()

  • (i) (d) a – Since the file is to be opened in append mode.
  • (ii) (b) csv.writer(csvf)
  • (iii) (b)cw.writerow([‘Title’,’Author’,’Price’])
  • (iv) (b) csv.reader(csvf)
  • (v) (a) r[0][0]==’R’ – Since the ‘Title’ field is the at index 0 and [0][0] gives the character at index 0.

Section-E

  • 34. (i) Create table ORDERS ( O_Id integer(3) , OrderDate date, OrderPrice integer(4) , Customer Varchar(20));
  • (ii) Alter table ORDERS Modify customer varchar(30);
  • (iii) (a) Describe ORDERS;
  • (b) Select * from ORDERS where OrderPrice BETWEEN 500 and 1500;
  • OR
  • (iii) (a) Update ORDERS set OrderPrice = OrderPrice + OrderPrice*0.15 ;
  • (b) PRIMARY KEY
  • 35. (a) The readline() method reads a line as a string . The readlines() method reads all the lines of the file into a list , with each line as an item of the list.
  • (b) The reader object can be used to read all the records from the csv file , from which the the records may be operated in a loop on the reader object.
  • (c) Program code :
  • def evenwords()
  • f=open(“Author.txt”)
  • ln=f.readlines()
  • for line in ln:
  • linex=line.split(‘ ‘)
  • if len(linex) %2==0 :
  • print(line)
  • f.close()

CBSE 36 Sample Question Papers Commerce Stream

All Subjects Combined for Class 12 Exam 2023

CBSE 36 Sample Question Papers Science Stream (PCB)

All Subjects Combined for Class 12 Exam 2023

CBSE 36 Sample Question Papers Science Stream (PCM)

All Subjects Combined for Class 12 Exam 2023

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.