Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

PREBOARD2

Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

SET - B

VISHWA SISHYA VIDYODAYA SR.SEC.SCHOOL (CBSE), POLLACHI.


PRE-BOARD EXAMINATION 2019-20

CLASS: XII MAX MARKS: 70


SUBJECT: COMPUTER SCIENCE (083) DURATIION: 3 HOURS

[MARKING SCHEME / ANSWER KEY]

SECTION – A
Q1 (a) If A = “Python” and B = list(A), then identify invalid python statements: 1
(i) A[0] = ‘p’ (ii) B[0] = ‘p’ (iii) A[0] = len(A) (iv) B[0] = len(B)
Ans. (i) and (iii)
(1 Mark for correct answer)
(b) Write the type of tokens for the following: 1
(i) pop (ii) break
Ans. (i) Identifier (ii) keyword
(½ Mark for each correct answer)
(c) Which python library module requires to be imported to invoke the function: 1
(i) cos( ) (ii) xticks( )
Ans. (i) math (ii) pyplot or matplotlib.pyplot
(½ Mark for each correct answer)
(d) Rewrite the following code in python after removing all the syntax errors. 2
Underline each correction done in the code.

250 = Number
WHILE Number<=1000:
if Number=>750
print(Number)
Number=Number+100
else
print(Number*2)

Ans. Number = 250


while Number<=1000:
if Number>=750 :
print(Number)
Number=Number+100
else :
print(Number*2)
(½ Mark for each correction up to any 4 corrections)
(e) Write the output of the following python code. 2
def change(msg):
n = len(msg)
new_msg = ‘’
for i in range(0,n):
if not msg[i].isalpha():
new_msg = new_msg + ‘@’
else:
if msg[i].isupper():
new_msg = new_msg + msg[i]*2
else:
new_msg = new_msg + msg[i]
return new_msg
new_msg = change(“15 New Men”)
print(new_msg)
Ans. @@@NNew@MMen
(2 Marks for correct output)
(Proportionate marks can be given for partially correct answer)
(f) Write the output of the following python code. 3
def runme(x=1, y=2):
x = x+y
y+=1
print(x, ‘$’, y)
return x,y

