0% found this document useful (0 votes)
17 views16 pages

Xii Computer Science E

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)
17 views16 pages

Xii Computer Science E

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/ 16

No.

of pages - 16 (E)
MARKING SCHEME
PRE-BOARD EXAMINATION (2024-25)
CLASS : XII
SUBJECT: COMPUTER SCIENCE (083)
Time Allowed : 3 hours Maximum Marks : 70

Q. No. Section-A (21 x 1 = 21 Marks) Marks

1. FALSE (1)

2. A (1)

3. C (1)

4. B (1)

5. A (1)

6. D (1)

7. A (1)

8. D (1)

9. D (1)

10. B (1)

11. C (1)

12. D (1)

13. B (1)

14. A (1)

15. C (1)

16. FALSE (1)

1 XII-COMPUTER SC.-E
17. D (1)

18. B (1)

19. A (1)

20. D (1)

21. C (1)

Q. No. Section-B (7 x 2 = 14 Marks) Marks

22. Global variables: Defined outside of any function, usually at the top (2)

of a program. They can be accessed from anywhere in the program

and remain in memory for the duration of the program.

Local variables: Defined inside a function or block. They can only

be accessed from within the function or block where they are defined

and exist only during the function's execution.

A=50 #Global Variable

def demo():

A=60 #Local Variable

print(A)

demo()

print(A)

1 mark for correct difference between global and local variable. Half

mark for correctly identifying global variable and Half mark for

correctly identifying local variable in the given python code.

2 XII-COMPUTER SC.-E
23. Error: Errors represent serious issues that occur at the system level or (2)
issues with the Python interpreter itself. These are generally
unrecoverable and signify conditions that the programmer typically
does not handle.

Types: Syntax Error, Semantic Error Etc.

Exception: Exceptions represent runtime issues that occur while the


program is running. Unlike errors, exceptions can be anticipated and
handled by the programmer. Handled using try-except blocks.

Types: Built-in Exceptions, User-defined Exceptions

1 Mark for each correct difference (Two differences should be given)


24. f=open('Student.txt') (2)

a=f.read()

b=a.split()

z=0

for i in b:

if i[0]=='S':

z+=1

print("Total Number of Words = ",z)

f.close()

Half mark for opening the file in read mode. Half mark for reading the
file. Half mark for correct loop. Half mark correctly counting the
words.

3 XII-COMPUTER SC.-E
OR

f=open('Employee.txt')

a=f.readlines()

z=0

for i in a:

if i[-2]=='o': #Last character of each line is .(full stop)

z+=1

print("Number of lines = ",z)

f.close()

Half mark for opening the file in read mode. Half mark for reading the
file. Half mark for correct loop. Half mark correctly counting the
lines.

25. Correct answer is option C because randrange function will never (1+1=2)
give value 3 to b. So, multiplication of a and b will never give 9.

1 Mark for correct option and 1 mark for correct explaination.

26. def reverse_list(L): (2)

L1=[]

for i in range(len(L) - 1, -1, -1):

L1.append(L[i])

return L1

4 XII-COMPUTER SC.-E
L = [1, 2, 3, 4, 5]

print(reverse_list(L))

Half Mark each for identifying and correcting error.

27. A Primary Key constraint enforces the uniqueness and non- (2)
nullability of a column or set of columns, ensuring each record in a
table can be uniquely identified. This is critical for maintaining the
integrity and structure of relational databases.

“Ensures that a column cannot have a NULL value” – NOT NULL

1 Mark for correct definition and 1 mark for writing NOT NULL.

OR

Create table Employee(E_ID int primary key, E_Name char(50),

Phone int unique);

Half Mark for writing create table keyword. Half mark for each pair of

attribute, Data type and its constraint.

28. (i) Bus Topology (1+1=2)

(ii) Tree Topology

1 Mark for each correct response.

5 XII-COMPUTER SC.-E
OR

Topology refers to the arrangement or structure of how devices

(nodes) are connected in a network. It defines the physical or logical

layout of a network, determining how data is transmitted and how

devices communicate with each other.

E.g: Star Topology, Mesh Topology, Bus Topology, Tree Topology

etc.

1 Mark for correct definition of topology and Half mark each for two

correct examples.

Q. No. Section-C (3 x 3 = 09 Marks) Marks

29. def div(): (3)

for i in range(100,7000):

if i%5==0 and i%7==0 and i%2!=0 and i%20!=0:

print(i**0.5)

Half mark for correct function definition. 1 mark for correct loop. 1

mark for correct condition. Half mark for correct output.

6 XII-COMPUTER SC.-E
OR

def swap(D):

D1={}

for i in D:

D1[D[i]]=i

return D1

D={1:2,3:4,5:6,7:8}

print(swap(D))

Half mark for correct function definition. 1 mark for correct loop. 1
mark for correct swapping. Half mark for correct output.

30. def PUSH(S1): (3)

a=int(input("Enter ID = "))

b=input("Enter Name = ")

c=float(input("Enter Marks = "))

node=[a,b,c]

if len(S1)<1000:

S1.append(node)

else:

print("Over Flow")

7 XII-COMPUTER SC.-E
def POP(S1):

if len(S1)==0:

print("Under Flow")

else:

return S1.pop()

In push function, Half mark for correct node creation. Half mark for
adding data to the stack after correct condition. Half mark for printing
over flow.

In pop function, Half mark for under flow condition. Half mark for
printing underflow. Half mark for popping the correct node.

OR

def PUSH(book):

a=int(input("Enter Book Number = "))

b=input("Enter Book Name = ")

node=(a,b)

if b[0]=='S' and len(b)>=5:

book.append(node)

def DISPLAY(S1):

for i in S1:

if i[0]%2!=0:

print(i[1])

