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

Computer Science (083) - Practice Paper-2 - QP

This document is a practice question paper for Class 12 Computer Science, consisting of 37 questions divided into five sections. Each section has a different mark allocation, with questions covering various topics in Python programming and SQL. General instructions include compulsory questions, internal choices, and specific requirements for programming responses.

Uploaded by

Deivanai K CS
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)
18 views12 pages

Computer Science (083) - Practice Paper-2 - QP

This document is a practice question paper for Class 12 Computer Science, consisting of 37 questions divided into five sections. Each section has a different mark allocation, with questions covering various topics in Python programming and SQL. General instructions include compulsory questions, internal choices, and specific requirements for programming responses.

Uploaded by

Deivanai K CS
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

CHENNAI SAHODAYA SCHOOLS COMPLEX

(General Instructions)
 Please check that this question paper contains 12 printed pages.
 Please check that this question paper contains 37 questions.
 Please write down the serial number of the question before attempting it.
 Reading time of 15 minutes is given to read the question paper alone. No writing during
this time.
 All questions are compulsory. However, internal choices have been provided in some
questions. Attempt only one of the choices in such questions.
 The paper is divided into 5 Sections- A, B, C, D and E.
 Section A, consists of 21 questions (1 to 21). Each question carries 1 Mark.
 Section B, consists of 7 questions (22 to 28). Each question carries 2 Marks.
 Section C, consists of 3 questions (29 to 31). Each question carries 3 Marks.
 Section D, consists of 4 questions (32 to 35). Each question carries 4 Marks.
 Section E, consists of 2 questions (36 to 37). Each question carries 5 Marks.
 All programming questions are to be answered using Python Language only.
 In case of MCQ, text of the correct answer should also be written.

PRACTICE PAPER-2
Class-12
(COMPUTER SCIENCE – 083]

Roll No.: Maximum Marks:


Date: Time allowed: 3 hours

QNo SECTION-A [21 x 1 = 21 Marks] Mrs


1 State True or False. 1

Exception clause is the base class for all exceptions .

2 How do you remove all occurrences of a substring from a string in Python? 1


a) Using the erase() method
b) Using the remove() method
c) Using the delete() method
d) Using the replace() method
3 Write the output. 1
print(2 or ( 5 and ( not 4<3)))
print(( 5 and ( not 4<3))or 2)

Page 1 of 12
4 Write the output. 1
a="youareGoodstudent"
print(a.split())
print(a.split('e'))
5 Write the output. 1
Names="ILoveIndia"
print(Names[-1:-8:-2])
6 What will be the output of the following code? 1
TT=[10,20,30]
PP=TT
TT += [40,50]
print(PP==TT)
a) None b) False c) True d) Error
7 Which of the following will delete key-value pair for key=”Red” from a dictionary D1?
a) Delete D1(“Red”)
b) del D1[“Red”]
c) del.D1[“Red”]
d) D1.del[“Red”]
8 Choose correct output/stack contents for the following sequence of operations. 1
[Note: Initially stack is empty, Find the stack content after execution]
push(5)
push(8)
pop()
push(2)
push(5)
pop()
push(1)
a)8 5 2 5 1 b)8 5 5 2 1 c)5 2 1 d)2 5 5 1
9 Fill in the blank. 1
The SELECT statement when combined with __________ clause, returns records
without repetition.
a) DESCRIBE b) UNIQUE c) DISTINCT d)NOT NULL
10 What will be the output of the following code if the content of the file “ smile.txt” is: 1

Smiling is infectious,
You catch it like the flu.
When someone smiled at me today,
I started smiling too.

Page 2 of 12
file = open(“smile.txt”)
content = file.read()
print(file.read(7))
file.close()

a) Smilin b) ng. too c) Smiling d)No output

11 What is the output of the following code?

def Games():
try:
print(“try Silver”,end=’ ‘)
finally:
print(“finally Gold”,end=’ ‘)
#main
Games()

a)try Silver finally Gold b) try Silver

c)finally Gold d) None of the these

12 What is the output of the following display function call? 1


def display(**kwargs):
for i in kwargs:
print(i)

display(emp=”shyam”, salary = 20000)

13 To reflect the changes made in the database permanently, you need to run <connection> 1
_____________ method.
a)done() b)reflect() c)final() d)commit()

14 With SQL, how do you select all the records from a table named “Persons” where the value 1
of the column “FirstName” ends with an “a”?
a) SELECT * FROM Persons WHERE FirstName=’a’
b) SELECT * FROM Persons WHERE FirstName LIKE ‘a%’
c) SELECT * FROM Persons WHERE FirstName LIKE ‘%a’
d) SELECT * FROM Persons WHERE FirstName=’%a%’.

15 In SQL, what is the use of IS NULL operator? 1

16 Which aggregate function can be used to find the cardinality of a table? 1

a) sum() b)count() c) total() d)max()

Page 3 of 12
17 Identify the network which extends a private network across a public network. 1
a)Storage Area network
b)Local area network
c)Enterprise Private network
d)Virtual private network
18 The new web standard that incorporates AI, ML(Machine Learning) and black chain to 1
the internet is ________________.

a) web 4.0 b)Web 3.0 c)web 2.0 d)web 1.0

19 In fiber optic cable, the signal is transferred in the form of ___________. 1

a)radio wave b)infrared c)light d)None of these.

Q20 and Q21 are ASSERTION(A) AND REASONING(R) based questions.


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.
20 Assertion(A): Generally, a join query combines rows from multiple tables having some 1
common column(s) and a joining condition, but not always.
.
Reason(R) : A cartesian product is an unrestricted join where all possible combinations
of rows from multiple tables are created without any condition on them.
21 Assertion(A): Python’s built-in functions, which are part of the standard Python library, 1
can directly be used without specifying their module name.

Reason(R): Python’s standard library’s built-in functions are made available by


default in the namespace of a program.
SECTION-B [7x2=14 Marks]
22 What is type casting? Explain its types with an example. 2

23 List all the operators used in the following program. Name the operator types under Python. 2

def change(v, a=30, b=35):


if v in "vowel" and a!=b:
a*=b//a
b=a//b%a
a*=b-a
print(a,b)

x=2
y=3
change('e',x,y)

Page 4 of 12
24 I) D is a dictionary. 2
D = {"apple": 15, "banana": 7, "cherry": 9,"orange":84}
Answer the following questions using built functions/dictionary functions only.
A) Write the statement to remove all the items from the dictionary ‘D’.
OR
B) Write the statement to sort the values in ascending order of dictionary ‘D’.

II) T is a Tuple.
T = ("banana", "cherry", "orange", ”apple” )
Answer the following questions using built functions/tuple functions only.
A) Write the statement to sort values in descending order.
OR
B) Write the statement to count number of elements present in tuple ‘T’.
25 Based on the following code, answer the following question. 2
import random
AR=[20,30,40,50,60,70]
FROM=random.randint(1,3)
TO=random.randrange(2,5)
for K in range(FROM,TO+1):
print (AR[K],end=”#“)
What possible outputs(s) are expected to be displayed on screen at the time of execution
of the above program? Also write the maximum and minimum value of variable ‘TO’.
a) 10#40#70# b) 50#60#70#

c) 40#50#70# d) 30#40#50#
26 The code provided below is intended to swap alternate elements of a given List. 2
However, there are syntax and logical errors in the code. Rewrite it after removing all
errors. Underline all the corrections made.

def swap_alternate(tup)
for i in range(0,len(tup),2)
tup[i],tup[i+1]=tup[i+1],tup[i]
return

result = swap_alternate([10, 20, 30, 40, 50, 60])


print("Swapped List =" +result)
27 I) 2
A) Given is a python list declaration.
Names=[“Aman”,”Anvit”,”Ashish”,”Rajan”,”Rajat”]
Page 5 of 12
Write the output of:
print(Names[-1:-4:-1])
OR
B) Consider the following tuple declaration:
Tup=(10,20,30,(10,20,30),40)
Write the ouput of:
print(Tup.index(20))