a,b = runme()
print(a, ‘#’, b)
runme(a,b)
Ans. 3 $ 3
3#3
6$4
(1 Mark for each correct line of output)
(g) Select the possible output(s) of the following code from the given option. 2
Also, specify the maximum and minimum value that can be assigned to
variable NUM.
import random
cities = [‘Agra’, ‘Delhi’, ‘Chennai’, ‘Bhopal’]
NUM = random.randint(1,2)+1
for city in cities:
for I in range(1,NUM):
print(city, end=‘’)
print(‘\n’)

(i) Agra (ii) Agra


DelhiDelhi Delhi
ChennaiChennaiChennai Chennai
BhopalBhopalBhopalBhopal Bhopal

(iii) AgraAgra (iv) ChennaiChennai


DelhiDelhi BhopalBhopal
ChennaiChennai
BhopalBhopal
Ans. (ii) and (iii) are the possible outputs.
Max Value of NUM : 3
Min Value of NUM : 2
(1 Mark for selecting correct possible outputs)
( ½ Mark each for correct max and min value)
Q2 (a) If S = “Python”, then what will be the output of – (i) S[::-2] (ii) S[2:6:1] 1

Ans. (i) nhy (ii) thon


( ½ Mark for each correct answer)
(b) Which of the following are not valid operations in python? 1
(i) slicing a list (ii) concatenation of a list and a tuple
(iii) slicing a dictionary (iv) adding an element to an existing tuple
Ans. (ii), (iii) and (iv) are not valid.
(1 Mark for correct answer)
(c) Consider python statement : X = eval(input(‘Enter data : ’)) 1
What will be the data type of X if the user input is:
(i) [1,3,4] (ii) 45.6
Ans. (i) list (ii) float
(½ Mark for each correct answer)
(d) Write the output of the following python code. 1
st = “python”
i = len(st)-1
while i >= 0:
print(st[i], end=‘#’)
i-=1
Ans. n#o#h#t#y#p#
(1 Mark for correct answer)
(e) Write the output of the following python code. 1
a=0
def change(A):
global a
a = a+10
change(a)
print(a)
Ans. 10
(1 Mark for correct answer)
(f) How can we access a global variable inside of a function, if the function has 2
a variable with the same name? Give an example to support your answer.
Ans. By declaring a variable with the keyword global in front of it before its use.
Example:
a=0
def change():
global a
a = a+10
change()
print(a)
(or any suitable example)
(1 Mark for correct answer and 1 Mark for suitable example)
(g) A python program intends to plot a bar chart to represent marks scored by 2
five students in Math in monthly test of November. The partial code is given
below:
import matplotlib.pyplot as pl
import numpy as np
marks = [56,67,87,36,23]
names = [‘A’, ‘B’, ‘C’, ‘D’, ‘E’]
X = np.arange(len(names))

Write the appropriate python statement to:


(i) Plot the intended bar chart
(ii) Give the title – ‘Test Result’ to the plot
(iii) Provide the label – ‘Marks scored’ to the y axis
(iv) Provide the names of students on o x-axis ticks
OR
Give the output of the given python code.
import numpy as np
import matplotlib.pyplot as plt
height = [3, 12, 5, 18, 25]
x = ('A1', 'A2', 'A3', 'A4', 'A5')
y_pos = np.arange(len(x))
plt.plot(y_pos, height, linestyle='--',
linestyle=' marker='o')
plt.xticks(y_pos, x)
plt.show()

Ans. (i) pl.bar(X, marks)


(ii) pl.title(‘Test Result’)
(iii) pl.ylabel(“Marks scored”)
(iv) pl.xticks(X, names)
( ½ Mark for each correct answer)

OR

(1 Mark for correctly plotting the line chart with correct xticks)
xticks)
( ½ Mark for correct line style)
( ½ Mark for correct markers)
(h) Write a function in python to count the number of lines in a text file 2
‘readme.txt’, that contain the word ‘happy’ anywhere in them.
OR
Write a function Biggest( ) in python to read a text file ‘readme.txt’ and
then return the word that has the maximum length.
Ans. def count():
f = open(‘readme.txt’, ‘r’)
lines = f.readlines()
c=0
for line in lines:
if ‘happy’ in line:
c+=1
print(“Total number of such lines: ”, c)
f.close()

*or any other correct implementation producing the same result


(½ Mark for opening the file in read mode)
(½ Mark for reading all lines, and using loop)
(½ Mark for checking condition)
(½ Mark for printing or returning result)
OR
def count():
f = open(‘readme.txt’, ‘r’)
big = “”
content = f.read()
words = content.split(‘ ’)
for w in words:
if len(w)>len(big):
big = w
f.close()
return big

*or any other correct implementation producing the same result


(½ Mark for opening the file in read mode)
(½ Mark for reading the file and splitting into words)
(½ Mark for checking condition)
(½ Mark for returning result)

(i) Write a recursive function Fib(n) in python to find and return the nth 3
Fibonacci number. Specify the base case by writing a comment in front of it.
Call the function in a loop to print the Fibonacci series up to that number.
OR
Write a recursive function BSearch(Arr, Beg, End, item) to search for the
item element in the list Arr having Beg and End as its lower bound and
upper bound index respectively. Invoke the function in main program.
Ans. def Fib(n):
if n==0: #First Base case
return 0
elif n==1: #Second Base case
return 1
else:
return Fib(n-1)+Fib(n-2)

n = int(input(“Enter the number of terms : ”))


for i in range(n):
print(Fib(i), end=‘ ’)

*or any other correct implementation producing the same result


(2 Marks for correct recursive code)
(1 Mark for invoking the function in a loop)

OR

def BSearch(Arr,Beg,End,item):
if Beg>End:
return -999 #Base Case 1 for Search Unsuccessful
Mid = (Beg+End)//2
if item == Arr[Mid]: #Base case 2
return Mid
elif item < Arr[Mid]:
return BSearch(Arr, Beg, Mid-1, item)
else:
return BSearch(Arr, Mid+1, End,item)

Arr = [ 2, 3, 4, 10, 40 ]
X =int(input('Enter element to be searched'))
result = BSearch(Arr,0,len(Arr)-1,X)
if result != -999:
print("Element located at index ", result)
else:
print("Element not found!")

*or any other correct implementation producing the same result


(2 Marks for correct recursive code)
(1 Mark for invoking the function)

(j) A particular stack is being implemented as a list (named Books), where 4


every element is again a list containing two pieces of information – book_no
and title.
Write the functions Push(Books) and Pop(Books) to add a new book and to
delete a book considering them as push and pop operations of the stack data
structure.
Note: Ask the user input in the Push(Books) function itself.
OR
A particular Queue is being implemented as a list (named Tickets), where
every element is again a list containing two pieces of information – ticket_id
and name.
Write the functions Queue(Tickets) and DeQueue(Tickets) to add a new
ticket and to delete a ticket considering them as insertion and deletion
operations of the Queue data structure.
Note: Ask the user input in the Queue(Books) function itself.

Ans. def Push(Books):


bno = int(input(“Enter Book Number : ”))
title = input(“Enter Book Title: ”)
elem = [bno, title]
Books.append(elem)

def Pop(Books):
if Books==[]:
print(“Undeflow! Stack is empty”)
else:
elem = Books.pop()
print(“Popped Book : ”, elem)

(½ mark for Push() header)


( ½ mark for accepting user inputs)
( ½ mark for adding element in stack)
( ½ mark for Pop() header)
( ½ mark for checking underflow condition)
( ½ mark for displaying “Stack empty”)
( ½ mark for deleting element from stack)
( ½ mark for displaying the deleted element)
OR
def Queue(Tickets):
tid = int(input(“Enter Ticket ID : ”))
name = input(“Enter Name: ”)
elem = [tid, name]
Books.append(elem)

def DeQueue(Tickets):
if Tickets==[]:
print(“Undeflow! Queue is empty”)
else:
elem = Tickets.pop(0)
print(“Popped Ticket : ”, elem)

(½ mark for Queue() header)


( ½ mark for accepting user inputs)
( ½ mark for adding element in Queue)
( ½ mark for DeQueue() header)
( ½ mark for checking underflow condition)
( ½ mark for displaying “Queue empty”)
( ½ mark for deleting element from Queue)
( ½ mark for displaying the deleted element)

SECTION – B
(COMPUTER NETWORKS)
Q3 (a) In Amplitude Modulation, _________ of the carrier wave is changed as per 1
_________ of the modulating signal.
Ans. amplitude, amplitude
(1 Mark for correct answer)
(b) The term ‘Internet of things’ means: 1
(i) The intelligent connection of people, things and data over Internet
(ii) Things (Smart Devices) taking control of the Internet and the World
(iii) Both of these
Ans. (i) The intelligent connection of people, things and data over Internet
(1 Mark for correct answer)
(c) What is the main difference between a hub and a switch? 1

Ans. Hub broadcasts to all devices whereas switch sends to the designated
recipients only. (Switch is intelligent device.)
(1 Mark for correct answer)
(d) A network in which nodes can act as both servers sharing resources and 1
clients using the resources is called _____ to _____ network.
Ans. Peer to Peer
(1 Mark for correct answer)
(e) Expand the following abbreviations related to Computer Networks: 2
(i) URL (ii) LTE (iii) GSM (iii) MAC
Ans. (i) Uniform Recourse Locator
(ii) Long Term Evolution
(iii) Global System for Mobile or Groupe Spécial Mobile
(iv) Media Access Control
( ½ Mark for each correct expansion)
(f) What do you mean by collision in wireless networks? Name a technique 2
which is used to avoid collision in wireless networks.
Ans. Collision: If two or more nodes try to occupy a communication channel at
the same time for transmitting data. In wireless networks we cannot detect a
collision and for error free transmissions we have to avoid collisions.
CSMA (Carrier Sense Multiple Access) is a technique which can be used to
avoid collision in wireless networks.

(1 Mark for any correct definition of collision)


( 1 Mark for the name of technique which can be used to avoid collision
in wireless networks)
(g) Answer the following: 3
(i) 158.65.24.27 is an example of ________ and 68:35:c8:fe:a9:25 is an
example of _________.
(ii) ___________ command/utility can be used to view the number of hops
and response time to get to a remote server or website.
(iii) __________ command/utility can be used to find your default DNS
server and to determine if your DNS server can resolve a given domain
name.
Ans. (i) IP Address and MAC Address
(ii) tracert/traceroute
(iii) nslookup

(1 Mark for each correct answer)


(h) An International Bank has to set up its new data center in India. It has five 4
blocks of buildings – A, B, C, D and E.
Distance Between Blocks No. of Computers
Block A to Block B 50m Block A 55
Block B to Block C 30m Block B 180
Block C to Block D 30m Block C 60
Block D to Block E 35m Block D 55
Block E to Block C 40m Block E 70
Block D to Block A 120m
Block D to Block B 45m
Block E to Block B 65m

(i) Suggest a cable layout of connection between the blocks (Diagram).


(ii) Suggest the most suitable block to install the server along with the
reason.
(iii) Where would you place following devices? Answer with justification.
1) Repeater 2) Hub/Switch
(iv) The Bank wants to link its head office in A building to its office in
Sydney.
(1) Which type of transmission medium is appropriate for such a link?
(2) What type of network is formed with this connection?
Ans. (i)

