0% found this document useful (0 votes)
2 views

MS-1PB-CS-2024 Set 2

Uploaded by

Joshna Jenifer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

MS-1PB-CS-2024 Set 2

Uploaded by

Joshna Jenifer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

PRE BOARD EXAM(2024-25)

CLASS:- 12

Time:- 3 Hrs. Subject:- Computer Science MM:-70

Q No. Section-A (21x1=21 Marks) Marks


1. False (1)
(1 mark for correct answer)
2. (D) [‘’, ‘OMPUTER S’, ‘IEN’, ‘E IS FUN’] (1)
(1 mark for correct answer)
3. (C) TRUNCATE TABLE (1)
(1 mark for correct answer)
4. (D) (‘I could eat ‘, ‘bananas’, ‘ all day’) (1)
(1 mark for correct answer)
5. ‘nhy vLI’ (1)
(1 mark for correct answer)
6. False (1)
(1 mark for correct answer)
7. (B) TWO#THREE# (1)
(C) THREE#FOUR#
(1 mark for correct answer)
8. (B) list.remove(x) removes the element x from a list. (1)
(1 mark for correct answer)
9. SELECT COUNT(*) FROM TABLE <TABLE_NAME>; (1)
(1 mark for correct answer)
10. (D) S2 and S4 (1)
(1 mark for correct answer)
11. (A) WHERE (1)
(1 mark for correct answer)
12. (B) From right to left (1)
(1 mark for correct answer)
13. (B) To check if two variables refer to the same object in memory (1)
(1 mark for correct answer)
14. (C) 15 (1)
(1 mark for correct answer)
15. (C) HiCome (1)
(1 mark for correct answer)
16. (B) Modify the structure of an existing table (1)
(1 mark for correct answer)
17. (B) To group rows that have the same values in specified columns (1)
(1 mark for correct answer)
18. (C) Domain Name System (1)
(1 mark for correct answer)
19. (C) Google (1)
(1 mark for correct answer)
20. (C) A is True but R is False (1)
(1 mark for correct answer)
21. (A) Both A and R are true and R is the correct explanation for A (1)
(1 mark for correct answer)
Q No Section-B (7 x 2=14 Marks) Marks
22. 1 Mark for correct definition. (2)
½ mark for each correct point of difference
23. 1 Mark for correct definition. (2)
½ mark for each correct point of difference.
OR
½ mark for each correct point of difference at least two points of difference
must be given.
24. c=0 (2)
for i in range(len(L1)):
if L1[i]%2==0:
c+=1
print(“No of Odd elements in L1:”, c)

#2 marks for correct program.


OR
a) L1.sort(reverse=True) #1 mark
b) L1.extend(L2) #1 mark

25. SELECT * FROM STUDENTS WHERE GRADE=’A’; (2)


OR
1 mark for correct definition. 1 mark for illustration with example
26. numbers = [1, 2, 3, 4, 5, 6, 7, 8] (2)
sum_even = 0 #_ in place of blank space ‘ ‘

for num in numbers:


if num % 2 == 0:
sum_even += num #_ in place of blank space ‘ ‘

print ( "Sum of even numbers:", sum_even )

½ mark for each correction and underline.

27. (2)
(B) [2,7,4]
(D) [3,1,6]
½ mark for each option
Maximum possible value of b=8
1 mark for correct answer.
28. def showGrades(S): #s1 (2)
avg=0 #s2
for a in S:
avg=S[a][0]+S[a][1]+S[a][2]
avg= avg/3
if avg>=90:
print(a, ‘ – A‘)
elif avg>=60:
print(a, ‘ – B‘)
else:
print(a, ‘ – C‘)

½ mark for correct definition (#s1)


½ mark for defining variable for average (#s2)
1 mark for correct logic for deciding grades
Q No. Section-C (3 x 3 = 9 Marks) Marks
29. #Global declarations (3)
top=-1
BRIGHT=list()
(i)
def Push_Bright(StudRec):
total=0
for a in StudRec:
total=StudRec[a][0]+ StudRec[a][1]+ StudRec[a][2]+
StudRec[a][3]+ StudRec[a][4]
if total > 350:
d=dict()
d[a]=total
BRIGHT.append(d)
(ii)
def Pop_Bright():
if top==-1:
print(“Stack is Empty.”)
return
d=dict()
d=Bright.pop()
top=top-1

½ mark each for declaring the Stack BRIGHT and top


1 mark for correct coding of Push_Bright(StudRec)
1 mark for correct coding of Pop_Bright()

30. def findExcellent(): # ½ mark for correct header (3)


with open(‘Myfile.txt’,’r’) as f: # ½ mark for correct open statement
for line in f: # 1 mark for correct for loop
if ‘excellent’ in line: # ½ mark for correct condition
print(line, end=’’) # ½ mark for correct print statement

OR
Write a Python function that find and displays all the words beginning with ‘w’
or ‘W’ from a text file “Paragraphs.txt”
def findWordswithW(): # ½ mark for correct header
with open(‘Paragraphs.txt’,’r’) as f: # ½ mark for correct open statement
b=f.read().split()
for word in b: # 1 mark for correct for loop
if word[0].lower()==’w’: # ½ mark for correct condition
print(word, end=’ ’) # ½ mark for correct print statement

31. 4.5#6.0 (3)


7.0 @
4.5#@
1 mark for each correct output

Q No. Section-D (4 x 4 = 16 Marks) Marks


32. (4)
A)

(i) SELECT SALARY FROM FACULTY WHERE SALARY >=12000;

(ii) SELECT * FROM FACULTY ORDER BY Hire_date DESC;

(iii) SELECT DISTINCT(Fname) FROM FACULTY;

(iv) UPDATE FACULTY SET SALARY = SALARY + SALARY /10;

1 mark for each correct query


OR
(i)
SALARY
=======
RAKSHIT

(ii)
HIRE_DATE
=========
RAKSHIT
RASHMI
SULEKHA

(iii)
AVG(SALARY)
============
11000

(iv)
F_ID FNAME LNAME HIRE_DATE SALARY
==============================================
104 RAKSHIT SONI 18-05-2001 14000
105 RASHMI MALHOTRA 11-09-2004 11000

1 mark for each correct output


33. i) (4)
import csv

