0% found this document useful (0 votes)
27 views16 pages

Home Assignment

Uploaded by

Prachi
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)
27 views16 pages

Home Assignment

Uploaded by

Prachi
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/ 16

CLASS XII SAMPLE PAPER-2 2022-23

Subject: COMPUTER SCIENCE (083)


Time Allotted: 3 HRS Max Marks: 70
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.
QNo. Section-A Mark
s
1 Find the invalid identifier from the following 1
a) sub%marks b)age c)_subname_ d)subject1
2 Given the list L=[“A”, “E”, “I”, “O”, “U”] , write the output of print(L[2:5]) 1
3 Which module is required to work with CSV files in Python? 1
4 Identify the invalid logical operator in Python from the following. 1
a) and b) or c) by d) not
5 Suppose a tuple K is declared as K = (100, 102, 143, 309), which of the 1
following is incorrect?
a)print(K[-1])
b) K[3] =405
c) print(min(K))
d) print(max(K))

6 Write a statement in Python to declare a dictionary whose keys areSub1, 1


Sub2, Sub3 and values are Physics, Chemistry, Math
respectively.

7 A List is declared as 1

List1=[2,3,5,7,9,11,13]
What will be the value of len(List1)
8 Name the built-in mathematical function / method that is used to 1
return the smallest integer less than or equal to N.
9 Name the protocol that is used to transfer files. 1

10 Ms. Priya is an IT expert. She recently used her skills to access the Admin 1
password for the network server of Happiest Minds Technology Ltd.
and provided confidential data of the organization to its CEO, informing
him about the vulnerability of their network security. Out of the
following options which one most appropriately defines Ms. Priya?
a) Cracker b) Operator c) Hacker d) Network Admin

11 In SQL, name the clause that is used to sort the records in 1


ascending/descending order of an attribute.
12 In SQL, what is the use of IS NOT NULL operator? 1
13 Name the aggregate function to find the average value in SQL. 1
14 Which of the following is not a DDL command? 1
a) UPDATE b)ALTER TABLE c)CREATE TABLE d)DROP TABLE
15 Name the transmission media best suitable for difficult terrain like hilly 1
areas.
16 Identify the data type of INFO: 1
INFO = ['hello',203,'9',[5,6]]
a. Dictionary b. String c. Tuple d. List
17 Assertion (A):- If the arguments in function call statement match 1
the number and order of arguments as defined in the function
definition, such arguments are called positional arguments.

Reasoning (R):- During a function call, the argument list first contains
default argument(s) followed by positional argument(s).
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

18 Assertion (A):- If the arguments in function call statement match the 1


number and order of arguments as defined in the function definition,
such arguments are called positional arguments.

Reasoning (R):- During a function call, the argument list first contains
default argument(s) followed by positional argument(s).
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
SECTION-B
19 Evaluate the following expressions: 2
a) 16 // 3 + 3 ** 3 + 15 / 4 - 9
b) x>y or y<z and not x!=z If x, y, z=25, 16, 9

20 Differentiate between WiFi and WiMax in context of wireless 2


communication technologies.
OR
Differentiate between Domain name and URL. Illustrate with the help of
suitable example.

21 Expand the following terms: 2


a. GPRS b. GSM c. WLL d. PPP

22 Differentiate between positional parameters and default parameters 2


with suitable example program for each.
OR
How can a function return multiple values? Illustrate with an
example program.

23 Rewrite the following code in Python after removing all syntax error(s). 2
Underline each correction done in the code.

for Name in [Aakash, Sathya, Tarushi]


IF Name[0]= 'S':
print(Name)

24 What are the incorrect output(s) from the given options when the following 2
code is executed? Also specify the minimum and maximum values that can
be assigned to the variable VALUE.

import random
VALUE = random.randint (0,3)
SUBJECT=[“PHY”,”CHEM”,”MATHS”,”COMP”];
for I in SUBJECT:
for J in range(1, VALUE):
print(I, end=””)
print()
Options:

