Sei sulla pagina 1di 13

SET- H

KENDRIYA VIDYALAYA SANGATHAN, AGRA REGION


COMPUTER SCIENCE – NEW (083)
Marking Scheme Pre Board Exam(2019-20) CLASS- XII
Max. Marks: 70 Time: 3 hrs
General Instructions:
● All questions are compulsory.

● Question paper is divided into 4 sections A, B, C and D.

 Section A : Unit-1
 Section B : Unit-2
 Section C: Unit-3
 Section D: Unit-4

SECTION :A
Q1. (a.) Find the output of following : 1/2+
(i) 12&10 (ii) 7^13 1/2
Ans (i) 8 (ii) 10
(1/2 mark for each)
(b.) What does ord() and chr() built-in function in python ? write one 1
example for each.
ANS ord() gives ordinal(ASCII) number corresponding to a character.
Example : ord(‘A’) =65
chr() gives character corresponding to a ordinal(ASCII) number .
Example : chr(65)= ‘A’
(1/2 mark for each)
(c.) Write the type of token from the following –
(i) elif (ii) Str1
Ans: (i) Keyword (ii) Identifier
(1/2 mark for each)
(d.) Rewrite the following code in python after removing all syntax 2
error(s). Underline each correction done in the code.
1=i

Page 1 of 13 083/8
J=1
While I<=5
While j <=2 :
Prent(I*J end=” ‘)
J+1=J
Print()
I=I+1

ANS i=1
j=1
while i<=5:
while j <=2 :
print(i*j, end=” “)
j+1=j
print()
i=i+1
(2 marks for all corrections)
(e.) Find and write the output of the following python code : 3
def run(s):
k=len(s)
m=” “
for i in range(0, k):
if (s[i].islower()) :
m = m + s[i].upper()
elif (s[i].isalpha()):
m = m + s[i].lower()
else:
m = m + ‘aa’
print(m)
run(‘sCHOOL2@Com’)
ANS: Output is- SchoolaaaacOM
(f.) Find and write the output of the following python code: 2
def sfun(str):
count=3
Page 2 of 13 083/8
while True:
if str[0]==’a’:
str = str[2 : ]
elif str[-1]==’b’:
str=str[ : 2]
else :
count+=1
break
print(str)
print(count)
sfun(“aabbcc”)
sfun(“aaccbb”)
sfun(“abcc”)
ANS bbcc
4
cc
4
cc
4
(1 mark for each correct output of function sfun() call)
(f.) Consider the following code : 2
import random
print(int(20+random.random()*5), end=’ ’)
print(int(20+random.random()*5), end=’ ’)
print(int(20+random.random()*5), end=’ ’)
print(int(20+random.random()*5))
choose the correct option/options from four given below. Also find
least value and highest value that can be generated.
(i) 20 22 24 25 (ii) 22 23 24 25
(iii.) 23 24 23 24 (iv) 21 21 21 21
ANS (iii.) and (iv.)
least value 20
highest value 24
(1 mark for correct option)
Page 3 of 13 083/8
(1 mark for least and highest value)

(g.) Explain all ways of passing parameters while calling a function in 2


