0% found this document useful (0 votes)
30 views12 pages

Board Question

Important question use

Uploaded by

akmumthaa2007
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)
30 views12 pages

Board Question

Important question use

Uploaded by

akmumthaa2007
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/ 12

MARKING SCHEME

KVS – GURUGRAM REGION


Class: XII - Computer Science (083) Session: 2020-21

Pre-Board Question Paper (Theory)


ime : 3 Hrs MM:70
Part A Section I
Select the most appropriate option out of the options given for each question. Attempt any 15
questions from question no 1 to 21.
1 Find the valid identifier from the following 1
a) My-Name b) True c) 2ndName d) S_name
Ans s) S_name
2 Given the lists L=[1,3,6,82,5,7,11,92] , 1
What will be the output of
print(L[2:5])
Ans [6,82,5]
3 Write the full form of IDLE. 1
Ans Integrated Development Learning Environment
4 Identify the valid logical operator in Python from the following. 1
a) ? b) < c) ** d) and
Ans d) and
5 Suppose a tuple Tup is declared as Tup = (12, 15, 63, 80), 1
which of the following is incorrect?
a) print(Tup[1])
b) Tup[2] = 90
c) print(min(Tup))
d) print(len(Tup))
Ans b) Tup[2]=90
6 Write a statement in Python to declare a dictionary whose keys are 1,2,3 and values are Apple, Mango 1
and Banana respectively.
Ans Dict={1:’Apple’, 2: ’Mango’,3 : ‘Banana’}
7 A tuple is declared as T = (2,5,6,9,8) 1
What will be the value of sum(T)?
Ans 30
8 Name the built-in mathematical function / method that is used to return square root of a number. 1
Ans sqrt()
9 Protocol is used to send email ……………………………… 1
Ans SMTP
10 Your friend Sunita complaints that somebody has created a fake profile on Twitter and defaming her 1
character with abusive comments and pictures. Identify the type of cybercrime for these situations.
Ans Identity Theft
11 In SQL, name the command/clause that is used to display the rows in descending order of a column. 1
Ans Order By …… Desc
12 In SQL, what is the error in following query : 1
SELECT NAME,SAL,DESIGNATION WHERE DISCOUNT=NULL;
Ans SELECT NAME,SAL,DESIGNATION WHERE DISCOUNT IS NULL;
13 Write any two aggregate functions used in SQL. 1
Ans max(),min(),avg(),count()
14 Which of the following is a DML command? 1
a) SELECT b) Update c) INSERT d) All of these
Ans d) All of these
15 Name the transmission media best suitable for connecting to desert areas. 1
Ans Microwave
16 Identify the valid declaration of P: 1
P= [‘Jan’, 31, ‘Feb’, 28]
a. dictionary b. string c.tuple d. list
Ans d) list
17 If the following code is executed, what will be the output of the following code? 1
str="KendriyaVidyalayaSangathan"
print(str[8:16])
Ans Vidyalay
18 In SQL, write the query to display the list of databases. 1
Ans SHOW DATABASES;
19 Write the expanded form of VPN. 1
Ans Virtual Private Network
20 Which of the following will suppress the entry of duplicate value in a column? 1
a) Unique b) Distinct c) Primary Key d) NOT NULL
Ans b) Distinct
21 Rearrange the following terms in increasing order of speedy medium of data transfer. 1
Telephone line, Fiber Optics, Coaxial Cable, Twisted Paired Cable
Ans Telephone line, Twisted Pair Cable, Coaxial Cable, Fiber Optics
Part A Section II
Both the Case study based questions are compulsory. Attempt any 4 sub parts from each question.
Each question carries 1 mark
22 Modern Public School is maintaining fees records of students. The database administrator Aman decided 1x4
that- =4
● Name of the database -School
● Name of the table – Fees
● The attributes of Fees are as follows:

Rollno - numeric
Name – character of size 20
Class - character of size 20
Fees – Numeric
Qtr – Numeric
Answer any four from the following questions:
(i) Identify the attribute best suitable to be declared as a primary key
(ii) Write the degree of the table.
(iii) Insert the following data into the attributes Rollno, Name, Class, Fees and Qtr in fees table.
(iv) Aman want to remove the table Fees table from the database School.
Which command will he use from the following:
a) DELETE FROM Fees;
b) DROP TABLE Fees;
c)DROP DATABASE Fees;
d) DELETE Fees FROM Fees;
(v) Now Aman wants to display the structure of the table Fees, i.e, name of the attributes and their
respective data types that he has used in the table. Write the query to display the same.
Ans i)Primary Key – Rollno
ii)Degree of table= 5
iii)Insert into fees values(101,’Aman’,’XII’,5000);
iv)DELETE FROM Fees
v)Describe Fees
23 Anis of class 12 is writing a program to create a CSV file “mydata.csv” which will contain user name and 1x4
password for some entries. He has written the following code. As a programmer, help him to successfully =4
execute the given task.

