67% found this document useful (3 votes)
3K views

MS-Computer Science-XII

The document is the marking scheme for the first preboard examination in Computer Science for Class XII students of Kendriya Vidyalaya Sangathan, Ranchi Region. It contains 5 sections with a total of 70 marks. Section A contains 18 short answer questions worth 1 mark each. Section B has 7 very short answer questions worth 2 marks each. Section C contains 5 short answer questions worth 3 marks each. Section D has 3 long answer questions worth 5 marks each. Section E contains 2 questions worth 4 marks each, with 1 internal choice in question 35 part c. All programming questions must be answered using the Python language.

Uploaded by

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

MS-Computer Science-XII

The document is the marking scheme for the first preboard examination in Computer Science for Class XII students of Kendriya Vidyalaya Sangathan, Ranchi Region. It contains 5 sections with a total of 70 marks. Section A contains 18 short answer questions worth 1 mark each. Section B has 7 very short answer questions worth 2 marks each. Section C contains 5 short answer questions worth 3 marks each. Section D has 3 long answer questions worth 5 marks each. Section E contains 2 questions worth 4 marks each, with 1 internal choice in question 35 part c. All programming questions must be answered using the Python language.

Uploaded by

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

KENDRIYA VIDYALAYA SANGATHAN

RANCHI RAGION
FIRST PREBOARD EXAMINATION
COMPUTER SCIENCE (083)
CLASS XII
MAX MARKS-70 TIME: 3 hrs
MARKING ACHEME
General Instructions:
1. This question paper contains five sections, Section A to E.
2. All questions are compulsory.
3. Section A have 18 questions carrying 01 mark each.
4. Section B has 07 Very Short Answer type questions carrying 02 marks each.
5. Section C has 05 Short Answer type questions carrying 03 marks each.
6. Section D has 03 Long Answer type questions carrying 05 marks each.
7. Section E has 02 questions carrying 04 marks each. One internal choice is given in Q35 against part c
only.
8. All programming questions are to be answered using Python Language only.

SECTION A
1 Identify the invalid Python statement from the following. 1
(a) _b=1 (b) __b1= 1 (c) b_=1 (d) 1 = _b

Ans – (d) 1 = _b
2 Identify the valid arithmetic operator in Python from the following. 1
(a) // (b) < (c) or (d) <>

Ans – (a) // floor division


3 If Statement in Python is __ 1
(a) looping statement (b) selection statement (c) iterative (d) sequential

Ans – (b) selection statement


4 Predict the correct output of the following Python statement – 1
print(4 + 3**3/2)

(a) 8 (b) 9 (c) 8.0 (d) 17.5

Ans – (d) 17.5


5 Choose the most correct statement among the following – 1

(a) a dictionary is a sequential set of elements


(b) a dictionary is a set of key-value pairs
(c) a dictionary is a sequential collection of elements key-value pairs
(d) a dictionary is a non-sequential collection of elements

Ans – (b) a dictionary is a set of key-value pairs


6 Consider the string state = “Jharkhand”. Identify the appropriate statement that will display the 1
last five characters of the string state?

(a) state [-5:] (b) state [4:] (c) state [:4] (d) state [:-4]

Ans – (a) state [-5:]


7 What will be the output of the following lines of Python code? 1

Page 1 of 13
if not False:
print(10)
else:
print(20)

(a) 10 (b) 20 (c) True (d) False

Ans – (a) 10
8 Consider the Python statement: f.seek(10, 1) 1
Choose the correct statement from the following:

(a) file pointer will move 10 byte in forward direction from beginning of the file
(b) file pointer will move 10 byte in forward direction from end of the file
(c) file pointer will move 10 byte in forward direction from current location
(d) file pointer will move 10 byte in backward direction from current location

Ans: (c) file pointer will move 10 byte in forward direction from current location
9 Which of the following function returns a list datatype? 1