Block A Block C

Block B Block D

Block E

(1 Mark for above (or any other correct) layout)


(ii) The most suitable place / block to house the server of this organisation
would be Block C, as this block contains the maximum number of
computers. Placing the server in Block C will reduce the external traffic.
( ½ mark for mentioning the correct block)
( ½ mark for reason)

(iii) Repeater is to be placed between buildings where the distance is quite


large (in layout diagram) and Hub is to placed inside every block for
internal connectivity among computers.
(Placement of Hubs and Repeaters can be shown in layout diagram.)

( ½ mark for showing correct placement of Repeaters)


( ½ mark for showing correct placement of Hubs)

(iv) 1) Satellite Communication 2) Wide Area Network (WAN)


( ½ Mark for each correct answer)

SECTION – C
(DATA MANAGEMENT)
Q4 (a) Which data type of MySQL doesn’t use same number of bytes as defined in 1
table structure and the consumption of bytes depends upon user data?
Ans. VARCHAR
(1 Mark for correct answer)
(b) Write a query in MySQL to change the data type of the column named 1
‘price’ from int to decimal. The table name is ‘Products’.
Ans. ALTER TABLE Products MODIFY price DECIMAL;
(1 Mark for correct answer)
(c) Give any two examples of MySQL aggregate functions. How many rows are 1
returned as result when an aggregate function is used on a table without a
group by clause?
Ans. Examples of aggregate functions: SUM, AVG, COUNT, MAX, MIN
No. of rows returned: 1 Row
( ½ mark for any 2 correct examples)
( ½ mark for correct answer on number of rows returned)