import _____________ # Line 1


def addCsvFile(UserName,PassWord): # to write / add data into the CSV file
f=open(' mydata.csv','________') # Line 2
newFileWriter = csv.writer(f)
newFileWriter.writerow([UserName,PassWord])
f.close() #csv file reading code
def readCsvFile(): # to read data from CSV file
with open('mydata.csv','r') as newFile:
newFileReader = csv._________(newFile) # Line 3
for row in newFileReader:
print (row[0],row[1])
newFile.______________ # Line 4
addCsvFile(“Aman”,”123@456”)
addCsvFile(“Anis”,”aru@nima”)
addCsvFile(“Raju”,”myname@FRD”)
readCsvFile() #Line 5

(a) Give Name of the module he should import in Line 1.


(b) In which mode, Aman should open the file to add data into the file
(c) Fill in the blank in Line 3 to read the data from a csv file.
(d) Fill in the blank in Line 4 to close the file.
(e) Write the output he will obtain while executing Line 5.

Ans (a) Line 1 : csv


(b) Line 2 : a
(c) Line 3 : reader
(d) Line 4 : close()
(e) Line 5 : Aman 123@456
Anis aru@nima
Raju myname@FRD
Part B Section I
24 Evaluate the following expressions: 2
a) 8 * 3 + 2**3 // 9 – 4
b) 12 > 15 and 8 > 12 or not 19 > 4
Ans a) 25
b) False
25 Differentiate between Viruses and Trojans in context of networking and data communication threats. 2
OR
Differentiate between Website and webpage. Write any two popular example of online shopping.
Ans Virus:
Virus is a computer program or software that connect itself to another software or computer program to
harm computer system. When the computer program runs attached with virus it perform some action
such as deleting a file from the computer system. Virus can’t be controlled by remote.
Trojan Horse:
Trojan Horse does not replicate itself like virus and worms. It is a hidden piece of code which steal the
important information of user. For example, Trojan horse software observe the e-mail ID and password
while entering in web browser for logging.

OR

Web Page is a document or a page where there is information. We can see those pages in the browser.
Web Page is a single page with information. It can be in any form like texts, images or videos.
Whereas the Website is a collection of webpages. The website has its own domain name which is unique
throughout the world. Anything can be stored on a website like photos, videos, texts etc .
Popular example of online shopping : Amazon,Flipcart etc
26 Expand the following terms: 2
a. HTTP b. FLOSS c. PAN d. IRC
Ans HTTP – Hyper Text Transfer Protocol
FLOSS- Free Libre Open Source Software
PAN- Personal Area Network
IRC- Internet Relay Chat

27 Differentiate between call by value and call by reference with a suitable example for each. 2
OR
Explain the use of return key word used in a function with the help of a suitable example.
Ans In the event that you pass arguments like whole numbers, strings or tuples to a function, the passing is
like call-by-value because you can not change the value of the immutable objects being passed to the
function. Whereas passing mutable objects can be considered as call by reference because when their
values are changed inside the function, then it will also be reflected outside the function.

OR

The return statement is used to return a value of function to its calling program.
Example:
def mysum(a,b):
return a+b
print(mysum(10,20))