a) d=f.read() b) d=f.read(10) c) d=f.readline() d) d=f.readlines()

Ans: d) d=f.readlines()
10 Identify the device on the network which is responsible for forwarding data from one device to 1
another

(a) NIC (b) Router (c) RJ45 (d) Repeater

Ans: (b) Router


11 A table has initially 5 columns and 8 rows. Consider the following sequence of operations 1
performed on the table –
i. 8 rows are added
ii. 2 columns are added
iii. 3 rows are deleted
iv. 1 column is added
What will be the cardinality and degree of the table at the end of above operations?

(a) 13,8 (b) 8, 13 (c) 14,5 (d) 5,8

Ans: (a) 13,8


12 Which of the following constraint is used to prevent a duplicate value in a record? 1

(a) Empty (b) check (c) primary key (d) unique

Ans: (d) unique


13 The structure of the table/relation can be displayed using __________ command. 1

(a) view (b) describe (c) show (d) select

Ans: (b) describe


14 Which of the following clause is used to remove the duplicating rows from a select statement? 1

(a) or (b) distinct (c) any (d)unique

Ans: (b) distinct


15 How do you change the file position to an offset value from the start? 1
Page 2 of 13
(a) fp.seek(offset, 0) (b) fp.seek(offset, 1) (c) fp.seek(offset, 2) (d) None of
them
Ans: (a) fp.seek(offset, 0)

16 Which of the following method is used to create a connection between the MySQL database and 1
Python?

(a) connector ( ) (b) connect ( ) (c) con ( ) (d) cont ( )

Ans: (b) connect ( )


Q17 and 18 are ASSERTION AND REASONING based questions. Mark the correct choice as
(a) Both A and R are true and R is the correct explanation for A
(b) Both A and R are true and R is not the correct explanation for A
(c) A is True but R is False
(d) A is false but R is True
17 Assertion (A): The function definition calculate(a, b, c=1,d) will give error. 1
Reason (R): All the non-default arguments must precede the default arguments.

Ans: (a) Both A and R are true and R is the correct explanation for A
18 Assertion (A): CSV files are used to store the data generated by various social media platforms. 1
Reason (R): CSV file can be opened with MS Excel.

Ans: (b) Both A and R are true and R is not the correct explanation for A
SECTION - B
19 Find error in the following code(if any) and correct code by rewriting code and underline the 2
correction;‐

x= int(“Enter value of x:”)


for in range [0,10]:
if x=y
print( x + y)
else:
print( x‐y)

Ans . Correct code:‐


x= int(input(“Enter value of x:”))
for in range (0,10):
if x==y:
print( x+y)
else:
print (x‐y)

½ mark for each correction


20 (a) 2
Find output generated by the following code:

Str = "Computer"
Str = Str[-4:]
print(Str*2)

Ans:
uteruter
OR
Consider the following lines of codes in Python and write the appropriate output:
Page 3 of 13
student = {'rollno':1001, 'name':'Akshay', 'age':17}
student['name']= “Abhay”
print(student)

Ans:
{'rollno': 1001, 'name': 'Abhay', 'age': 17}
21 What do you mean by Foreign key? How it is related with Referential Integrity? 2

Ans:
A foreign key is a non-key attribute whose value is derived from the primary key of another table.
The relationship between two tables is established with the help of foreign key. Referential
integrity is implemented on foreign key.

1 mark for explanation and 1 mark for relation with referential integrity.
22 Find output generated by the following code: 2
string="aabbcc"
count=3
while True:
if string[0]=='a':
string=string[2:]
elif string[-1]=='b':
string=string[:2]
else:
count+=1
break
print(string)
print(count)

Ans:
bbcc
4
23 Expand the following terms: 2
i. NIC
ii. TCP/IP
iii. POP
iv. SMTP

Ans:
i. Network Interface Card
ii. Transmission Control Protocol/ Internet Protocol
iii. Post Office Protocol
iv. Simple Mail Transfer Protocol
½ mark for each expansion
24 Write one advantage and one disadvantage of each – STAR Topology and Tree Topology 2

