XII - CS

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

VELAMMMAL BODHI CAMPUS

“Velammal Knowledge Park”


PRE-BOARD EXAM – 2024-25
Class : XII (Mat/CS) Marks : 70
Date : 05.02.2025 COMPUTER SCIENCE (083) Duration : 3 hours

General Instructions:
● This question paper contains 37 questions.
● All questions are compulsory.
● 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.

Section – A

I. ANSWER ALL THE QUESTIONS: (21x1=21)


1. State True or False 1
In python, a value error is raised when a function receives an argument of
the right type but an in appropriate value.
2. Evaluate the following expression 1
print(int(-33//13*35%-2*15/3))
a) -15.0 b) -5 c) -5.0 d) 5
3. Consider the given python string declaration. 1
a= “preboard exam-cs”
print(a[-50 : 10 : 2].swapcase( ))
a) PEOR b) Error c) s-aed d) peor
4. Consider the following code snippet and identify the value that could be 1
stored in L after execution of the code.
L=[[10]*3]
L.insert(3, 4)
a) [[10], [10], [10], 4] b) [[10,10,10], 4]
c) [10,10,10, 4] d) [10,4], [10,4], [10, 4]
5. What will be the output of the following statements? 1
a=[0,1,2,3]
del a[:]
print(a)
a) None b) [ ] c) [0, 1, 2, 3] d) Name error
6. Identify the output of the following code snippet;- 1
Line = "Sahodaya$Day1 2024"
Line= Line.strip('2S4h').replace('day','%')
print(Line)
a) aho%a$Day1 20 b) Saho%a$% 1 20
c) Saho%a$Day1 20 d) ho%a$Day1 2024
7. What will be the output of the following code- 1
Tuple1= (3,4)
Tuple2 = Tuple1
Tuple1+= (3,4)
Tuple2*= 2
print(Tuple1 is Tuple2)
8. Predict the output : 1
a= „All the best‟
for i in range(len(a)//3):
print(a)
a= “cs”
9. What does the popitem() in a dictionary do? 1
a) It removes the pair as specified as a parameter specified in a dictionary.
b) It removes the last pair in the dictionary and returns the pair as a tuple.
c) It returns the last pair of the dictionary.
d) It removes the last pair in the dictionary and returns the key.
10. Pick one of the following statements to correctly complete the function body 1
to display the output 5 in the given code snippet.
def f(number):
# Missing function body
print(f(5))
a) return “number” b) print(number) c) print(“number”) d) return number
11. What will be the output of the following code? 1
L=[10,5]
G=4
def change(X):
global G
N=len(X)
for i in range(N):
X[i]+=G
G=G+1
print(G, end=”$”)
change(L)
for i in L:
print(i,sep=”#”,end=”$”)
a) 6$14#10#$ b) 14$10$6$ c) 6$14$10$ d) error
12. In a try-except block with multiple except blocks, which block will be 1
executed if an exception matches multiple except blocks.
a) The first matching except block encountered from top to bottom
b) All matching except blocks simultaneously
c) The last matching except block encountered from top to bottom
d) None of the above
13. Write the missing statement to complete the following code: 1
file= open(“Notes.txt”, „r‟)
data = file.read(20)
_______________
# The above statement should display & return the position of the file pointer
file.close()
14. The SQL keyword______is used in SQL expression to select records based on 1
pattern.
15. Geeta wants to know the usage of NULL in mysql. Help her choose in which 1
of the following case NULL value cannot be assigned to the column
Admission_Number :
a) When the Admission_Number is zero
b) When the Admission_Number is not known
c) When the Admission_Number is not available
d) When the Admission_Number is not applicable
16. Which among the following can be used to find the mean of all values 1
present in the quantity column.
a) avg(quantity) b) mean(quantity) c) average(quantity) d)sum(quantity)
17. What will be the output of the query : a)
Update Product set price = price*10/100 where pname like ‘S%’;
a) Increase the price by 10% of all items where name of the product starts
with S.
b) Reset the price of the product to its 10% where the name of the product
starts with S.
c) Decrease the price of the product by 10% where the name of the product
starts with S.
d) The above query will show an error.
18. Which switching technique will send the message as a complete packet from 1
source to destination?
19. Which protocol is used to login remotely to a network. 1
a) PPP b) TELNET c) FTP d) HTTP
Q. 20and 21 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): In binary files, no specific encoding scheme the interpretation 1
of bytes depends on file format.
Reason (R): python objects (list, dictionary..) have a specific structure which
must be maintained while storing or accessing them. Python provides a
special module called pickle module for this.
21. Assertion(A): Order by clause requires one to group the rows into a 1
particular category.
Reason (R): Order by will arrange the rows in ascending or descending order
of the column.
SECTION – B (7x2=14)
22. i) How are keywords different from an identifier? 2
ii) Identify the type of tokens for the following:
a. „\n‟ b. True
23. i) Write a Python statement to display alternate characters of a string, named 2
my_exam. For example, if my_exam="Russia Ukraine". The statement
should display Rsi kan.
ii) If L1= [19,23,17,13,71] and L2=[21,5,11,31,55]
a) Merge L1 with L2 so that they merge to become a single list in the
name L1.
(OR)
b) Arrange the elements of L1 and L2 in ascending order.
24. Identify the correct output(s) of the following code (Select from A - D). Also 2
write the minimum and the maximum possible values of the variable b.
import random
Lang = ['Python', 'Ruby', 'JAVA', 'Pascal']
b=random.randint(0,3)
for i in range(b):
print(Lang[i][i],'*',end=" ")