i) PHYPHY ii) PHY


CHEMCHEM PHYCHEM
MATHSMATHS PHYCHEMMATHS
COMPCOMP
iii) PHY iv) PHY
CHEMCHEM CHEM
COMPCOMPCOMP MATHS
COMP

25 What do you understand by Alternate Keys in a table? Give a suitable 2


example of Alternate Keys from a table containing some meaningful data.

Section- C
26 Write a function Interchange (num) in Python, which accepts a list num of 3
integers, and interchange the adjacent elements of the list and print the
modified list as shown below: (Number of elements in the list is assumed as
even)

Original List:
num = [5,7,9,11,13,15]
After Rearrangement
num = [7,5,11,9,15,13]
27 Write a function in Python that displays the words, starting with uppercase 3
letter in a file ‘legend.txt’.
Example: If the “legend.txt” contents are as follows:
Diego Maradona, Argentinian soccer legend and celebrated Hand of God
scorer dies at 60.
The output of the function should be:
Diego
Maradona,
Argentinian
Hand
God
OR
Write a function countdigits() in Python, which should read each character
of a text file “marks.txt”, count the number of digits and display the file
content and the number of digits.
Example: If the “marks.txt” contents are as follows:
Harikaran:40,Atheeswaran:35,Dahrshini:30,Jahnavi:48
The output of the function should be:
Harikaran:40,Atheeswaran:35,Dahrshini:30,Jahnavi:48
('Total number of digits in the file:', 8)
28 Write the outputs of the SQL queries (i) to (iii) based on the relations Car 3
and Customer given below:
Car
Ccode Cname Make Colour Capacity Charges
201 Triber Renault Yellow 7 1000
203 Altroz Tata Black 5 1500
208 Innova Toyota Silver 8 3000
209 Harrier Tata White 6 2000
212 Duster Renault Red 6 2500
217 Ertiga Suzuki Grey 7 2300

Customer
Custcode Custname Ccode
101 Gopinath 201
102 Ashok 203
103 Harshini 209
104 Vishnu 212

i. Select make, count(*) from Car group by make having count(*)<2;


ii. Select Cname, Make from Car order by charges desc;
iii. Select Custname, Cname from Car R, Customer C where
R.Ccode=C.Ccode:

29 Write a function in Python Push (nums), where nums is a list of numbers. 3


From this list push all odd numbers 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 Popstack (names), where names is a stack
implemented by a list of names. The function returns the name deleted
from the stack.
30 Find and write the output of the following Python code: 3

def Shuffle(str1):
str2=""
for i in range(0,len(str1)-1):
if(str1[i].islower()):
str2=str2+str1[i].upper()
elif str1[i].isupper():
str2=str2+str1[i].lower()
elif str1[i].isdigit():
str2=str2+'d'
else:
str2=str2+(str1[1-i])
print(str2)

Shuffle('Pre-Board Exam@2023')
Section-D
31 Young Minds Ltd. is an educational organization. It is planning to setup its 5
India campus at Chennai with its head office at Delhi. The Chennai campus
has 4
main buildings – ADMIN, ENGINEERING, BUSINESS and MEDIA.
You as a network expert have to suggest the best network related
solutions for
their problems raised in (i) to (v), keeping in mind the distances between
the
buildings and other given parameters.

Shortest distances between various buildings :

ADMIN to ENGINEERING 55 m
ADMIN to BUSINESS 90 m
ADMIN to MEDIA 50 m
ENGINEERING to BUSINESS 55 m
ENGINEERING to MEDIA 50 m
BUSINESS to MEDIA 45 m
DELHI Head Office to CHENNAI 2175 km
Campus
Number of Computers installed at various buildings are as follows :
ADMIN 110
ENGINEERING 75
BUSINESS 40
MEDIA 12
DELHI Head Office 20

(i) Suggest the most appropriate location of the server inside the CHENNAI
campus (out of the 4 buildings), to get the best connectivity for maximum
no. of computers. Justify your answer.
(ii) Suggest the topology and draw the cable layout to efficiently connect
various buildings within the CHENNAI campus.
(iii) Which hardware device will you suggest to be procured by the company
to minimize the transmission loss?
(iv) Which will be the most suitable wireless communication medium to
connect Chennai campus with its Delhi head office?
(v) Which of the following will you suggest to establish the online face-to-
face
communication between the people in the Admin Office of CHENNAI
Campus and DELHI Head Office?
(a) Cable TV
(b) Email
(c) Video Conferencing
(d) Text Chat

32 Write the SQL commands for the following questions (i) to (v) based on the 5
relations Car and Customer given below:

Car
Ccode Cname Make Colour Capacity Charges
201 Triber Renault Yellow 7 1000
203 Altroz Tata Black 5 1500
208 Innova Toyota Silver 8 3000
209 Harrier Tata White 6 2000
212 Duster Renault Red 6 2500
217 Ertiga Suzuki Grey 7 2300

Customer
Custcode Custname Ccode
101 Gopinath 201
102 Ashok 203
103 Harshini 201
104 Vishnu 212
(i) To display the Names and Charges of all the Silver coloured cars.
(ii) To display the non duplicate car codes in the customer table.
(iii) To display the Minimum and Maximum car charges.
(iv) To give a discount of 10% in the car charges for existing customers (who
are in the customer table).
(v) To display Name and Make of cars whose charges is in the range 2000
to 3000 (both inclusive).
33 A binary file “vehicle.dat” has structure [RegNo, Type, Make, Year]. 5
a. Write a user defined function AddVahan() to input data for a vehicle
and add to “vehicle.dat” file.
b. Write a function CountVahan(Type) in Python which accepts the
Type of the vehicle as the parameter and count and return the
number of vehicles of the given Type.

OR

A binary file “player.dat” has structure (PlayerId, Name, Team, StrikeRate).


Write a function ShowPlayer() in Python that would read contents of the file
and display the details of those players whose Team is “India” and
StrikeRate is above 50. Also display the total number of such players.

SECTION E
34 A Book store Current Books is planning to store their book details in a 4
database using SQL. As a database administrator, Poorvekka has decided
that:
(a) Name of the database - CB
(b) Name of the table - Collections
(c) The attributes of Collections are as
follows:
BookNo - Numeric
BookName – Character of size 25
Price – Numeric
Quantity – Numeric

(d) Identify the attribute best suitable to be declared as a primary key,


(e) Write the degree and cardinality of the table Collections.
(f) Write SQL command to increment the quantity by 20 wherever
quantity is below 50.
(d) Poorvekka wants to remove the entire data from table
Collections. Which command will she use from the following:
a. DELETE FROM Collections;
b. DELETE Collections;
c. DROP DATABASE CB;
d. DELETE * FROM Collections;

35 Atul Prakash of Class 12 is writing a program to create a CSV file 4


“students.csv” which will contain student name and admission number
for some entries. He has written the following code. As a programmer,
help him to successfully execute the given task.
import # Line 1

def Addstudents(Name, Admno): # to write / add data into the CSV


f=open('students.csv',' ') # Line2
writerObj = csv.writer(f)
writerObj.writerow([Name,Admno])
f.close()
#csv file reading code
def Retrievestudents():# to read data from CSV

with open(' students.csv','r') as fobj:


readerObj=csv. (fobj) # Line
3 for row in readerObj:
print (row[0],row[1])
fobj.close() # Line4

AddStudents(“Raghava”, “2541”)
AddStudents (“Pooja”,”3411”)
AddStudents(“Krutika”,”2218”)
Retrievestudents () #Line 5

(a) Name the module to be imported in Line 1.


(b)Which mode Atul should open the file to add data.
(c) Fill in the blank in Line 3 to read data from a csv file.
(d) Is Line 4 mandatory? Justify your answer.
MARKING SCHEME
Section - A
1 a) sub%marks 1
2 [“I”, “O”, “U”] 1
3 Module “csv” 1
4 c) by 1
5 b) K[3] =405 (as tuple is immutable) 1
6 {“Sub1” : “Physics” , “Sub2” : “Chemistry” , “Sub3”: “Math”} 1
7 7
1
8 floor() from math module 1
9 FTP (File Transfer Protocol) 1
10 c) Hacker 1
11 ORDER BY 1
12 To check for values which are not defined as NULL 1
13 AVG 1
14 a) UPDATE 1
15 Microwave / Radio wave 1
16 d. List 1
17 Ans: (c) A is True but R is False 1
18 Ans: (a) Both A and R are true and R is the correct explanation for A 1
SECTION B
19 a) 26.75 1
b) True 1
20 Wi-Fi is the name of a wireless networking technology that uses radio waves to 2
provide wireless high-speed Internet and network connections.

WiMax (World wide Interoperability for Microwave Access) is a wireless industry


coalition dedicated to the advancement of IEEE 802.16 standards for broadband
wireless access (BWA) networks.
OR

Domain Name: A domain name is a unique name that identifies a particular


website and represents the name of the server where the web pages reside.

URL: The Uniform Resource Locator is a means to locate resources such as web
pages on the Internet. URL is also a method to address the web pages on the
Internet.

Example: http://cbseacademic.nic.in/web_material/CurriculumMain22/CS2022-
23.pdf
is an URL where cbseacademic.nic.in is the domain name.
21 a. GPRS – General Packet Radio Services 2
b. GSM – Global System for Mobile communications
c. WLL – Wireless Local Loop/Wireless in Local Loop
d. PPP – Point to Point Protocol
22 Positional Parameter - When function calls are made, there is a one to one 2
correspondence between the argument and the parameter based on the
order/position in which the argument appears in the function.
Ex:
def fun1(x,y,z):
m= x/y-z
print(m)
a,b,c = 5,2,3
fun1(a,b,c)
fun1(4,b,b)
#fun1(a,b) #Error as the third argument is missing

Default parameters - Usually when a function is called, the number of arguments


must match exactly the number of parameters, otherwise python gives an error.
But there is an exception, if a function is defined with a default parameter, then
the function call can have less number of arguments than the number of
parameters in the function header.
Ex:
def fun1(x,y,z=2): # z is default parameter
m= x/y-z
print(m)
#def fun2(m=2,n,p): # error default arguments must be rightmost
# return m+n+p
a,b,c= 1,2,3
fun1(a,b,c)
fun1(a,b)
#fun1(b) #error as at least two parameters must be passed
OR
A function can return multiple values which is written after the return statement
and the values are separated by commas. The multiple return values are returned
as a tuple object to the statement that made the function call.
Ex:
def fun1(x,y,z):
return x+y,y+z,z+x
a,b,c= 3,5,9

#multiple returned values accepted as a tuple


m = fun1(a,b,c)
print(m)

#multiple returned values accepted in multiple variables


p,q,r=fun1(10,11,12)
print(p,q,r)
23 CORRECTED CODE: 2

for Name in ['Aakash', 'Satya', 'Tarushi']:


if Name[0]=='S':
print(Name)
24 Minimum VALUE = 0 2
Maximum VALUE = 3
Options (ii) & (iii)
are incorrect.

25 Alternate Keys are candidate keys which are not selected as Primary Key. 2
Table: STUD
AdmNo RollNo Name
1236 101 Amarnath

1457 102 Piyush

1836 103 Swetha

In the above table STUD, AdmNo and RollNo are candidate keys, If RollNo
is selected as Primary Key then AdmNo will be the alternate key.
SECTION C

26 def Interchange(num): 3
for i in range(0,n,2):
num[i], num[i+1] = num[i+1], num[i]
print(num)

num=[5,7,9,11,13,15]
n=len(num)
if n%2==0:
Interchange(num)
Note : Any correct code giving the same result is also accepted
27 def Disp_upper_first(): 3
word=""
f=open("legend.txt","r")
line=f.read()
word=line.split()
for i in word:
if i[0].isupper():
print(i)
f.close()
Disp_upper_first()
Note : Any correct code giving the same result is also accepted

OR
def countdigits():
c=0
f=open("marks.txt","r")
line=f.read()
print(line)
for i in line:
if i.isdigit():
c+=1
print("Total number of digits in the file:",c)
f.close()
countdigits()
Note : Any correct code giving the same result is also accepted
i.
28 3
Make Count(*)
Toyota 1
Suzuki 1
ii.
Cname Make
Innova Toyota
Duster Renault
Ertiga Suzuki
Harrier Tata
Altroz Tata
Triber Renault
iii.
Custname Cname
Gopinath Triber
Ashok Altroz
Harshini Harrier
Vishnu Duster
29 def Push(nums):
li =[] 3
for i in range(0,len(nums)):
if nums[i]%2!=0:
li.append(nums[i])
if len(li) == 0:
print('Stack is empty!!')
else:
print(li)
Push([10,15,20,25,30,35])
Note : Any correct code giving the same result is also accepted

OR
def popStack(names) :L =
len(names)
if L==0:
print("Stack Underflow")
else:
val = names[L-1]
names.pop(L-1)
return val
res=popStack(['Harikaran','Balaji','Nikhil','Cathrine'])
print('Value returned:',res)
Note : Any correct code giving the same result is also accepted
30 OUTPUT : 3
pRE2bOARDxeXAMaddd
SECTION –D
31 (i) Most suitable place to install the server is ADMIN, as this building has 5
maximum number of computers.
(ii) Topology: STAR
Cable layout:

(iii) Repeater
(iv) Satellite Link
(v) (c) Video Conferencing
32 (i) Select Cname, Charges from Car where Colour=’silver’; 5
(ii) Select distinct Ccode from customer;
(iii) Select min(Charges), max(Charges) from Car;
(iv) Update Car set Charges=Charges - Charges*0.1 from Car R, Customer C
where R.Ccode=C.Ccode;
(v) Select Cname, Make from Car where Charges between 2000 and 3000;
33 import pickle def 5
AddVahan():
f1= open(“vehicle.dat”, “ab”)
RegNo = input(“Enter the vehicle registration number: “)
Type = input(“Enter the vehicle type: “)
Make = input(“Enter the manufacturer name: “)
Year = int(input(“Enter the year of manufacturing: "))
rec = [RegNo, Type, Make, Year]
pickle.dump(rec, f1)
f1.close()
def CountVahan(Type):
f1 = open(“vehicle.dat”, “rb”)
count = 0
try:
while True:
rec = pickle.load(f1)
if Type == rec[1]:
count = count + 1
except:
f1.close()
return count
OR
import pickle
def ShowPlayer():
f1 = open(“player.dat”, “rb”)
count = 0
try:
while True:
rec= pickle.load(f1)
if rec[3] >50 and rec[2] == “India”:
print(rec [0], rec [1], rec [2], rec [3],sep=”\t”)
count +=1
except:
f1.close()
print(“Number of Indian players with strike rate more than 50=”, count)
SECTION E
34 (a) BookNo 4
(b) Degree=4 Cardinality =7
(c) UPDATE collections SET quantity = quantity + 20 WHERE quantity < 50;
(d) DELETE FROM Collections;
35 (a) Line 1 :import csv 4
(b) Line 2 :f=open('students.csv','a')
(c) Line 3 :readerObj=csv.reader(fobj)
(d) Line 4: Not mandatory, as we have opened the file using “with” operator, it
closes automatically.

You might also like