½ marks for each advantage and disadvantage

OR

What do you mean by Guided Media? Name any three guided media?

Ans –
Guided media – Physical Connection – ½ mark
Page 4 of 13
Twisted pair cable, Co-axial cable, Fiber-optic cable)

½ mark for each name


25 Differentiate between DDL and DML? 2

Ans:
Data Definition Language (DDL): This is a category of SQL commands. All the commands
which are used to create, destroy, or restructure databases and tables come under this category.
Examples of DDL commands are ‐ CREATE, DROP, ALTER.
Data Manipulation Language (DML): This is a category of SQL commands. All the commands
which are used to manipulate data within tables come under this category. Examples of DML
commands are ‐ INSERT, UPDATE, DELETE.

OR

Write the main difference between INSERT and UPDATE Commands in SQL

Ans:
INSERT used to insert data into a table.
UPDATE used to update existing data within a table.

SECTION - C
26 Write definition of a method/function AddOdd(VALUES) to display sum of odd values from the 3
list of VALUES

Ans:
def AddOdd(Values):
n=len(NUMBERS)
s=0
for i in range(n):
if (i%2!=0):
s=s+NUMBERS[i]
print(s)

(2 Marks for Logic 1 mark for function definition)


27 Define a function SHOWWORD () in python to read lines from a text file STORY.TXT, and 3
display those words, whose length is less than 5.

Ans:
def SHOWWORD () :
c=0
file=open(‘STORY.TXT,'r')
line = file.read()
word = line.split()
for w in word:
if len(w)<5:
print( w)
file.close()
(½ Mark for opening the file)
(½ Mark for reading line and/or splitting)
(½ Mark for checking condition)
(½ Mark for printing word)

Page 5 of 13
OR

Write a user defined function in python that displays the number of lines starting with 'H' in the
file para.txt

Ans:
def count H( ):
f = open (“para.txt” , “r” )
lines =0
l=f. readlines ()
for i in L:
if i [0]== ‘H’:
lines +=1
print (“No. of lines are: “ , lines)

(½ Mark for opening the file)


(½ Mark for reading line and/or splitting)
(½ Mark for checking condition)
(½ Mark for printing word)
28 Write the outputs of the SQL queries (a) to (c) based on the relation Furniture 3

No Itemname Type Dateofstock Price Discount


1 White lotus Double Bed 23/02/02 30000 25
2 Pink feather Baby Cot 20/01/02 7000 20
3 Dolphin Baby Cot 19/02/02 9500 20
4 Decent Office Table 01/01/02 25000 30
5 Comfort Zone Double Bed 12/01/02 25000 25
6 Donald Baby Cot 24/02/02 6500 15
7 Royal finish Office Table 20/02/02 18000 30
8 Royal tiger Sofa 22/02/02 31000 30
9 Econo sitting Sofa 13/12/01 9500 25
10 paradise Dining Table 19/02/02 11500 25
11 Wood Comfort Double Bed 23/03/03 25000 25
12 Old Fox Sofa 20/02/03 17000 20
13 Micky Baby Cot 21/02/03 7500 15

(a) SELECT Itemname FROM Furniture WHERE Type="Double Bed";


(b) SELECT MONTHNAME(Dateofstock) FROM Furniture WHERE Type="Sofa";
(c) SELECT Price*Discount FROM Furniture WHERE Dateofstock>31/12/02;

Ans:
(a) (b) (c)
Itemane MONTHNAME(Dateofstock) Price*DIscount
White lotus February 625000
Comfort Zone December 340000
Wood Comfort February 112500

(1 mark for correct Answer)


29 Consider the following table GAMES 3

GCode GameName Number PrizeMoney ScheduleDate


101 Carom Board 2 5000 23‐Jan‐2004
102 Badminton 2 12000 12‐Dec‐2003