II)
A)Write the output.
a=20
def logic(a):
b=20
a=a+b
logic(10)
print("a=", a)
OR
B)Write the output.
a=10
def call():
global a
a=15
b=20
call()
print("a=", a)
28 A)Name the topology. List one advantage and one disadvantage of it. 2

OR
b)Expand the term TCP/IP.What is the use of TCP/IP.

Page 6 of 12
SECTION – C [3x3=9 Marks]
29 Write function Count_Robot() in python to read a text file “Moon.txt” and count the 3
number of times the word “robot “(all cases) occurs in the file.

OR

Write a function Filter() that copies a text file “source.txt” into “target.txt” barring the
lines starting with a “@” sign.

30 A list, NList contains following record as list elements: 3

[City, Country, distance from Delhi]

Each of these records are nested together to form a nested list. Write the following user
defined functions in Python to perform the specified operations on the stack named
travel.

i) Push_element(NList): It takes the nested list as an argument and pushes a list object
containing name of the city and country, which are not in India and distance is less than
3500 km from Delhi.

ii) Pop_element(): It pops the objects from the stack and displays them. Also, the
function should display “Stack Empty” when there are no elements in the stack.

For example: If the nested list contains the following data:

NList=[["New York", "U.S.A.", 11734], ["Naypyidaw", "Myanmar", 3219],


["Dubai", "UAE", 2194], ["London", "England", 6693],
["Gangtok", "India", 1580], ["Columbo", "Sri Lanka", 3405]]

After execution of Push_element(NList) the ‘travel’ stack should contain:

['Naypyidaw', 'Myanmar'], ['Dubai', 'UAE'], ['Columbo', 'Sri Lanka']

The output should be: [while executing Pop_element()]

['Columbo', 'Sri Lanka']


['Dubai', 'UAE']
['Naypyidaw', 'Myanmar']
Stack Empty

OR

Write a menu driven program to add, delete and display the record of Hostel using
list as stack data structure in Python. Record of hostel contains the fields: Hostel
number, Total students and Total Rooms.

Page 7 of 12
31 Predict the output of the following code: 3
D={1: "One", 2: "Two", 3: "Three"}
D.setdefault(4,"Fourty")
D.setdefault("Twenty")
print(D)
L=[ ]
for i,j in D.items( ):
if j!=None and j[0]== "T":
L.append(i)
print (L)
print(D.get(1,"not found"))
print(D.get(10,"not found"))
print(D.update({2:200}))
OR
Predict the output of the following code:
data=["L",20,"M",40,"N",60]
times,alpha,add=0,"",0
for c in range(1,6,4//2):
times = times + c
alpha = alpha + data [c-1] + "@"
add = add + data[c]
print (times, add, alpha)
SECTION-D ( 4 x 4 = 16 Marks)
32 Consider the table customer as given below. 4
Table: Customer

Code Cname Gender Pur_amt discount Net


1010 Ravikiran Male 50000 5000 45000
1012 Sujatha Female 25000 2500 22500
1018 Julia Female 30000 3000 27000
1015 Johne Male 45000 4500 40500
1016 Jasmine Female 40000 4000 36000

Note: The table contains many more records than shown here.

A)Write the SQL queries:


1) To display all records without duplicate records in alphabetical order of name.
2)To display name, purchase amount and discount of all customers whose third
letter of name is either ‘r’ or ‘m’.

Page 8 of 12
3)To find and print the maximum, minimum purchase amount of each gender.
4)To increase the discount with 12% of purchase amount of all female customers.
OR
B) Write the output.
1)Select cname, pur_amt from customer where net between 30000 and 45000
order by cname;
2)Select gender, avg(discount) from customer group by gender having count(*)>2;
3)Select cname, pur_amt, net from customer where cname like ‘J%e’ order by net desc;
4)Select gender, max(pur_amt), min(net) from customer group by gender ;