A) P * u * V * B) P * R * C) u * A * P* D) P *
25. What will be the output of the following code? 2
def add( ):
c=l
d=1
while(c<9):
c=c+2
d=d*c
print(d,end="$")
return c
print(add( ),end= “*”)

A) 945$9* B) 945$9 C) 9*945$ D) 9$945*


26. A CD/DVD shop named “NEW DIGITAL SHOP” stores various CDs & DVDs 2
of songs/albums/movies and use SQL to maintain its records using SQL
table.
Table : LIBRARY
CDNO NAME QTY PRICE
10001 Indian patriotic 20 150
10004 Hanuman 15 80
10005 Instrumental 25 95
10003 Songs of Diwali 18 125
10006 Devotional 14 75
10002 Best Birthday 17 NULL
i) (A) Write the Degree & Cardinality of the relation LIBRARY.Also Identify
the best attribute which may be declared as Primary key.
(OR)
(B) What constraint can be applied to Name so that no NULL values are
permitted?
ii) (A) Insert the following record in the above relation:
(10009,”Motivational songs”,15,70)
(OR)
(B) Write an SQL query to display the minimum quantity.
27. Give an example of natural join between two tables. State the cardinality and 2
the degree of relation of the natural join.
28. (A)List one advantage and one disadvantage of Radio Waves transmission. 2
(OR)
(B) Expand ARPANET. What is the significance of ARPANET.
SECTION – C (3x3=9)
29 Predict the output of the following code:
def fun(): 3
S= ['CS','IP','IT','PE']
new=[]
for i in S:
if S.index(i)%2==0:
new.append(i[len(i)-1])
elif S.index(i)//2==0:
new.append(i[0])
print('#'.join(new),end='$')
fun()
(OR)
Predict the output of the following code:
def pg():
Text="Welcome@ to Ex4m!"
T=""
c=0
for i in Text:
if not i.isalpha():
T=T+"*"
elif not i.isupper():
T=T+(Text[c+1])
else:
val=ord(i)
val=val+1
T=T+chr(val)
c=c+1
print(T)
pg()
30. (A) Write the definition of a user-defined function ‘push_str(S)’ which 3
accepts a list of strings in a parameter „S‟ and pushes all those strings which
are having at least one vowel in it from the list „S‟ into a Stack named
„Vowel_String‟.
Write function pop_String() to pop the topmost string from the stack and
returns it. If the stack is already empty, the function should display "Empty".
Write function Disp_String() to display all element of the stack without
deleting them. If the stack is empty, the function should display 'None'.
For example:
If the Strings input into the list `S` are:
[“HI”, ”DRY”, ”WHY”, ”SAID”, ”MYTH”, ”THERE”]
Then the stack `Vowel_String` should store:
[“HI”, ”SAID”, ”THERE”]
The Disp_String() should display as below
THERE SAID HI None
(OR)
(B) You have a stack named ProductStack that contains records of
Products.Each Product record is represented as a list containing Product-
name,Product_Price and Brand.
Write the following user-defined functions in python to perform the specified
operations on the stack ProductStack.
i) push_Product(ProductStack, new_Product): This function takes
the stack ProductStack and a new product record new_Product as
arguments and pushes the new Product record onto the stack.
ii) pop_Product(ProductStack): This function pops the topmost
Product record from the stack and returns it. If the stack is already empty,
the function should display “Underflow”.
iii) peep(ProductStack): This function displays the topmost element
of the stack without deleting it. If the stack is empty, the function should
display „None‟.
31. A) Write a Python function DISPLAY() that displays the longest palindromic 3
word from a text file “Article.txt”.
For Example if the file contains;
“Malayalam is one of the Indian language.
Arjun is driving a racecar.
Have some civic sense.
The highest level of cognitive domain is evaluation.”
Then the output should be Malayalam.
(OR)
B) A file “Phone.txt” is a text file contains Zone Name and Phone Number in
the following format.
NORTH 7577843767
SOUTH 9865576321
EAST 7865432564
WEST 7435248988
Write a function DISPLAY() in python to open the file in an appropriate mode
to retrieve zone names and phone number. Display the zone name with the
phone numbers whose phone number starts with the number „7‟. Assume
that the file already exists in the System.
SECTION – D (4x4=16)
32. Vijay has created a CSV file FOOTBALL.CSV to store player details, like 4
player name, matches played, and goals scored. The file has the following
columns as headers: [PNAME, MATCH, GOALS].
The data type of PNAME – str , MATCHES- int , GOALS- int