8 XII-COMPUTER SC.-E
In push function, Half mark for correct node creation. Half mark for
correct condition. Half mark for correctly pushing the node in the
stack.

In pop function, Half mark for correct loop. Half mark for correct
condition. Half mark for printing the correct output.

31. 1- (3)

##@

111-

****%

#####@

******%

Half mark for each correct row.

OR

(a) 1 (b) Infinite (c) 7

1 Mark for each correct response.


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

32. (i) Select ID from stationary where price>2000; (4x1=4)

(ii) Select * from stationary where Product_Name like ‘%a%’;

(iii) Select ID, Product_Name from stationary where Qty>100 and


Price<1500;

(iv) Select min(Price), max(Price) from stationary;

1 mark for each correct query.

9 XII-COMPUTER SC.-E
OR

(i)

ID S_Name

D1002 John

D1003 Mohan

D1005 Anwar

(ii)

ID S_Name Class Section

D1005 Anwar 11 A

(iii)

S_Name Class Section

Nisha 10 C

Aman 10 A

John 11 B

Anwar 11 A

Mohan 12 C

(iv)

S_Name

Nisha

10 XII-COMPUTER SC.-E
1 mark for each correct output.

33. import csv (2+2=4)


def Write_Rail():

records=[]

f=open('RAILWAYS.CSV','a')

for i in range(50):

PNR=int(input("Enter PNR Number = "))

Passenger_Name=input("Enter Passenger Name = "))

Fare=int(input("Enter Fare = "))

d=[PNR,Passenger_Name,Fare]

if Fare>999:

records.append(d)

w=csv.writer(f)

w.writerows(records)

f.close()

def Read_Rail():

f=open('RAILWAYS.CSV')

PNR=int(input("Enter PNR Number = "))

a=csv.reader(f)

for i in a:

if i[0]==PNR:

print("Passenger Name = ",i[1])

print("Fare = ",i[2])

11 XII-COMPUTER SC.-E
f.close()

In Write_Rail Function, Half mark for opening the file in append


mode. Half mark for correct loop. Half mark for creating the node.
Half mark for writing all the records in file at once.

In Read_Rail Fucntion, Half mark for opening the file in read mode.
Half mark for reading the data form file. Half mark for correct loop.
Half mark for correcting printing the data based on condition.

34. (i) Select Name, Country from Employee as E, Department as D (4x1=4)


where E.DCODE=D.DCODE and Gender=’MALE’ and Name
like ‘%a_’;

(ii) Select Gender, count(Gender) from Employee group by


Gender;

(iii) Degree = 9

Cardinality = 30

(iv) Select avg(Salary) from Employee;

OR

Select Name from Employee as E, Department as D where


E.DCODE=D.DCODE and Department=’HR’;

1 Mark for each correct query.

35. import mysql.connector as mys (4)

def Insert():

con=mys.connect (host="localhost", user="root", passwd='123456',


database="city")

12 XII-COMPUTER SC.-E
cur=con.cursor()

ID=int(input("Enter Restaurant ID = "))

Number=int(input("Enter Dish Name = "))

Name=input("Enter Dish Name = ")

Price=int(input("Enter Dish Price = "))

query="insert into restaurant values (%s,%s,'%s',%s)"%(ID,


Number,
Name, Price)

cur.execute(query)

con.commit()

print("Data Inserted Successfully")

con.close()

def Delete():

con=mys.connect(host="localhost",user="root",passwd='123456',
database="city")

cur=con.cursor()

query="delete from restaurant where Price>1000"

cur.execute(query)

con.commit()

print("Data Deleted Successfully")

con.close()

13 XII-COMPUTER SC.-E
For Insert function, Half mark for establishing the connection. Half
Mark for creating cursor. Half mark for executing correct query. Half
mark for commit.

For Delete function, Half mark for creating cursor. Half mark for
correct query. Half mark for executing query. Half mark for commit.

Q. No. Section-E (2 x 5 = 10 Marks) Marks

36. Pickling: (2+3=5)

 Pickling is the process of converting a Python object into a byte


stream (a binary format).

 This process is also called serialization.

 The purpose of pickling is to save Python objects to a file, send


them over a network, or store them in a database.

Unpickling:

 Unpickling is the reverse process of pickling, where the byte


stream (binary format) is converted back into the original
Python object.

 This process is also called deserialization.

 The goal of unpickling is to retrieve the original Python object


from a saved binary representation.

import pickle

f=open("data.dat","rb")

a=pickle.load(f)

x=a.find('Asd//5#')

14 XII-COMPUTER SC.-E
y=a.find('GHs89?')

z=a.find('ItL6$$#')

if x!=-1:

print('Asd//5# Found at = ',x)

else:

print('Asd//5# Not Found')

if y!=-1:

print('GHs89? Found at = ',y)

else:

print('GHs89? Not Found')

if z!=-1:

print('ItL6$$# Found at = ',z)

else:

print('ItL6$$# Not Found')

f.close()

1 mark each for correct difference between picking and unpickling (2

difference required). Half mark for opening the file in read mode. Half

mark for reading data from file. Half mark for finding index of first

string. Half mark for finding index of second string. Half mark for

finding index of third string. Half mark for printing Not found if any

15 XII-COMPUTER SC.-E
of the string is not found in file.

37. (i) Management block is the most suitable place to install server at (5x1=5)
Roorkee campus as it has maximum number of computers.

(ii)

(iii)

 Hub/Switch – It should be installed in every block to


connect computers.

 Repeater – As repeater regenerates the weak signals. It


should be placed between Management block and Admin
block as distance between these two blocks is more than 100
meters.

(iv) Radio wave

(v) Ethernet Cable

1 Mark for each correct answer.

16 XII-COMPUTER SC.-E

You might also like