Page 6 of 13
103 Table Tennis 4 8000 14‐Feb‐2004
105 Chess 2 9000 01‐Jan‐2004
108 Lawn Tennis 4 25000 19‐Mar‐2004
Write the output for the following queries :
(i) SELECT COUNT(DISTINCT Number) FROM GAMES;
(ii) SELECT MAX(ScheduleDate),MIN(ScheduleDate) FROM GAMES;
(iii) SELECT SUM(PrizeMoney) FROM GAMES;

Ans:

(i) 2
(ii) 19‐Mar‐2004 12‐Dec‐2003
(iii)59000

30 Write PushOn(Book) and Pop(Book) methods/functions in Python to add a new Book and delete 3
a Book from a list of Book titles, considering them to act as push and pop operations of the Stack
data structure.

Ans:
def PushOn(Book):
a=input(“enter book title :”)
Book.append(a)

def Pop(Book):
if (Book = =[ ]):
print(“Stack empty”)
else:
print(“Deleted element :”)
Book.pop()

OR

Mr.Ajay has created a list of elements. Help him to write a program in python with functions,
PushEl(element) and PopEl(element) to add a new element and delete an element from a List of
element Description, considering them to act as push and pop operations of the Stack data
structure . Push the element into the stack only when the element is divisible by 4.

For eg:if L=[2,5,6,8,24,32]


then stack content will be 32 24 8

Ans:
N=[12, 13, 34, 56, 21, 79, 98, 22, 35, 38]
def PUSHEl(S,N):
S.append(N)
def POPEl(S):
if S!=[]:
return S.pop()
else:
return None
ST=[]
for k in N:
if k%4==0:
PUSH(ST,k)
while True:
Page 7 of 13
if ST!=[]:
print(POP(ST),end=" ")
else: break

SECTION - D
31 India Tech Solutions (ITS) is a professional consultancy company. The company is planning 5
to set up their new offices in India with its hub at Hyderabad. As a network adviser, you
have to understand their requirement and suggest them the best available solutions. Their
queries are mentioned as (i) to (v) below.

Physical locations of the blocks of TTC

HR BLOCK MEETING BLOCK

FINANCE BLOCK

Block to block distance (in m)


Block (From) Block (To) Distance
HR Block MEETING 110
HR Block Finance 40
MEETING Finance 80
Expected number of computers
Block Computers
HR 25
Finance 120
MEETING 90

(i)Which will be the most appropriate block, where TTC should plan to install their server?
(ii) Draw a block to block cable layout to connect all the buildings in the most appropriate
manner for efficient communication.
(iii)What will be the best possible connectivity out of the following, you will suggest to
connect the new set up of offices in Bengalore with its London based office.
 Satellite Link
 lInfrared
 Ethernet
(iv)Which of the following device will be suggested by you to connect each computer in
each of the buildings?
 l Switch
 l Modem
 l Gateway
(v) Company is planning to connect its offices in Hyderabad which is less than 1 km. Which
type of network will be formed?

Ans:
(i) TTC should install its server in finance block as it is having maximum number of
computers.
(ii) Any suitable lyout
(iii) Satellite Link.
(iv) Switch.
Page 8 of 13
(v) LAN

32 Find the output of the following: 2


(a)
fruit_list1 = ['Apple', 'Berry', 'Cherry', 'Papaya']
fruit_list2 = fruit_list1
fruit_list3 = fruit_list1[:]
fruit_list2[0] = 'Guava'
fruit_list3[1] = 'Kiwi'
sum = 0
for ls in (fruit_list1, fruit_list2, fruit_list3):
if ls[0] == 'Guava':
sum += 1
if ls[1] == 'Kiwi':
sum += 20
print (sum)

Ans. Output is:


22
(b) Consider the table 3
TRAINER
TID TNAME CITY HIREDATE SALARY
101 SUNAINA MUMBAI 1998‐10‐15 90000
102 ANAMIKA DELHI 1994‐12‐24 80000
103 DEEPTI CHANDIGARG 2001‐12‐21 82000
104 MEENAKSHI DELHI 2002‐12‐25 78000
105 RICHA MUMBAI 1996‐01‐12 95000
106 MANIPRABHA CHENNAI 2001‐12‐12 69000

The Following program code is used to increase the salary of Trainer SUNAINA by 2000.

Note the following to establish connectivity between Python and MYSQL:


 Username is root
 Password is system
 The table exists in a MYSQL database named Admin.

Write the following missing statements to complete the code:


Statement 1 – to form the cursor object
Statement 2 – to execute the command that inserts the record in the table Student.
Statement 3- to add the record permanently in the database

import mysql.connector as mydb


mycon = mydb.connect
(host = “localhost”,
user = “root”,
passwd = “system”,
database = “Admin”)
cursor = _______________ #Statement 1
sql = “UPDATE TRAINER SET SALARY = SALARY + 2000
WHERE TNAME = ‘SUNAINA’”
cursor. _______________ #Statement 2
_______________ #Statement 3
mycon.close( )

Page 9 of 13
Ans:
Statement 1 – mycon.cursor ( )
Statement 2 – execute(sql).
Statement 3- mycon.commit ( )
OR
(a) Write the output of the following Python program code: 2
my_dict = {}
my_dict[(1,2,4)] = 8
my_dict[(4,2,1)] = 10
my_dict[(1,2)] = 12
sum = 0
for k in my_dict:
sum += my_dict[k]
print (sum)
print(my_dict)

Ans. Output is:


30
{(1, 2, 4): 8, (4, 2, 1): 10, (1, 2): 12}
(b) Consider the table 3
TABLE : GRADUATE
S.NO NAME STIPEND SUBJECT AVERAGE DIV

1 KARAN 400 PHYSICS 68 I


2 DIWAKAR 450 COMP Sc 68 I
3 DIVYA 300 CHEMISTRY 62 I
4 REKHA 350 PHYSICS 63 I
5 ARJUN 500 MATHS 70 I
6 SABINA 400 CHEMISTRY 55 II
7 JOHN 250 PHYSICS 64 I
8 ROBERT 450 MATHS 68 I
9 RUBINA 500 COMP Sc 62 I
10 VIKAS 400 MATHS 57 II

The Following program code is used to view the details of the graduate whose subject is
PHYSICS.

Note the following to establish connectivity between Python and MYSQL:


 Username is root
 Password is system
 The table exists in a MYSQL database named Admin.

Write the following missing statements to complete the code:


Statement 1 – to import the proper module
Statement 2 – to create the cursor object.
Statement 3- to Close the connection

import ______________ as mydb #Statement 1


mycon = mydb.connect
(host = “localhost”,
user = “root”,
passwd = “system”,
Page 10 of 13
database = “Admin”)
cursor = _________________ #Statement 2
sql = “SELECT * FROM GRADUATE WHERE SUBJECT = ‘PHYSICS’”
cursor. execute(sql)
mycon.commit ( )
___________________ #Statement 3

Ans:
Statement 1 – mysql.connector
Statement 2 –. mycon.cursor ( )
Statement 3- mycon.close( )
33 Sumit is a programmer who is working on a project that requires student data of a school to 5
be stored in a CSV file. Student data consists of roll no, name, class and section. He has
written a program to obtain the student data from user and write it to a CSV file. After
getting errors in the program he left five statements blank in the program as shown below.
Help him to find the answer of the following questions to find the correct code for missing
statements.

#Incomplete Code
import_____ #Statement 1
fh = open(_____, _____, newline=‘ ’) #Statement 2
stuwriter = csv._____ #Statement 3
data = []
header = [‘ROLL_NO’, ‘NAME’, ‘CLASS’, ‘SECTION’]
data.append(header)

for i in range(5):
roll_no = int(input(“Enter Roll Number : ”))
name = input(“Enter Name : ”)
Class = input(“Class : ”)
section = input(“Enter Section : ”)
rec = [_____] #Statement 4
data.append(rec)
stuwriter. _____ (data) #Statement 5
fh.close()

(i) Identify the suitable code for blank space in line marked as Statement 1.
(ii) Identify the missing code for blank space in line marked as Statement 2.
(iii) Choose the function name (with argument) that should be used in the blank space of line
marked as Statement 3.
(iv) Identify the suitable code for blank space in line marked as Statement 4.
(v) Choose the function name that should be used in the blank space of line marked as
Statement 5 to create the desired CSV file?

Ans.
(i) csv
(ii) “Student.csv”,“w”
(iii) writer(fh)
(iv) roll_no,name,Class,section
(v) writerows()

OR

Page 11 of 13
What are the advantages of binary file over text file? Write a Python program in Python to
search the details of the employees (name, designation and salary) whose salary is greater
than 5000. The records are stored in the file emp.dat. consider each record in the file emp.dat
as a list containing name, designation and salary.

Ans.
In binary file, there is no terminator for a line and the data is stored after converting it into
machine understandable binary language. A binary file stores the data in the same way as
stored in the memory. Like text file we can’t read a binary file using a text editor.
----------------- 2 marks (any suitable difference)

import pickle as p
L=[]
with open(‘emp.dat’,’rb’) as f:
L=p.load(f)
for r in L:
if r[2]>5000:
print(“name=”,r[0])
print(“designation=”,r[1])
print(“salary=”,r[2])
----------------3 marks (any suitable code)
SECTION - E
34 Based on given table “DITERGENTS” answer following questions.
PID PName Price Category Manufacturer
1 Nirma 40 Detergent Powder Nirma Group
2 Surf 80 Detergent Powder HL
3 Vim Bar 20 Disc washing Bar HL
4 Neem Face Wash 50 Face Wash Himalaya 1
a) Write SQL statement to display details of all the products not manufactured by HL. 1
b) Write SQL statement to display name of the detergent powder manufactured by HL. 2
c) Write SQL statement to display the name of the Product whose price is more than 0.5
hundred.
OR
c) Write SQL statement to display name of all such Product which start with letter
‘N’

Ans:

a) Select * from DITERGENTS where manufacturer = ‘HL’;


b) Select Pname from DITERGENTS where manufacturer != ‘HL’;
c) Select Pname from DITERGENTS where price > price/100;

or
c) Select Pname from DITERGENTS where left(pname) = ‘N’;
35 Arun is a class XII student of computer science. The CCA in-charge of his school wants to 1+1+2
display the words form a text files which are less than 4 characters. With the help of his
computer teacher Arun has developed a method/function FindWords() for him in python
which read lines from a text file Thoughts. TXT, and display those words, which are lesser
than 4 characters. His teachers kept few blanks in between the code and asked him to fill the
blanks so that the code will run to find desired result. Do the needful with the following
python code.

Page 12 of 13
def FindWords():
c=0
file=open(‘NewsLetter.TXT’, ‘_____’) #Statement-1
line = file._____ #Statement-2
word = _____ #Statement-3
for c in word:
if _____: #Statement-4
print(c)
_________ #Statement-5
FindWords()

(i) Write mode of opening the file in statement-1?


(ii) Fill in the blank in statement-2 to read the data from the file.
(iii) Fill in the blank in statement-3 to read data word by word
(iv) Fill in the blank in statement-4, which display the word having lesser than 4 characters

OR (Only for iii and iv above)


(v) Fill in the blank in Statement-5 to close the file.
(vi) Which method of text file will read only one line of the file?

Ans:
(i) r
(ii) read()
(iii) line.split()
(iv) len(c)<4

OR (Only for iii and iv above)


(iii) file.close()
(iv) readline()

Page 13 of 13

You might also like