0% found this document useful (0 votes)
6 views5 pages

Cs Model Ans Set1

Uploaded by

jackychan56687
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)
6 views5 pages

Cs Model Ans Set1

Uploaded by

jackychan56687
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/ 5

MODEL EXAMINATION-set1

Computer Science (083)


Class – XII
Qn.No Explanation Mark
s
1. b) False 1
2. c) COUNT 1
3. a) 42 1
4. a) ORDER BY 1
5. b) resultset 1
6. d) extend() 1
7. b) myfile.readlines() 1
8. [1,2,3,4,5,6,7,8] 1
9. b) The file will be opened, and the contents will be cleared 1
10. d) Cartesian product 1
11. b) NameError 1
12. fh=open(“student,csv”,”w”) 1
13. ['o', 'n', 'e', 3] 1
14 c) Pickle 1
15. a) pickle.dump(<object to be written>, <file handle of open file>) 1
16. d) 5 2 1 * 1
17. b) print(my_dict['apple', 'banana']) 1
18. c) Drop 1
19. a) CBSE 2024 CBSE 2024 1
20. d) A is false but R is true. 1
21. c) A is true but R is false. 1
Q No Section-B ( 7 x 2=14 Marks) Mark
s
22. In Python, seek() function is used to change the position of the File Handle to a
given specific position.
Syntax: fi.seek(offset, from_where), where fi is the file pointer Offset: This is used
for defining the number of positions to move forward.
from_where: This is used for defining the point of reference. It can take [2]
0: beginning of the file. 1: current position of the file. 2: end of the file.
23. 30 [2]
a) 5
24.
b) 50
[40, 20, 30, 10] [2]

c) [40, 20, 30, 10, 70]


d) [10, 20, 30, 40, 70]
In
25. di [2]
a wo
8
26. d) 30#40#50#
maximum values [2]
FROM - 3
TO-4
27. AdmissionNo should be set as primary key because admission numbers are unique
for each and every students of the school, which is not possible in the case with [2]
RollNo and Name.
28. SELECT * FROM EMPLOYEE WHERE commission IS null; [2]
Q.No. Section-C ( 3 x 3 = 9 Marks) Mark
s
29. f=open(“story.txt”,”r”))
s=f.read()
L=s.split()
c=0
for w in L:
if w==”to”:
c+=1
f.close()
print(c)
OR
def countVowels(): [3]
fobj = open(“myfile.txt”)
data = fobj.read()
count = 0
vowels=[‘a’,’e’,’i’,’o’,’u’]
for ch in data:
if ch in vowels:
count +=1
print(“Count of vowels in file:”, count)
30. def MakePush(MyStack):
nm=input(“Enter Cidy Name”)
MyStack.append(nm)
def display():
print(“Topmost Element:”,MyStack[-1])
print(“Elements in the stack are:”)
print(MyStack)
def MakePop(MyStack):
if MyStack == []: [3]
print(“Underflow! Stack is Empty!”)
else:
ele=MyStack.pop()
print(“Popped out element is:”, ele)

OR
def push_order(ORDERS, REC):
ORDERS.append(REC)
def pop_order(ORDERS):
if ORDERS==[]:
print("Underflow")
else:
rec=ORDERS.pop()
return(rec)
def peep(BooksStack):
if ORDERS==[]:
print("None")
else:
print(ORDERS[-1])

31. 10.0 # 10.0


10.0 $ 20
1.0 # 1.0
1.0 $ 20
[3]
OR
1
1
[2,3,4]
Q No Section-D ( 4 x 4 = 16 Marks) Mark
s
1. SELECT *FROM STUDENT WHERE Stream = 'Nonmedical' ;
32. 2. SELECT Name FROM STUDENT WHERE Class LIKE '12%'
ORDER BY Stipend ;
3. SELECT * FROM STUDENT ORDER BY AvgMark DESC ;
4. SELECT Name, Stipend, Stream, (Stipend * 12) AS
Yearly_Stipend FROM STUDENT ;
OR
1. SELECT COUNT(DISTINCT SPORTS) FROM Club ;
2. SELECT MIN(Age) FROM CLUB WHERE Sex = 'F' ;
3. SELECT AVG(Pay) FROM CLUB WHERE Sports = 'KARATE' ;
4. SELECT SUM(Pay) FROM CLUB WHERE Dateofapp > '1998-01-31';
[4]
import csv
f=open("student.csv","r")
33.
d=csv.reader(f)
next(f) [4]
print("Students Scored More than 80")
print()
count=0
for rec in d:
count+=1
if int(rec[2])>80:
print("Roll Number =", rec[0])
print("Name =", rec[1])
print("Marks=", rec[2])
print(‘Total number of records:’,count)
f.close( )
34.
a)Select Department, Count(*) from Teacher Group by Department;
[4]
b)Select * from teacher where DOJ =(Select Max(DOJ) from teacher);

c)Select Name,teacher.Department,joining.posting from Teacher,Joining


where teacher.department=joining.department AND joining.posting=’Kanpur’;

d)Select Name,DOJ,Salary,teacher.department,posting.department from teacher, joi


ning where teacher.department=joining.department AND
joining.posting=’Nainital’ AND salary >=50000;
35.
a)import mysql.connector as mycon
mydb=mycon.connect(host=’localhost’,
database=’mydatabase’,
user=’root’,
passwd=’1234’)
mycursor=mydb.cursor()
mycursor.execute(“show tables”)
[4]
print(“Tables available in the database mydatabse1 are:”)
for i in mycursor:
print(i)
b) import mysql.connector as mycon
mydb=mycon.connect(host=’localhost’,
database=’mydatabase’,
user=’root’,
passwd=’1234’)
mycursor=mydb.cursor()
mycursor.execute(“Desc Company”)
print(“structure of the table ‘Company’:”)
for i in mycursor:
print(i)
Q.NO.
SECTION E (2 X 5 = 10 Marks) Marks

36.
a)import pickle
f=open(“stud.dat”,”wb”)
l=[]
while(input(“Enter your choice”) ==’y’):
r=int(input(“Enter your roll no”))
na=input(“Enter your name”)
mark=int(input(“Enter your Marks”))
l=[r,na,mark]
[5]
pickle.dump(l,f)
f.close()

b) import pickle
f=open(“stud.dat”,”rb”)
l=[]
try:
while True:
l=pickle.load(f)
if l[2]>90:
print(l)
except EOFError:
f.close()
37.
1.

2. Server can be placed in the ADMIN building as it has the maximum


number of computer.
3. (a) Repeater can be placed between ADMIN and SENIOR and [5]
ADMIN and JUNIOR building as the distance is more than 100 m.
(b) Hub/Switch : can be placed in all building in order to connect the
computers
4. Radio waves can be used in hilly regions as they can travel through
Obstacles.

You might also like