Output: 30
28 Rewrite the following code in Python after removing all syntax error(s). Underline each correction done 2
in the code.
p=30
for c in range(0,p)
If c%4==0:
print (c*4)
Elseif c%5==0:
print (c+3)
else
print(c+10)
Ans p=30
for c in range(0,p):
if c%4==0:
print (c*4)
elif c%5==0:
print (c+3)
else:
print(c+10)
29 What possible outputs(s) are expected to be displayed on screen at the time of execution of the program 2
from the following code? Also specify the maximum values that can be assigned to each of the variables
Lower and Upper.
import random
AR=[20,30,40,50,60,70];
Lower =random.randint(1,4)
Upper =random.randint(2,5)
for K in range(Lower, Upper +1):
print (AR[K],end=”#“)

(i) 40# (ii) 40#50#60# (iii) 50# (iv) All


Ans All of these

30 What do you understand by Foreign Key in a table? Give a suitable example of Foreign Key from a table 2
containing some meaningful data.
Ans A Foreign Key creates a link between tables. It references the primary key in another table and links it.
For example, the DeptID in the Employee table is a foreign key –
31 Differentiate between fetchone() and fetchall() methods with suitable examples for each. 2
Ans fetchall() fetches all the rows of a query result. An empty list is returned if there is no record to fetch the
cursor. fetchone() method returns one row or a single record at a time. It will return None if no more
rows / records are available. Any example.
32 Categorize the following as DML and DDL Commands: 2
SELECT, INSERT, CREATE, UPDATE, ALTER, DELETE, DROP
Ans DDL – Create, Alter, Drop
DML- Select, Insert, Update, Delete
33 Find and write the output of the following Python code: 2
def Show(str):
m=""
for i in range(0,len(str)):
if(str[i].isupper()):
m=m+str[i].lower()
elif str[i].islower():
m=m+str[i].upper()
else:
if i%2==0:
m=m+str[i-1]
else:
m=m+"#"
print(m)
Show('HappyBirthday')
Ans hAPPYbIRTHDAY

Part B (Section II)


34 Write a function LMove(Lst,n) in Python, which accepts a list Lst of numbers and n is a numeric value by 3
which all elements of the list are shifted to left.
Sample Input Data of the list
Lst= [ 10,20,30,40,12,11], n=2
Output Lst = [30,40,12,11,10,20]
Ans def LMove(Lst,n):
L=len(Lst)
for x in range(0,n):
y=Lst[0]
for i in range(0,L-1):
Lst[i]=Lst[i+1]
Lst[L-1]=y
print(Lst)
#Note : Using of any correct code giving the same result is also accepted.
35 Write a function in Python that counts the number of “Me” or “My” words present in a text file 3
“STORY.TXT”. If the “STORY.TXT” contents are as follows:
My first book was Me and My Family.
It gave me chance to be Known to the world.

The output of the function should be: Count of Me/My in file: 4

OR

Write a function AMCount() in Python, which should read each character of a text file STORY.TXT, should
count and display the occurrences of alphabets A and M (including small cases a and m too).
Example: If the file content is as follows:
Updated information As simplified by official websites.

The AMCount() function should display the output as: A or a: 4 M or m :2


Ans def displayMeMy():
num=0
f=open("story.txt","rt")
N=f.read()
M=N.split()
for x in M:
if x=="Me" or x== "My":
print(x)
num=num+1
f.close()
print("Count of Me/My in file:",num)

OR

def AMCount():
f=open("story.txt","r")
A,M=0,0
r=f.read()
for x in r:
if x[0]=="A" or x[0]=="a" :
A=A+1

elif x[0]=="M" or x[0]=="m":


M=M+1
f.close()
print("A or a: ",A)
print("M or m: ",M)

36 Consider the table TEACHER given below. Write commands in SQL for (i) to (iii) 3
TEACHER
ID Name Department Hiredate Category Gender Salary
1 Taniya SocialStudies 03/17/1994 TGT F 25000
2 Abhishek Art 02/12/1990 PRT M 20000
3 Sanjana English 05/16/1980 PGT F 30000
4 Vishwajeet English 10/16/1989 TGT M 25000
5 Aman Hindi 08/1/1990 PRT F 22000
6 Pritam Math 03/17/1980 PRT F 21000
7 RajKumar Science 09/2/1994 TGT M 27000
8 Sital Math 11/17/1980 TGT F 24500
i. To display all information about teachers of Female PGT Teachers.
ii. To list names, departments and date of hiring of all the teachers in descending order of date
of joining.
iii. To count the number of teachers and sum of their salary department wise.
Ans i) SELECT * FROM TEACHER WHERE CATEGORY= ‘PGT’ AND GENDER= ‘F’;
ii) SELECT NAME, DEPARTMENT, HIREDATE FROM TEACHER ORDER BY HIREDATE DESC;
iii) SELECT DEPARTMENT, COUNT(NAME), SUM(SALARY) FROM TEACHER GROUP BY DEPARTMENT;
37 Write a function in Python PUSH(Arr), where Arr is a list of numbers. From this list push all numbers 3
divisible by 5 into a stack implemented by using a list. Display the stack if it has at least one element,
otherwise display appropriate error message. OR Write a function in Python POP(Arr), where Arr is a
stack implemented by a list of numbers. The function returns the value deleted from the stack.
Ans def PUSH(Arr,value):
s=[]
for x in range(0,len(Arr)):
if Arr[x]%5==0:
s.append(Arr[x])
if len(s)==0:
print("Empty Stack")
else:
print(s)
OR
def popStack(st) : # If stack is empty
if len(st)==0:
print("Underflow")
else:
L = len(st)
val=st[L-1]
print(val)
st.pop(L-1)
Part B Section III
38 Rehaana Medicos Center has set up its new center in Dubai. It has four buildings as shown in the 5
diagram given below:
Acco Rese
unts arch

Store Pack
aging

Distance between various building are as follows:

Accounts to research Lab 55m


Accounts to store 150m
Store to packaging unit 160m
Packaging unit to research lab 60m
Accounts to packaging unit 125m
Store to research lab 180m

Number of Computers
Accounts 25
Research Lab 100
Store 15
Packaging Unit 60
As a network expert, provide the best possible answer for the following queries:
i) Suggest a cable layout of connections between the buildings.
ii) Suggest the most suitable place (i.e. buildings) to house the server of this organization.
iii) Suggest the placement of the following device with justification:
a) Repeater b) Hub/Switch
iv) Suggest a system (hardware/software) to prevent unauthorized access to or from the network.
v) Which cable is best suited for above layout.
Ans i) Layout-

Account Researc
s h

Store Packagin
g
ii)The most suitable place/ building to house the server of this organization would be building
Research Lab, as this building contains the maximum number of computers.
(iii)
a) For layout1, since the cabling distance between Accounts to Store is quite large, so a repeater
would ideally be needed along their path to avoid loss of signals during the course of data flow in
this route. For layout2, since the cabling distance between Store to Research Lab is quite large,
so a repeater would ideally be placed.
b) In both the layouts, a Hub/Switch each would be needed in all the buildings to interconnect the
group of cables from the different computers in each building.
(iv) Firewall
(v) Twisted Pair cable / Ethernet cable

39 Write SQL commands for the queries (i) to (iii) and output for (iv) & (v) based 5
on a table COMPANY and CUSTOMER .

COMPANY
CID NAME CITY PRODUCTNAME
111 SONY DELHI TV
222 NOKIA MUMBAI MOBILE
333 ONIDA DELHI TV
444 SONY MUMBAI MOBILE
555 BLACKBERRY MADRAS MOBILE
666 DELL DELHI LAPTOP

CUSTOMER
CUSTID NAME PRICE QTY CID
101 Rohan Sharma 70000 20 222
102 Deepak Kumar 50000 10 666
103 Mohan Kumar 30000 5 111
104 Sahil Bansal 35000 3 333
105 Neha Soni 25000 7 444
106 Sonal Aggarwal 20000 5 333
107 Arjun Singh 50000 15 666

(i) To display those company name which are having price less than 30000.
(ii) To display the name of the companies in reverse alphabetical order.
(iii) To increase the price by 1000 for those customer whose name starts with ‘S’
(iv) SELECT PRODUCTNAME,CITY, PRICE FROM COMPANY,CUSTOMER
WHERE COMPANY.CID=CUSTOMER.CID AND PRODUCTNAME=”MOBILE”;
(v) SELECT AVG(QTY) FROM CUSTOMER WHERE NAME LIKE “%r%;

Ans i) SELECT COMPANY.NAME FROM COMPANY,CUSTOMER


WHERECOMPANY.CID = CUSTOMER.CID AND CUSTOMER.PRICE <30000;
ii) SELECT NAME FROM COMPANY ORDER BY NAME DESC;
iii) UPADE CUSTOMER
SET PRICE = PRICE+1000
WHERE NAME LIKE ‘S%’;
iv)
PRODUCTNAME CITY PRICE
MOBILE MUMBAI 70000
MOBILE MUMBAI 25000

v) 12

40 A binary file “Book.dat” has structure [BookNo, Book_Name, Author, Price]. 5


i. Write a user defined function CreateFile() to input data for a record and add to Book.dat .
ii. Write a function CountRec(Author) in Python which accepts the Author name as parameter and count
and return number of books by the given Author are stored in the binary file “Book.dat”

OR

A binary file “STUDENT.DAT” has structure (admission_number, Name, Percentage). Write a function
countrec() in Python that would read contents of the file “STUDENT.DAT” and display the details of those
students whose percentage is above 75. Also display number of students scoring above 75%
Ans import pickle
def createFile():
fobj=open("Book.dat","ab")
BookNo=int(input("Book Number : "))
Book_name=input("Name :")
Author = input("Author:" )
Price = int(input("Price : "))
rec=[BookNo,Book_Name,Author,Price]
pickle.dump(rec,fobj)
fobj.close()

def CountRec(Author):
fobj=open("Book.dat","rb")
num = 0
try:
while True:
rec=pickle.load(fobj)
if Author==rec[2]:
num = num + 1
except:
fobj.close()
return num

OR

import pickle
def CountRec():
fobj=open("STUDENT.DAT","rb")
num = 0
try:
while True:
rec=pickle.load(fobj)
if rec[2] > 75:
print(rec[0],rec[1],rec[2],sep="\t")
num = num + 1
except:
fobj.close()
return num

You might also like