33 Rohan is making a software on “Countries & their Capitals” in which various records are 4
to be stored/retrieved in CAPITAL.csv data file. It consists some records (Country &
Capital). Help him to define and call the following user defined functions:
i) AddNewRec() – To accept and add the records to a CSV file “CAPITAL.csv”. Each
record consists of a list with field elements as Country and Capital to store country name
and capital name respectively.

ii) ShowRec() – To display all the records having country name starting with “I” present
in the CSV file named ‘CAPITAL.csv’.

34 Write SQL commands for the questions. 4


Travel
Tcode Source Destination distance Transport fare

101 Chennai Bangalore 350 Bus 850


102 Delhi Chennai 2650 Flight 7500
103 Mumbai Chennai 2200 Train 2200
104 Chennai Delhi 2650 Flight 8000
105 Delhi Mumbai 1700 Train 1750

Passenger
Tcode pname Gender Age phone
102 Arun Male 45 9834334343
104 Balakumar Male 11 7678987654
107 Ritu Female 35 9889454567
101 Banu Female 43 8001232338
104 Gopichand Male 65 7898565656
1. To display travel code, source, destination, name and age of all travelers whose
age is>=20 and <=40.

Page 9 of 12
2. To display travel code, customer name, fare amount and discount. The discount
is 10% of travel fare.

3. To count the number of male and number of female travelers who are travelling
from Chennai to Delhi whose age is>60 separately.

4. To increase the fare amount by 10% of actual fare for all male travelers whose
destination is either Mumbai or Delhi.

OR

To display all passenger name, age and phone number of travelers who are
travelling from Chennai to Delhi in alphabetical order of name.

35 The code given below inserts the following record in the table Student: 4
RollNo – integer
Name – string
Class2 – integer
Marks – integer
• The details (RollNo, Name, Class and Marks) are to be accepted from the user.
Write the following Python function to perform the specified operation:
i) Interface_Insert(): To input details of N items and store it in the table Student.
ii)Interface_Show()-The function should retrieve all the records from Student table and
display the records who are studying in class 12 and marks more than 60.
Assume the following for Python-Database connectivity:
Host: localhost, User: root, Password: tiger, Database: school.

SECTION – E [2x5=10 Marks]


36 a)Write a function CREATE_DIC() to store N records in a binary file “HAPPY.DAT” 5
b)Write a function SEARCH_DIC() to search a record whose name is “bhaviya”.
c)Write a function DisplaySENIOR() to display all the senior citizen information.
Consider the following definition of dictionary:

Dictionary={“rollno”:roll, “name”:name, “age”:age}

[Note: Accept the values from user, A Senior Citizen is a resident Indian who is of the
age of 60 years and above]

Page 10 of 12
37 An International Bank has to set up its new data center in Delhi, India. It has five blocks 5
of buildings – A, B, C, D and E.

Distance between the blocks and number of computers in each block are as given below:

Distance Between Block


Block A to Block B 25m
Block B to Block C 30m
Block C to Block D 30m
Block D to Block E 35m
Block E to Block C 40m
Block D to Block A 120m
Block D to Block B 45m
Block E to Block B 65m

Number of Computers
Block A 55
Block B 180
Block C 60
Block D 55
Block E 70

(i) Suggest the most suitable place/block to host the server. Justify your answer.
(ii) Draw the cable layout (Block to Block) to economically connect various
blocks within the Delhi campus of International Bank.
(iii) Suggest the placement of the following devices with justification:
(a) Repeater (b) Hub/Switch
(iv)The bank is planning to connect it’s another head office in London. Which type of
network out of LAN, MAN, or WAN will be formed? Justify your answer.

Page 11 of 12
(v)
A) What would be your recommendation for enabling live visual communication
between the Admin Office at the Mumbai campus and the DELHI Office (Block B) from
the following options:
i) Video Conferencing
ii) Email
iii) Telephony
iv) Instant Messaging
OR
B)How can unauthorized access in a network be stalled? Name a hardware/software to
be installed in your computer to work for this reason.

****END OF THE PAPER****

Page 12 of 12

You might also like