def writeHead(): # ½ mark for correct header


with open("HappyBank.csv",'w', newline='') as f:
# ½ mark for correctly opening file
n=csv.writer(f) # ½ mark for creating writer object
n.writerow([‘EmpName’, ‘EmpID’, ‘Desig’,’Dept’])
for i in range(5):
id=input(‘Enter Employee ID::’)
nm=input(‘Enter Employee Name::’)
dsg=input(‘Enter Designation::’)
dep=input(‘Enter Department::’)
n.writerow([id,nm,dsg,dep])
# ½ mark for correctly writing a row
(ii)
def addRow(): # ½ mark for correct header
with open("HappyBank.csv",'a', newline='') as f:
# ½ mark for correctly opening file
n=csv.writer(f) # ½ mark for creating writer object
for i in range(5):
id=input(‘Enter Employee ID::’)
nm=input(‘Enter Employee Name::’)
dsg=input(‘Enter Designation::’)
dep=input(‘Enter Department::’)
n.writerow([id,nm,dsg,dep])
# ½ mark for correctly writing a row

34. (4)
Write SQL queries for the following:
(i) SELECT PName, BName FROM PRODUCT P, BRAND B WHERE
P.BID=B.BID;
(ii) DESC PRODUCT;
(iii) SELECT BName, AVG(Rating) FROM PRODUCT P, BRAND B
WHERE P.BID=B.BID GROUP BY BName HAVING Name='Medimix'
OR BName='Dove';
(iv) SELECT PName, UPrice, Rating FROM PRODUCT ORDER BY
Rating DESC;.

1 mark for each correct query statement


35. (4)
import mysql.connector as mysql # ½ mark for correct import statement

con1 = mysql.connect (host="localhost", user= "root", password="tiger",


database="SCHOOL")
#1 mark for correct connect statement

mycursor=con1.cursor()
rno= int(input("Enter Roll Number:: "))
name = input("Enter the name:: ")
DOB=input("Enter date of birth:: ")
fee= float(input("Enter Fee:: "))

# ½ marks for correctly accepting input

query="INSERT into student values ({}, '{}', '{}',{})".format(rno, name, DOB,


fee)
# 1 mark for correct query statement
mycursor.execute (query) # ½ marks for correctly executing the query
con1.commit() # ½ marks for correctly using commit
print("Data added successfully")

con1.close()
Q No. Section-E ( 5 x 2 = 10 Marks) Marks
36. i) 5
with open(‘Sport.dat’, ‘wb’) as f: # 1 mark for correct syntax
ii)
import pickle

def AddTeam():
with open((‘Sport.dat’, ‘ab’) as f:
#1 mark for correctly opening the file

sn=input(“Enter Sport name::”)


tn=input(“Enter Team name::”)
no=int(input(“Enter no of Players::”))
lst=[sn,tn,no]
pickle.dump(lst,f)
# 1 mark for correct input statements and writing data to file

iii)
def copyData():
fObj = open("SPORT.DAT", "rb")
f0bj1 open("BASKET.DAT", "wb")
# ½ mark for correctly opening each file

cnt=0
try:
while True:
data= pickle.load(fobj)
print (data)
if data [0] == "Basket Ball":
pickle.dump(data, fobj1)
cnt+=1
except:
fobj.close()
fobjl.close()
return cnt
# 1 mark for correct load statement and dumping data to file
37. (5)
a) HR Center, as it has the maximum number of computers.
b)

Bus Topology
c) Switch
d) Repeater is not required as the distances between any two blocks is not more
than 90m. However if it is required to connect Law block to HR Center then
Repeater will be required between those blocks as the distance is 105m.
e) WAN will be formed, because the distance is too big to be considered a
MAN
1 mark for each correct answer.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy