0% found this document useful (0 votes)
49 views

XII CS HYD MS PB1

Uploaded by

Rahul
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)
49 views

XII CS HYD MS PB1

Uploaded by

Rahul
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

KENDRIYA VIDYALAYA SANGATHA N HYDERABAD REGION

IST PREBOARD EXAMINATION 2023-24


CLASS: XII MAX.MARKS:70
SUBJECT: COMPUTER SCIENCE (083) DURATION: 3HRS
MARKING SCHEME

S.no Question and answers Distribution


of Marks
SECTION A
1 True 1
1 mark for correct answer
2 c. 99.99 1
1 mark for correct answer
3 b. 5.0 1
1 mark for correct answer
4 d. ['Swatchtha', 'Hi', 'Seva', '@', 'Swatcch', 'Bharat'] 1
1 mark for correct answer
5 a. Equi Join 1
1 mark for correct answer
6 b. peer-to-peer network 1
1 mark for correct answer
7 a. dict_fruit.update(dict_vegetable) 1
1 mark for correct answer
8 c. Statement 4 1
1 mark for correct answer
9 d.Error 1
1 mark for correct answer
10 a. 0,7 1
1 mark for correct answer
11 d. gateway 1
1 mark for correct answer
12 b. 15 1
1 mark for correct answer
13 True 1
1 mark for correct answer
14 c. Primary Key 1
1 mark for correct answer
15 c.PPP 1
1 mark for correct answer
16 a. writeline() 1
1 mark for correct answer
17 a. Both A and R are true and R is the correct explanation 1
for A
1 mark for correct answer
18 c. A is True but R is False 1
1 mark for correct answer
SECTION B
19 a. Expand the following: 1+1=2
i. FTP – File Transfer Protocol
ii. IMAP- Internet Message Access Protocol
½ mark for each correct expansion
b. What is the use of XML
XML (Extensible Markup Language)
1.we can define our own tags and use them
2. Dynamic web development language – as it is used for
transporting and storing data
1 mark for correct explanation

(OR)
a. Write one advantage and one disadvantage of guided
over unguided communication media.
Advantage : By adding more wires, the transmission
capacity can be increased in guided media.
Disadvantage:
It cannot pass through walls and cannot travel long
distance

1 mark for each correct advantage and disadvantage


20 Kunika, a Python programmer, is working on a project in 2
which she wants to write a function to count the number of
even and odd values in the list. She has written the
following code but his code is having errors. Rewrite the
correct code and underline the corrections made.
define EOcount(L):
evensum=oddsum=0
for i in range(0,len(L))
if L[i]%2=0:
evensum+=1
Else:
oddsum+=1
print(evensum, oddsum)

Corrections :

def EOcount(L):
evensum=oddsum=0
for i in range(0,len(L)):
if L[i]%2==0:
evensum+=1
else:
oddsum+=1
print(evensum, oddsum)
½ mark for each correction made
21 Write a function Show_sal(EMP) in python that takes the 2
dictionary, EMP as an argument. Display the salary if it is
less than 25000
Consider the following dictionary
EMP={1:18000,2:25000,3:28000:4:15000}
The output should be:
18000
15000

Solution:
EMP={1:18000,2:25000,3:35000,4:15000}
def Show_Sal(EMP):
for sal in EMP.values():
if sal<25000:
print(sal)
Show_Sal(EMP)

½ mark for
correct function header
½ mark for
correct loop
½ mark for
correct if statement
½ mark for
displaying the output
(OR)
Write a function, VowelWords(Str), that takes a string as an
argument and returns a tuple containing each word which
starts with an vowel from the given string
For example, if the string is "An apple a day keeps the
doctor away”, the tuple will have (“An”,”apple”,”a”, “away”)
Solution:
Str=”An apple a day keeps doctor away”
Tup=( )
def VowelWords(Str):
words=Str.split()
if words[0] in “aeiouAEIOU”:
Tup=Tup+(word,)
return Tup
T=VowelWords(Str)
print(“The Vowel Word Tuple is”, T)