python.
ANS (i) Positional parameter :in this function call need to match
number of argument as well as order of argument with
called function definition parametrs.
(ii) Default arguments : A parameter having default value in the
function header is known as a default parameter.
(iii) Keyword arguments : named arguments with assigned
values being passed in function call statement.
(2 marks for correct answer)
Q2. (a.) Rewrite the following code in python after removing all syntax error(s). 2
Underline each correction done in the code.
Define check()
n=input(“enter value of n(integer)”
N=n*2
Print(“n is :”+n)
Else :
N=n/2
Print(“n is :” n)
Ans def check():
n=int(input(“enter value of n(integer)”))
if n%2==0:
n=n*2
print(“n is :”,n)
else :
n=n/2
print(“n is :”, n)
(2 marks for all corrections)
(b.) Define a function name countto that reads a existing file named 3
“tofile.txt” and count numbers of all “to” or “TO”.
Ans. def countto():
file=open('tofile.txt','r')

Page 4 of 13 083/8
l = file.read()
count=0
word=l.split()
for w in word:
if w=="to" or w=="TO":
count=count+1
print(“Total no of to or TO “,count)
file.close()
(½ Mark for opening the file)
(½ Mark for reading all lines, and using loop)
(½ Mark for checking condition)
(½ Mark for printing lines)
(½ Mark for split)
(½ Mark for closing file)
(c.) Explain write() and writelines() functions in File handling of Python 2
with examples.
ANS Write() : writes string str1 to file referenced by file handle
Writelines() : writes all strings in list l as lines to file referenced by file
handle.
(1 mark for explaination)
(1 mark for examples)
(d.) Write a program that reads a string and checks whether it is a palindrome
string or not.
Note: NAVAN is palindrome, because its reverse is also NAVAN.
PAWAN is not a palindrome, because its reverse is NAWAP.
ANS def reverse(s):
return s[::-1]

def isPalindrome(s):
# Calling reverse function
rev = reverse(s)
# Checking if both string are equal or not
if (s == rev):
return True
return False

s = input(“enter string”)
Page 5 of 13 083/8
ans = isPalindrome(s)

if ans == True:
print("Yes")
else:
print("No")
( 1 mark for reversing a string)
(1 mark for comparing strings)
(e.) Write a Recursive function factorial(n) in python to calculate and return 4
the factorial of number n passed to the parameter.
ANS def factorial(n):
if n == 1:
return n
else:
return n*factorial(n-1)
num = int(input("Enter a number: "))
if num < 0:
print("factorial does not exist for negative numbers")
elif num == 0:
print("The factorial of 0 is 1")
else:
print("The factorial of",num,"is",factorial(num))
(2 marks for correct recursive function)
(2 mark for invoking)
(f.) Predict the output of following code : 2
def code(n) :
if n==0:
print(“stop”)
else:
print(n)
code(n-3)
code(15)
Ans 15
12
9

Page 6 of 13 083/8
6
3
Stop
(2 marks for correct answer)
(g.) Calculate the run-time efficiency of the following program segment : 2
i=1
while i<=n :
j=1
while j<=n:
k=1
while k<=n :
print(I,j,k)
k=k+1
j=j+1
i=i+1
Ans O(n3)
(1 mark for correct answer)
(1 mark for steps of calculation)
OR
Draw a multiple bar chart to compare sales of two salespersons for first
six months. Take months along x-axis and sales along y-axis. Also
display title of chart, labels, legends, xticks .
ANS: import matplotlib.pyplot as pl
import numpy as nm
sp1=[200,300,130,170,100,110]
sp2=[230,200,140,110,280,300]
x=nm.arange(0,12,2)
pl.bar(x,sp1,color="red",width=0.5,label='salesperson1')
pl.bar(x+0.5,sp2,color="green",width=0.5,label='salesperson2')
pl.title("sales of sp1 and sp2")
pl.xticks(x,['jan','feb','mar','apr','may','june'])
pl.xlabel("months")
pl.ylabel("sales")
pl.legend(loc='upper left')
Page 7 of 13 083/8
pl.show()
(1/2 mark for each correct pl.bar)
(1/2 mark for each correct xlabel and ylabel)
(1/2 mark for pl.show)
(1/2 mark for xticks)
(h.) ANS: 2
def COUNTLINES():
file=open('PARA.TXT','r'
) lines =
file.readlines()
count=0
for w in lines:
if w[0]=="B" or w[0]=="b":
count=count+1
print(“Total lines
,count) file.close()
(½ Mark for opening the file)
(½ Mark for reading all lines, and using
loop)
(½ Mark for checking condition)
(½ Mark for printing lines)

OR
ANS:
def DISPLAYWORDS():
c=0
file=open(‘PARA.TXT','r')
line = file.read()
word =
line.split() for
w in word:
if
len(w
)<3:
print(
w)

file.close()
(½ Mark for opening the file)
(½ Mark for reading line and/or
splitting)
(½ Mark for checking condition)
(½ Mark for printing word)

ANS False
(1 mark for correct answer)
(1 mark for correct implementation of stack)
(i.) Write a function in python, MakePush(elem,L) to add a new element 2
in a List of elements L, considering
it to act as push operation of the Stack data structure

Page 8 of 13 083/8
ANS def MakePush(elem,L):
L.append(elem)
Top=len(L)-1
(2 marks for correct definition)
SECTION-B
Q3. Questions 3 (a) to 3 (c) : Fill in the blanks
(a.) ------------refers to the process of obtaining corresponding IP address 1
from a domain name.
ANS DNS Resolution
(1 mark for correct answer)
(b.) ------------command determines whether remote machine can receive 1
test packet and reply.
ANS PING
(1 mark for correct answer)
(c.) ------------ is a network application that permits a user sitting at a 1
different location to work on a specific program on other computer.
ANS REMOTE LOGIN
(1 mark for correct answer)
(d.) ------------ is a system of rules that allow two or more entities of a 1
communications system to transmit information via any kind of
variation of a physical quantity.
ANS PROTOCOL
(1 mark for correct answer)
(e.) Give the full forms of the following : 2
(i) IMAP (ii) SSL
(iii.) https (iv) POP
(i) Internet Mail Access Protocol
(ii) Secure Socket Layer
(iii) Hypertext Transfer Protocol secure
(iv) Post Office Protocol
(1/2 mark for each)
(f.) Discuss how IPv4 is different from IPv6. 2
ANS IPv4 IPv6
version old New
Address size 32 bit 128 bits
Address format Decimal notation Hexadecimal notation
Number of 2^32 2^128
addresses
(2 marks for correct answer)

(g.) Write the definition of following in one line : 3


(i) Frequency modulation (ii) checksum
(iii.) URL
(i.) In frequency modulation, the frequency of the carrier signal
is varied as per the changes in the amplitude of modulating
signal.

Page 9 of 13 083/8
(ii.) The term checksum refers to a sum of some bits calculated
from digital data that is used to ensure the data integrity at
the receiver’s end.
(iii.) URL is a location on a net server.
(1 mark for each correct answer)
(h.) A Stock Exchange Company has set up its new centre in Kolkata for its
office . It has 4 blocks of buildings named Block A, Block B, Block C,
Block D.
Number of Computers

Block A 25
Block B 50
Block C 120
Block D 30

Shortest distances between various Blocks in meters:


Block A to Block B 60 m
Block B to Block C 40 m
Block C to Block A 30 m
Block D to Block C 50 m

(i) Suggest the most suitable place (i.e. block) to house the
server of this company with a suitable reason.
Ans. Block C , It has maximum number of computer.
(1 mark for correct answer )
(ii)Suggest the type of network to connect all the blocks with
suitable reason .
Ans. LAN
(1 mark for correct answer )
(iii)The company is planning to link all the blocks through a secure and
high speed wired medium. Suggest a way to connect all the blocks.
Ans. Star topology
OR Diagram
(1 mark for correct answer )
(iv) Suggest the most suitable wired medium for efficiently connecting
each computer installed in every block out of the following network
cables:
● Coaxial Cable ● Ethernet Cable
● Single Pair Telephone Cable
Ans. Ethernet Cable
(1 mark for correct answer)

Section : C
Q4. (a.) Give name of any two famous web frameworks. 1
Ans 1. ASP.Net 2. Catalyst etc.
(1/2 mark for each correct answer)
(b.) What is the purpose of setting.py file in Django ? 1

Page 10 of 13 083/8
Ans To configure settings for the Django project.
(1 mark for correct answer)
(c.) What will be the generated query sting ? 1
Query= “INSERT INTO books(title,ISBN)
VALUES(%s,%s)”.%(‘networking’,’234561’)”
Ans “INSERT INTO books(title,ISBN) VALUES(‘networking’,’234561’)”
(1 mark for correct answer)
(d.) What is database cursor ? 1
Ans A Database Cursor is a special control structure that facilitates the row
by row processing of records in a result set.
(1 mark for correct answer)
(e.) Write any four aggregate functions with syntax. 2
Ans (i.) AVG : SELECT AVG(Column_name) from tablename;
(ii.) COUNT : SELECT AVG(Column_name) from tablename;
(iii.) MAX : SELECT MAX(Column_name) from tablename;
(iv.) SELECT SUM(Column_name) from tablename;
(1/2 mark for each point)
(f.) Differentiate between Django GET and POST method. 2
Ans GET and POST are the only HTTP methods to use when dealing with
forms. Django's login form is returned using the POST method, in
which the browser bundles up the form data, encodes it for
transmission, sends it to the server, and then receives back its response.

Both of these are dictionary-like objects that give you access to GET
and POST data. POST data generally is submitted from an HTML
<form> , while GET data can come from a <form> or the query string
in the page's URL.
(2 Marks for correct difference)
(g.) Write a output for SQL queries (i) to (iii), which are based on the table:
GARMENT given below :
3
Table : GARMENT
GCODE GNAME SIZE COLOUR PRICE
111 Tshirt XL Red 1400
112 Jeans L Blue 1600
113 Skirt M Black 1100
114 Jacket XL Blue 4000
115 Trousers L Brown 1500
116 top L pink 1200

(i) SELECT COUNT(*), SIZE FROM GARMENT GROUP


BY SIZE HAVING COUNT(*)>1;
ANS. COUNT(*) SIZE
2 XL
3 L
1 M
(1 mark for correct answer)
(ii) SELECT MAX(PRICE),MIN(PRICE) FROM GARMENT;
ANS. MAX(PRICE) MIN(PRICE)
4000 1100
Page 11 of 13 083/8
(1 mark for correct answer)
(iii) SELECT GNAME,SIZE,PRICE FROM GARMENT
WHERE COLOUR =”Blue”;
ANS. GNAME SIZE PRICE
Jeans L 1600
Jacket XL 4000
(h.) Write SQL queries for (i) to (iv), which are based on the table: 4
GARMENT given in the question 4(g):
(i) To display the records from table GARMENT in
alphabetical order as per GNAME
ANS SELECT * FROM GARMENT ORDER BY GNAME;
(1 mark for correct answer)
(ii) To display GCODE, GNAME and SIZE where PRICE is
between 1000 and 1500.
ANS SELECT GCODE, GNAME ,SIZE FROM GARMENT
WHERE PRICE BETWEEN 1000 AND 1500;
(1 mark for correct answer)
(iii) To display names of those garments that are available in
‘XL’ Size.
ANS. SELECT GNAME FROM GARMENT WHERE
SIZE=”XL”;
(1 mark for correct answer)
(iv) To change the colour of garment with code as 116 to
“orange”
ANS. UPDATE GARMENT SET COLOUR=”Orange”
where GCODE=116;
(1 mark for correct answer)

SECTION :D
Q5. (a.) What is plagiarism ? 1
Ans Plagiarism is stealing someone else’s intellectual work and
representing it as your own work without giving credits.
(1 mark for correct answer)
(b.) What is computer forensics ? 1
Ans Methods used for interpretation of computer media for digital
evidence.
(1 mark for correct answer)
(c.) Why should intellectual property rights be protected ? 2
Ans (i) To encourages individuals and businesses to create new
software and applications

Page 12 of 13 083/8
(ii) Ensures new ideas
(iii) Encourages New technologies
(iv) Promotes investment in the national economy
(1/2 mark for each point)
(d.) Explains disability issues which obstruct teaching and using 2
compters.
Ans (i) Unavailability of teaching materials
(ii) Lack of special needs teachers
(iii) Lack of supporting curriculum
Some other points
(1/2 mark for each point)
(e.) How to protect against identity theft ? 2
Ans (i) Protect personal information
(ii) Use unique ids to protect your devices and accounts.
(iii) Use Biometric protection
(iv) Do not share personal information with someone.
(1/2 mark for each point)
(f.) Writes the benefits of e-waste recycling ? 2
Ans. (i) Allows for recovery of valuable precious metals.
(ii) Protects public health and water quality
(iii) Creates jobs
(iv) Saves landfill space
(1/2 mark for each point)

Page 13 of 13 083/8

Potrebbero piacerti anche