Write the following user-defined functions in Python:


(i) addPlayer(name, matches, goals): This function takes three parameters.
It should create a list containing these details and append the data to the
existing CSV file FOOTBALL.CSV without overwriting previous entries.
(ii) HighestAverage(): This function reads FOOTBALL.CSV and displays the
name of the player with the highest average goals per match (i.e.,
goals/matches). Ensure that the function does not calculate average where
matches might be zero.
33. Consider the table Employee and answer the questions under the options A 4
or B given below:
Table: Employee
EID NAME DOB DOJ SALARY PROJECT
E01 Ranjan 1990-07-12 2015-01-21 150000 P01
E02 Akhtar 1992-06-21 2015-02-01 125000 P04
E03 Muneera 1996-11-15 2018-08-19 135000 P01
E04 Alex 1991-10-25 2017-10-19 75000 P02
E05 Satyansh 1993-12-16 2018-10-19 85000 NULL
Note: The table contains many more records than shown here.
A) Write SQL Queries for the following questions:
i) Display the total salary of all employees who had assigned a project.
ii) Display the number of employees assigned for each project.
iii) Display the project without repetition.
iv) Display the employee name who born after October 1992.
(OR)
B) Write the output of the queries (i) to (iv) based on the table Employee:
i) select NAME, PROJECT from Employee order by PROJECT;
ii) select NAME, SALARY from Employee where DOJ like '2015%';
iii) select NAME, DOB, DOJ from Employee where SALARY between
100000 and 200000;
iv) select min(DOJ), max(DOB) from employee;
34. Shanaiya wants to write a python program which calls the python function 4
runs_scored(run) in python to display the record according to descending
order of player names whose runs scored are more than the runs entered by
the user(passed as parameter in the function) from the cricket table of
sports database. The MySQL server is running on LocalHost and the login
credentials are as follows: Username: Shanaiya ,Password: happy