(d) Which of the following strings will match the pattern “_a%singh%a_’ 1
(i) paras singh raj
(ii) parasingha
(iii) Paaras Singh harraj
(iv) passinggha raj
Ans. (i) and (iii)
(1 Mark for correct answer)
(e) Classify the following as DDL or DML commands: 2
(i) INSERT (ii) DELETE (iii) DROP (iv) UPDATE
OR
What is the difference between HAVING and WHERE clause? If both of
clauses are there in a query, then which one is executed first?

Ans. (i) DML (ii) DML (iii) DDL (iv) DML

( ½ Mark for each correct answer)


OR
WHERE is applied on the complete table, whereas HAVING is applied on a
particular group of rows.
If both WHERE and HAVING are present in a query, WHERE is executed
first.

(1 Mark for difference)


(1 Mark for identifying which one is execute first)
(f) Which of the following files is used to interact with a Django project? 2
(i) manage.py (ii) init.py (iii) settings.py (iv) urls.py
Also, write the command that can be used to run the Django server for a
project.
Ans. (i) manage.py
Command to run Django server: python manage.py runserver
(1 Mark for selecting correct option)
(1 Mark for correct command)
(g) Write the output for SQL queries (i) to (iii) based on the following table. 3
Table: EMPLOYEE
EmpId Name DoJ Gender City Salary
101 Leonard 1995-06-06 M London 9500
102 Priya 1993-05-07 F Delhi 4500
103 Howard 1994-05-06 M Paris 8500
104 Penny 1995-08-08 F London 11000
105 Raj 1995-10-08 M London 10000
106 Amy 1994-12-12 F Paris 8500
107 Bernadette 1995-12-08 F Lyon 8000
108 Sheldon 1995-06-12 M Seattle 15000

(i) SELECT COUNT(*), City FROM EMPLOYEE GROUP BY City


HAVING COUNT(*) > 1;
(ii) SELECT City, SUM(Salary) FROM EMPLOYEE GROUP BY City;
(iii) SELECT MIN(DoJ) FROM EMPLOYEE WHERE GENDER = ‘M’;
Ans. (i)
COUNT(*) City
3 London
2 Paris

(ii)
City SUM(Salary)
London 30500
Delhi 4500
Paris 17000
Lyon 12000
Seattle 8500

(iii)
MIN(DoJ)
1994-05-06

(1 Mark for each correct output)


(h) Based on the Table EMPLOYEE given in question 4(g), write SQL queries 4
for following:
(i) To display the average salary for each city, arranged in alphabetic order
of city name.
(ii) To display sum of salary for each gender.
(iii) To increase the salary of all Male employees of London and Paris by
1500.
(iv) To display the average salary of all the employees who joined before
January 1st, 1995.

Ans. (i) SELECT City, AVG(Salary) from EMPLOYEE group by city ORDER
BY city;
(ii) SELECT Gender, SUM(Salary) from EMPLOYEE GROUP BY Gender;
(iii) UPDATE EMPLOYEE SET Salary= Salry+1500 WHERE Gender=’M’
and City IN (“London”, “Paris”);
(iv) SELECT AVG(Salary) FROM EMPLOYEE WHERE DoJ<1995-01-01;
(1 Mark for every correct query)
SECTION – D
(SOCIET, LAW AND ETHICS)
Q5 (a) Which act of Indian constitution relates to cybercrimes? 1

Ans. IT Act 200 or Information Technology Act 2000 (Amendments 2008)


(1 Mark for correct answer)
(b) __________ is a crime where a victim is harassed online on social media 1
posts through mean/degrading comments and posts.
Ans. Cyber Bullying
(1 Mark for correct answer)
(c) Differentiate Between Open Source and Open Data. Give any two examples 2
of open source software.
Ans. Difference between open data and open source is that of data versus
application. Source code refers to the complete source code of the
application. In open data, only data is freely available to all and source code
may or may not be open. Data can be numbers, locations, names, etc.
Examples of Open Source software: Linux kernel, Mysql, Apache, Google
Chrome etc.
(1 Mark for correct difference)
( ½ Mark for each correct example up to two examples)
(d) Which of the following URLs could be pointing to fake websites? 2
(i) https://www.gooogle.com/mail/login/
(ii) https://microsoft.com.securesite.tk/
(iii) Both (i) and (ii)
(iv) None of the above
Also, write the IT term for this type of attack which prompts a user to click
on a fake link.
Ans. (iii) Both (i) and (ii)
Phishing is the term used for this type of attacks.

(1 Mark for identifying the correct option)


(1 Mark for correct name of the attack)
(e) Group the following authentication mechanisms and their examples 2
correctly.
Mechanism Example
i) What you know 1) Biometrics (Fingerprint)
ii) What you have 2) Smart Cards
iii) What you are 3) Passwords
Also, identify the strongest type of authentication among the above-
mentioned mechanisms which will effectively protect you against an identity
theft attack.
Ans. What you know – Passwords
What you have – Smart Cards
What you are – Biometrics (Fingerprint)
Among these three, Biometric Authentication (What you are) is considered
the strongest.
( ½ Mark for each correct grouping)
( ½ Mark for correct identification of strongest authentication)
(f) What are the gender based presumptions and issues while teaching and using 2
computers? What solutions do you suggest to handle such issues?
Ans. Gender Based Issues:
 Preconceived notions – Notions like boys are better at technology
 Lack of interest
 Lack of motivation
 Lack of role models
 Lack of encouragement in class
 Not girl friendly work culture
Suggested Solutions:
 There should be more initiative program for girls to take computer
subject.
 Film and TV censor board should ensure fair representation of
female
role models in TV or cinema
 Good practical education to girls
 More jobs for Girls in IT sector

************

You might also like