½ mark for correct function header


½ mark for using split()
½ mark for adding to tuple
½ mark for return statement

22 Predict the output of the Python code given below: 2


L=[4,3,6,8,2]
Lst=[]
for i in range(len(L)):
if L[i]%2==0:
t=(L[i],L[i]**2)
Lst.append(t)
print(Lst)
output :
[(4, 16), (6, 36), (8, 64), (2, 4)]
½ mark for each correct value in output
23 Write the Python statement/function for each of the 1+1=2
following tasks using BUILT-IN functions/methods only:
i. To return index position of substring in given
string.
ii. To delete first occurrence of an item in the list
Solution: i-find( )
ii – remove( )
1 mark for each correct answer

(OR)
A list named stu_marks stores marks of students of a
class. Write the Python command to import the required
module and display the average of the marks in the list.
Solution:

import statistics
stu_marks =[45,60,70,85,40]
print(statistics.mean(stu_marks))

1 mark for correct import statement


1 mark for correct command with mean() and print()
24 Ans: ALTER used to change the structure of the 2
database table. This statement can add up additional
column, drop existing, and even change the data type of
columns involved in a database table.

(i) UPDATE used to update existing data within a


table.
o
r
Ans: The difference between WHERE and HAVING
clause is that WHERE condition are applicable on
individual rows whereas HAVING condition are
applicable on groups as formed by GROUP BY clause.
1 mark each for correct explanation of both.
25 Predict the output of the following code: 2
def ChangeVal(M,N):
for i in range(N):
if M[i]%5==0:
M[i]+=5
if M[i]%3==0:
M[i]+=3
L=[5,8,15,12]
ChangeVal(L,4)
for i in L:
print(i,end='$')
output:
10$8$20$15$
2 marks for correct output
SECTION C
26 L1=[10,20,30,40,12,11] 3
n=2
l=len(L1)
for i in range (0,n):
y=L1[0]
for j in range(0,l-1):
L1[j]=L1[j+1]
L1[l-1]=y
print(L1)
output
[30, 40, 12, 11, 10, 20]
½ mark for each correct value in output
27 Consider the table SportsClub given below and write the 1*3=3
output of the SQL queries that follow.
SPORTSCLUB

i. SELECT DISTINCT Sports from SportsClub;


ii. SELECT sports, SUM(salary) FROM SportsClub
GROUP BY sports HAVING SUM(salary)>15000;
iii. SELECT pname, sports, salary FROM SportsClub
WHERE country='INDIA' ORDER BY salary DESC;
i.

sports
SOCCER
TENNIS
CRICKET
ATHLETICS

ii.
sports SUM(salary)
SOCCER 50000
TENNIS 25000
ATHLETICS 20000

iii.
pname sports salary
VIRAT CRICKET 15000
NEERAJ ATHLETIC 12000
S
SANIA TENNIS 5000

1 mark for each correct output


28 Write a function in Python to read a text file, Rhyme.txt 3
and displays those words which have length more than 5
Solution:

def displaywords():
file=open(“Rhyme.txt”,”r”)
lst=file.readlines()
for i in lst:
word=i.split()
for j in word:
if len(j)>5:
print(j)
file.close()
displaywords()

1 mark for correctly opening and closing files


½ mark for correctly reading data
1 mark for correct loop and if statement
½ mark for displaying data
(OR)
Write a function, in Python that counts the number of lines
in text file named “data.txt” and displays the lines which
are starting with “K” or ‘k’.
Solution:
def countlines():
file=open(“data.txt”,”r”)
lines=file.readlines()
count=0
for w in lines:
if w[0]==’K’ or w[0]==’k’:
count+=1
print(w)
print(“Total no of lines starting with K or k are”,count)
file.close()
countlines()

1 mark for correctly opening and closing the files


½ mark for correctly reading data
1 mark for correct loop and if statement
½ mark for displaying the output.
29 Consider the table CHIPS given below: 3

Based on the given table write SQL queries for the


following:
i. Change the Flavour of the chips to “black salt “ for
those chips whose flavour is “SALTY”
ii. Display the Brand_Name ,Flavour and Total
Amount(price*quantity) of those chips whose
Brandname ends with ‘s’. Total Amount column
name should also be displayed.
iii. Delete the records of those chips whose quantity is
less than 10.
Solution:
i. UPDATE CHIPS SET FLAVOUR =”BLACK SALT” WHERE
FLAVOUR=”SALTY”
ii.
SELECT BRAND_NAME,FLAVOUR,PRICE*QUANTITY AS
“TOTAL QUANTITY” WHERE BRAND_NAME LIKE “%S”;
iii. DELETE FROM CHIPS WHERE QUANTITY <10;
1 mark for each correct query
30 Write a function in Python, Push(Cosmetic) where, 3
Cosmetic is a dictionary containing the details of
products– {Pname:price}.
The function should push the names of those products in
the stack whose price is greater than 130.
Also display the count of elements pushed into the stack.
For example:
If the dictionary contains the following data:
Ditem = {“FaceWash”:105, "Facepack":150,
"CleansingMilk":130, "Sunscreen": 180, "FaceMask":115}
The stack should contain
Facepack
Sunscreen
The output should be:
The count of elements in the stack is 2
Solution:
Stackcosmetic=[]
def push(Cosmetic):
count=0
for k in Cosmetic:
if Cosmetic[k]>130:
Stackcosmetic.append(k)
count+=1
print(“The number of elements in the stack”,count)

1/2 mark for correct definition of function


1/2 mark for correct use of for loop
1/2 mark for correct use of if statement
½ mark for pushing elements in to stack
½ mark for calculating no. of elements
½ mark for printing the no. of elements in the stack
SECTION D
31 Consider the following tables BOOKS and ISSUED in a 1*4=4
database named “LIBRARY”.
Write SQL queries for the following:
i. Display bookname , Author name and quantity
issued from table Books and issued.
ii. Display the details of books in the order of qty
whose price is in between 200 to 300
iii. Display total qty of books of type “Computer”
iv. List the tables in the database Library
Solution:
i.
SELECT BNAME,AUNAME,QTY_ISSUED FROM BOOKS,
ISSUED WHERE BOOKS.BID=ISSUED.BID;
ii.
SELECT * FROM BOOKS WHERE PRICE BETWEEN 200
AND 300 ORDER BY QTY;
iii.
SELECT SUM(QTY) FROM BOOKS WHERE
TYPE=”COMPUTER”;
iv.
USE BOOKS;
SHOW TABLES;
1 mark for each correct query
32 Solution: 4
import csv
def ADD():
Emp_Id=int(input(“enter Employee Id”))
Emp_Name=input(“Enter employee name”)
Mobile= input(“Enter Mobile number”)
Salary=float(input(“Enter Salary”))
Headings=[“Employee ID”,”Employee Name”,”Mobile
Number”,”Salary”]
Data=[Emp_Id,Emp_Name,Mobile,Salary]
F=open(“record.csv”,’a’,newline=’’)
csvwriter=csv.writer(F)
csvwriter.writerow(Headings)
csvwriter.writerow(Data)
F.close()
½ mark for accepting data correctly
½ mark for opening and closing file
½ mark for writing headings
½ mark for writing row

countrec=0
def COUNTR():
f=open(“record.csv”,’r’)
data=csv.reader(f)
d=list(data)
print(“ the no. of records in a file”,len(d))
f.close()

½ mark for
opening and closing file
½ mark for
reader object
½ mark for
calculating length
½ mark for
returning or printing no. of records
SECTION E
33 A company SUN Enterprises has four blocks of buildings as 1*5=5
shown:
i. Star/Bus topology
ii. repeaters are required as the distance between B3-B2
and B3-B4 is exceeding 100M
iii. Switch/Hub
iv. Any unguided media suitable for hilly areas
v. B1 block as it has more number of computers

1 mark for each correct answer

34 i. Differentiate between r and w file modes in python 2+3=5


ii. Consider a binary file “book.dat” that has structure
[BookNo, Book_Name, Author, Price].

Write a user defined function CreateFile() that


takes input data for a record and add to book.dat
Solution:
i. r mode:
opens the file in read mode and file pointer is place at
the beginning
of the file. If file does not exist returns error.
w mode:
Opens the file in write mode and file pointer is placed at
the
beginning of the file. If the file does not exist it creates a
new file and
if file exists it overwrites the file

1 mark for each correct difference


( minimum two differences should be given)

ii. To create File


import pickle
def CreateFile():
data=[]
f=open(“book.dat”,”ab”)
ans=’y’
try:
while ans==’y’:
BookNo=int(input(“Enter Book Number”)
Book_Name=input(“Enter Book Name”)
Author=input(“Enter Author name”)
Price=float(input(“Enter price for the book”))
Data=[BookNo,Book_Name,Author,Price]
pickle.dump(data,f)
ans=input(“want to append more records? y/n…”)
except EOFError:
f.close()

½ mark each for correctly opening and closing files


1 mark for correct usage of loop
1 mark for dumping records correctly
OR
i. How are CSV files different from Binary Files
Csv file:
CSV (Comma Separated Values) is a file format for data
storage which looks like a text file.The information is
organized with one record on each line and each field is
separated by comma.
Binary file:
A binary file stores the data in the same way as as stored
in the memory. The .exe files, mp3 file, image files, word
documents are some of theexamples of binary files. We
can’t read a binary file using a text editor.

1 mark for each correct difference


( minimum two differences should be given)

ii. Consider a binary file “MyFile.dat” that has following


structure [ empid, ename and salary].
The file contains 15 records.
Write a userdefined function to search for
records
based on the salary entered by the user and
if the the salary is more than 25000 then display
the record.
Solution:
import pickle
def search():
emp={}
found=False
f=open(MyFile.dat”,”rb”)
try:
while True:
emp=pickle.load(f)
if emp[‘salary’]>25000:
print(emp)
found=True
except EOFerror:
if found==False:
print(“no such records found in the file”)
else:
print(“Search successfully”)
f.close()
½ mark each for correctly opening and closing files
1 mark for correct usage of loop
1 mark for correct use of if and printing records correctly

35 i. Define the term Degree with respect to RDBMS. Give (1+4)=5


one example to support your answer
Degree is defined as no. of attributes in a relation.
½ mark for correct explanation and ½ mark for correct
example
ii.
import mysql.connector as s
con=s.connect(host="localhost",user="root",passwd="12345
",database="warehouse")
mycursor=con.cursor()
Inv_No=int(input(“Enter Inventory no”))
Inv_Name=input(“Enter inventory Name”)
Inv_Entry=input(“Enter inventory entry date”)
Inv_price =float(input(“Enter price”))
i="insert into inventory values ( {},’{}’,’{}’,{})”.format(Inv_No,
Inv_name, Inv_Entry, Inv_price)
mycursor.execute(i)
con.commit()
print(“data added successfully”)
con.close()
print("Thank you")
½ mark for importing correct module
1 mark for correct connect()
½ mark for correctly accepting the input
1 ½ mark for correctlyexecuting the query
½ mark for correctly using commit()
(OR)
i. Give one difference between Primary key and candidate
key.
Primary key is used to uniquely identify a tuple in a
relation
Candidate key is a column which have capability to
become a primary key
1 mark for correct difference
ii.
Solution:
import mysql.connector as s
con=s.connect(host="localhost",user="root",passwd="12345
",database="warehouse")
mycursor=con.cursor()
query=”delete from inventory where Inv_Price>1000;”
mycursor.execute(query)
con.commit()
con.close()
½ mark for importing correct module
1 mark for correct connect()
1 ½ mark for correctlyexecuting the query
½ mark for correctly using commit()
½ for closing the connection

You might also like