The columns of the CRICKET table are as follows


pid(Player ID) -integer
pname(Player name) -string
runs (Runs scored) – integer
wickets (Wicket taken) – integer
Help her write the python program.
35 Write SQL queries for (a) to (d) based on the tables CUSTOMER and 4
TRANSACT given below :
Table : CUSTOMER
CNO NAME GENDER ADDRESS PHONE
1001 Suresh MALE A-123 West Street 9310010010
1002 Anita FEMALE C-24 Court Lane 9121211212
1003 Harjas MALE T-1 Woods Avenue 9820021001
`

Table: TRANSACT
NO CNO AMOUNT TTYPE TDATE
T1 1002 2000 DEBIT 2021-09-25
T2 1003 1500 CREDIT 2022-01-28
T3 1002 3500 CREDIT 2021-12-31
T4 1001 1000 DEBIT 2022-01-10
(a) Write the SQL statements to delete the records from table TRANSACT
whose amount is less than 1000.
(b) Write a query to display the total AMOUNT of all DEBITs and all
CREDITs.
(c) Write a query to display the NAME and corresponding AMOUNT of all
CUSTOMERs who made a transaction type (TTYPE) of CREDIT.
(d) Write the SQL statement to change the Phone number of customer
whose CNO is 1002 to 9988117700 in the table CUSTOMER.
SECTION – E ( 2x5=10)
36. Deepak is a Python programmer working for election commission, For the 5
upcoming election he has created a binary file “Election.bin”. The structure
of Election.bin is:
[Party_Id, Party_Name, Candidate_Name, TotalVote]
Where Party_Id is Party ID (integer)
Party_name is Party Name (string)
Candidate_Name is name of candidate(string)
TotalVote is total vote received by the candidate
For efficiently maintaining data of the event, Deepak wants to write the
following user defined functions:
(i) accept() – to accept a record from the user and add it to the file
Election.bin
(ii) Search(PartyName) – to display the record for a particular PartyName
and send the appropriate message if such record does not exist.
(iii) update() – To update the Candidate name and Total votes based on the
Party_ID.
As a Python expert, help him complete the task.
37. The government has planned to develop digital awareness in the rural areas 5
of the nation. According to the plan, an initiative is taken to set up Digital
Training Centers in villages across the country with its Head office in the
nearest cities. The committee has hired a networking consultancy to create
a model of the network in which each City Head office is connected to the
Training Centers situated in 3 nearby villages. As a network expert in the
consultancy, you have to suggest the best network-related solutions for the
issues/problems raised in (a) to (e), keeping in mind the distance between
various locations and other given per meters.

Shortest distances between various Centers :


Village1 Training Center to City Head Office 2 KM
Village2 Training Center to City Head Office 1·5 KM
Village3 Training Center to City Head Office 3 KM
Village1 Training Center to Village 2 Training Center 3·5 KM
Village1 Training Center to Village 3 Training Center 4·5 KM
Village2 Training Center to Village 3 Training Center 3·5 KM

Number of Computers installed at various centers are as follows :


Village1 Training Center 10
Village2 Training Center 15
Village3 Training Center 15
City Head Office 100

(a) It is observed that there is a huge data loss during the process of data
transfer from one village to another. Suggest the most appropriate
networking device, which needs to be placed along the path of the wire
connecting one village with another to refresh the signal and forward it
ahead.
(b) Draw the cable layout (location-to-location) to efficiently connect various
Village Training Centers and the City Head Office for the above shown
layout.
(c) Which hardware networking device, will you suggest to connect all the
computers within the premises of every Village Training Center ?
(d) Which protocol, will be most helpful to conduct online interactions of
Experts from the City Head Office and people at the three Village
Training Centers ?
(e) What type of network (PAN, LAN, MAN, or WAN) will be set up among the
Village Training Centers and the City Head Office.

* * * *ALL THE BEST* * * * *

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy