0% found this document useful (0 votes)
108 views15 pages

CS QP

The document outlines the structure and instructions for a question paper containing 37 questions divided into five sections (A to E) with varying marks. Each section has specific types of questions, including multiple choice, programming, and assertions. The paper requires answers to be provided in Python for programming questions and includes various topics related to programming, SQL, and networking.

Uploaded by

Smija V
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)
108 views15 pages

CS QP

The document outlines the structure and instructions for a question paper containing 37 questions divided into five sections (A to E) with varying marks. Each section has specific types of questions, including multiple choice, programming, and assertions. The paper requires answers to be provided in Python for programming questions and includes various topics related to programming, SQL, and networking.

Uploaded by

Smija V
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/ 15

General

(i)
Instructions :
This question paper
(ii) contains 37 questions.
a questions are compulsory. However, internal
provided in some guestions Altemnt only one of thechoices
have been
choices in such
questions.
(iii) The paper is divided into 5
Seetions -A, B, C, D and E.
(0) Section A, consists of 21 oustions (1 to 21).
Imark. Each question carries
(U) Section B, consists of 7 guestions (22 to 28). Each
2 marks. question carries
(UL) Section C, consists of 3 questions (29 to 31).
Each question carries
3 marks.
(uii) Section D, consists of 4
questions (32 to 35). Each question carries
f marks.
(viii) Section E, consists of 2 questions (36 & 37).
5 marks.
Each question carries
(ix) All programming questions are to be answered using Python
only. Language
() In case of MCQs, lext of the correct answer should also be written.

SECTION - A (21 x 1=21)

1 State True or False :


A Python List must always contain all its elements of same data type."

2. What will be the output of the following statement ? 1


Drint(14%3**2*4)
(A) 16 (B) 64
( 20 (D) 256
Page 3 of 32
91 P.T.0.
3.
Identify the correct output of the following code snippet :
qames"Olympic2024"
print (game. index ("C"))
(A) o ((B) 6

(C) -1 (D) ValueError

4
Which of the following is the correct
identifier ?
(A) global (B) Break
(C) def (D) with

5. Identify the invalid Python statement out of the following


options:
(A) print ("A",10, end="*") (B) print ("A", sep="*", 10)
(C) print ("A",10,sep="*") (D) print ("A" *10)

6 Consider the statements given below and then


choose the correct output
from the given options :
L=['TIC', TAC']
print (L[::-1])
(A) 'CIT', 'CAT') (B) TIC', TAC']
(C) 'CAT', 'CIT'] (D) ('TAC', 'TIC']

7. Which of the following operator evaluates to True if the


variable on either
side of the operator points towards the same
mnemory location and False
otherwise 2
is (B) is not
(C) and (D) or
91 Page 5 of 32 P.T.0.
8
Consider the statements given below and then choose the correct output
from the given options:
Da{'s01':95, 's02':96 )
for I in D
print (I,end='#)
(A) so1#S02# (B) 95#96#
(C) s01,95#s02,96# (D) s01#95#S02496#

9.
While creating a table, which constraint does not allow insertion of
duplicate values in the table?
(A) UNIQUE (B) DISTINCT
(C) NOT NULL
(D) HAVING

10
Consider the statements given below and then choose the correct output
from the given options :
def Change (N):
N=N+10
print (N, end='$$')
N=15

Change (N)
Print (N)
(A) 25$$15 (B) 15$$25
(C) 25$$25 (D) 2525$$

11. Consider the statements given below and then choose the correct output
from the given options:
N='5'
try:
print ('WORD' + N, end='#')
except:
print ('ERROR' , end='#")
finally:
print('OVER' )
(A) ERROR# (B) WORD5|OVER
(C) NORD5# (D) ERROR#OVER
91 Page 7 of 32 P.T.0.
12. Which of the following built-in function/method returns a dictionary ? 1
(A) dict () (B) keys ()
(C values () (D) items ()

13. Which of the following is a DML command in SQL? 1

(A) UPDATE (B) CREATE


(C) ALTER
(D) DROP

14. Which aggregate function in SQL displays the number of values in the
specified column ignoring the NULL values ?
(A) len () (B) count ()
(C) number () D) num ()

15. In MYSQL, which type of value should not be


enclosed within quotation
marks 9
1
(A) DATE (B) VARCHAR
KCY FLOAT (D) CHAR

16 State True or False:

If table A has 6 rows and 3 columns, and table B has 5 rows and
2 columns, the Cartosian product of A and B will have 30 rows and
5 columns.

17. Which of the following networking devices is used to regenerate and


transmit the weakened signal ahead ? 1

(A) Hub (B) Ethernet Card

(C) Repeater (D) Modem


91 Page 9 of 32
P.T.O,
18, Which of the following options is the correct protocol used for phone calls
Over the internet ?

(A) PPP (B) FTP


(C) HTTP (D) VolP

19. Expand ARPANET.

Q. Nos. 20 and 21l are Assertion (A) and Reason (R) ba sed
questions. Mark
the correct choice as
(A) Both Assertion (A) and Reason (R) are true and
Reason (R) is the
correct explanation for Assertion (A).
(B) Both Assertion (A) and Reason (R) are true and Reason (R)
is not the
correct explanation for Assertion (A).
(C) Assertion (A) is true but, Reason (R) is false.
(D) Assertion (A) is false but, Reason (R) is
true.

20. Assertion (A) : For a binary file opened using rb mode, the
pickle.dump () method will displav an error
Reason (R) : The pickle.dump () method is used to read from a
binary fle.

21, Assertion (A) : We can retrieve records from more than one table in
MYSQL.
Reason (R) Foreign key is used to establish a relationship between
two tables.
91 Page 1l of 32
P.T.0,
SECTION - B (7x 2 = 14)
22. What does the return statement do in a function ? Explain with the help
of an example. 2

23. Write one example of each of the following in Python :


() Syntax Error
(ii) Implicit Type Conversion

24. Consider the following dictionaries, D and Dl: 2


D={"Suman": 40,
"Raj":55, "Raman": 60)
Dl={"Aditi" :30, "Amit":90,"Raj":20)
(Answer using built-in Python functions only)
(i) (a) Write a statement to displayreturn the value
the key "Raj" in the dietionary D. corresponding to
OR
(b) Write a statement to display the length of the
dictionary D1
(ii) (a) Write a statement to append all the key-value pairs of
the
dictionary Dto the dictionary Dl.
OR
(b) Write a statement to delete the itemn with the given key
"Amit"
Irom the dictionary D1.

25. What possible output Erom the given options is expected to be displayed
when the following code is executed ? 2
import random
Cards=["Heart","Spade","Club","Diamond"]
for i in range (2) :
Print (Cards (random. randint (1, i+2) ] , end="#")
(A) SpadeDiamond# (B) Spade#Heart#
(C)
Diamond#club# (D) Heart#Spadet
91 Page 13 of 32 P.T.0.
26
The code given below accepts N as an integer argument and returns the
sum of all integers from 1 to N. Observe the following code carefully and
rewrite it after removing all syntax and logical errors. Underline all the
Corrections made.
def Sum (N)
for I in range (N) :
S=S+I
return S

print (Sum (10)

27. Nisha is assigned the task of maintaining the staff


data
organization. She has to store the details of the staff in the SQLoftable
an
named EMPLOYEES with attributes as
EMPNO, NAME,
BASICSAL to store DEPARTMENT,
mployee's ldentification Number, Name,
Department, and Basie Salary respectively. There can be two or
Employees with the same name in the more
organization.
(i) (a) Help Nisha to identify the attribute which should be
designated as the PRIMARY KEY. Justify your answer.
OR
(b) Help Nisha to identify the
to the attribute NAME such constraint which should be applied
that the Employees' Names cannot
be left empty or NULL while
entering the records but can have
duplicate values.
(iü) (a) Write the SQL
command to change the size of the attribute
BASICSAL in the table EMPLOYEES to allow the
value of
maximum
99999.99 to be stored in it.
OR
(b) Write the SQL, command to delete the table EMPLOYEES.

28 (a) Expand and explain the term URL.


OR
(b) Lxpand the term PPP. What is the use of PPP ?
91
Page 15 of 32 P.T.0.
SECTION-C (3 x 3 = 9)
29. (a)
Write a Python function that displays all the lines containing the
word 'vote' from a text file "Elections. txt". For example, if
the file contains :
In an election many people vote to choose their representative.
The candidate getting the maximum share of votes stands elected.
Normally, one person has to vote once.
The process of uoting may vary with time and region.
Then the output should be:
In an election many people vote to choose their
Normally, one person has to vote once. representative.
OR
(b Write a Python function that displays all the
words starting and
ending with a vowel from a text fle "Report. txt".
words should be separated by a space in the output. The
For
consecutive
the file contains : example, if
Once there was a wise man ina village.
He was an awesome story-teller.
He was able to keep people
Then the output should be : anchored while listening to him.
Once a a awesome able

30. (a) A stack, named


ClrStack, contains records of some colors. Each
record is represented as a tuple
ColorName, RED, GREEN, BLUE. containing four elements
ColorName
RED, GREEN, BLUE are integers. For is a string, and
example, a record in the
stack may be ('Yellow', 237, 250, 68)
Write the following user-defined functions in Python to 3 x1=3
specified operations on ClrStack: perform the
(0) push Clr (ClrStack, new Clr): This
function takes the
stack ClrStack anda new record new Clr as
arguments and
pushes this new record onto the stack.
(1) pop Clr (ClrStack): This function pops the topmost record
from the stack and returns it. If the stack is already empty, the
function should display the message "Undderflow".
(ui) isEmpty (Clrstack) : This function checks whether the stack
is empty. If the stack is empty, the function should return
True, otherwise the function should return False.
OR
91 Page 17 of 32 P.T.O.
following user-.defined functions in Python :
Writethe
Here Nand mystack are lists, and
myStack)
() push_ ttrail (N,
myStack represents a stack. The function should push the last
from the N onto the stack myStack. For
5 elements
ovample., if the list N is [1,2,3,4,5,6,7], then the function
pnsh trail () should push the elements 3,4,5,6,7 onto the
stack. Therefore the value of stack will be (3,4,5,6,7).
Assume that N contains at least 5 elements.

(ii) pop one (myStack) : The function should pop an element


from the stack myStack, and return this element. If the stack
is empty, then the function should display the message 'Stack
Underflow', and return None.

(ii) display all (myStack) : The function should display all the
elements of the stack myStack, without deleting them. If the
stack is empty, the function should display the message
'Empty Stack'.

B1. (a) Predict the output of the following code : 3

def ExamOn (mystr)


newstr =

count = 0
fox i in nystr:

if count$2 ! 0:

newstr = newstr + str(count-1)


else:

newstr = newstr + i.lower ()


COunt += 1

newstr= newstr + mystr[:2]


Print ("The new string is: ", newstr)
Examon (" GenX")
OR

P.T.0.
Page 19 of 32
G

execution of following Python code:


output on
Write the
def Change(X):
(b)
X.items () :
V in
for K,
L1.append(K)
L2. append (V)
D=/l:"ONE",2: "TWO",3: "THREE"

Ll=(]

L2=[]
Change (D)

print(L1)

print (L2)

Print (D)

(1x 4= l6)
SECTION- D

to
WORKER with a set of records
created a table named
32. Suman has sites, which consists
of WID,
of the
construction
maintain the data creating the table,
TYPE, and SITEID. After
WAHE WAGE, HOURS,
she entered data in it, which is as follows :
TYPE
SITEID
WID WNAME WAGE HOURS
200 Unskilled 103
wO1 Ahmed J 1500
100 Skilled 101
W11 Naveen 520
101
WO2 Unskilled
Jacob A 780 95
Semiskilled NULL
Nihal K 560 110
W10
Skilled 103
|Anju 1200 130
91 P.T.0.
Page 21 of 32
Based on the data given above, answer the
(a)
(i) Write the SQl statement to following questions
display the names and
hase workers whose Wages are between 800 and 1500 wages of
..Write the SQl. statement to display the record of workers
know.
whose SITEID is not
:y Wite the SQL. statement to display WNAME, WAGE and HOURS of
all those workers whose TYPE is Ski1led:
bv) Write the SQl. stutement to change the WAGE to 1200 of the
workers where the TYPE is "Semiskilled".
OR
Considering the above given table WORKER, write the output on
commands:
execution of the following SQL
SELECT WNAME, WAGE*HOURS FROM WORKER WHERE
SITED 103;
WORKER:
(ii) SELECT COUNT (DISTINCT TYPE) FROM
(iii) SELECT AX (WAGE), MIN (WAGE), TYPE FROM WORKER
GROUP BY TYPE:
FROM WORKER WHERE
(iv) SELECT WNAME, SITEID BY HOURS;
TYPE="Unskilled" ORDER

the records of putients in a hospital.


33. A csv file "P record. csv" contains
Each record of the file contains the following data :
Name of a patient
Disease
Number of days patient is admitted
Amount
For example, a sample record of the file may be :
["Gunjan","Jaundiç",4,15000) specificd operations
Write the following Python functions to perforn1 the
on this file:
data from the
Write a function read data () which reads all the
file and displavs the details of all the 'Cancer' putients. returns the
(iü) Write a function count rec () which counts and
number of records in the file.
91 P.T.0.
Page 23 of 32
working in the IT
Assume
Gallery that
(CAG),
you are
which sells different forms of art
Department
of
of a
creations Creative
Art
like Paintings.
34.
Sculptures etc. The data of Art Creations and Artists are kept in tables
Articles and Artists respectively. Following are few records ron
these two tables: 4x1=4
Table : Articles
CodeI Article I DOC Price
Code
Painting 2018-10-19 20000
PL001 A0001
A0004 | Sculpture 2021-01-15 16000
SC028
QLO05 ! A0003!Quilling 2024-04-24 ! 3000

Table : Artists

Email DOB
A Code Name Phone
----

595923 r@CrAG. com |1986-10-12 }


A0001 Roy
ghosh@CrAG. com! 1972-02-05
!A0002 Ghosh 1122334
[email protected] 1996-03-22
121212
A0003 Gargi j 2000-01-01 i
A0004 Mustafa 33333333 i [email protected]
contain mnany more records than shown here.
Note : The tables
of an Article.
" DOC is Date of Creation
to write the SQL queries for the
an employee
AsSan of CAG, you are required
following: from the Articles table in
descending
(i) 10 display all the records
order of price.
created m the y
T display the details of Articles which were
2020.
() To display the structure of Artists table.
whose Article is Paintsty
a To display the name of all artists
through Equi Join.
OR is 'Painting
(b) To display Artists whose Article i
the name of all
91
through Natural Join. P.T.0.
Page 25 of 32
table, named THEATRE. in CINEMA database, has the following structure
35. A 4

Field TYpe
char (5)
Th ID
varchar (15)
iName varchar (15)
City
Location varchar (15)
Seats
| int
Th ID from
wWeite a function Delete Theatre (), lo input the value of
corresponding record from the table
be user and permanently delete the
Python-Database connectivity:
Assume the following for
Password: Ex2025
Host : local host, User: root,

SECTION - E (2 x 5= 10)

PASSENGERS.DAT, stores the records of passengers using the


36. A ile,
following structure :
DESTN, FAREJ
(PNR, PName, BRDSTN,

where : type)
PNR Passenger Number (string
type)
PName Passenger Name (string
(string type)
BRDSTN Boarding Station Name
(string type)
DESTN Destination Station Name
journey (float type)
FARE Fare amount for the
following tasks :
Write user defined functions in Python for the binary
for passengers and write it in the
(i) Create () to input data
file PASSENGERS.DAT.
from the file PASSENGERSDA
eatchDestn (D) - to read contents matches
of those Passengers whose DESTN
splay the details
with the value ofD. by 5%
and
passengers
(i)) to increase the fare of
all
UpdateFare()-
wte the updated records into the file
PASSENGERS.DAT.
91 P.T.0.
Page 27 of 32
Swabhaav' is a
big NGO working in the field of
Nagpur.Psychol
It isogical Treat rnent
Head ofce
37 Counselling. having its in
up a center in
Vijayawada. "The
PSYCHIATRY.
Vijavawada Center will have four blocks -planning to set
ADMIN, PSYCHOLOGY, and ICU. You, as a
Expert. need to
suggst the best Network
network-related solutions for then
D h issues/problems mentioned in questions (i) to
to (v), keening the
following paranneters in mind
5x1=5
ADMIN
PSYCHOLOGY
Block Block
Vijayawada Center
PSYCHIATRY ICU
Block Block

Block to Block distances (in metres) :


From To Distance
ADMIN PSYCHIATRY 65 m
ADMIN PSYCHOLOGY 65 m
ADMIN ICU 65 m
PSYCHIATRY PSYCHOLOGY 100

PSYCHIATRY ICU 50 m

PSYCHOLOGY ICU 50 m
Distance of Nagpur Head Offee fron Viuvawada Center = 700 km
Number of Computers in each block is as tollows :
Block No. of Computers
ADMIN 16

PSYCHIATRY 4C

PSYCHOLOGY 19
TCU
20
91 P.T.0.
Page 29 of 32
of the server inside the
Suuggest the most apPpropriate location
choice.
(i)
Viiayawada Center. Justify your
hardware device will you suggest to connect all the
(ii)
Which Vijayawada Center 2
each block of
computers within
efficiently connect various blocks within the
Gii) Draw acable layout to
Vijayawada Center.
placed to provide internet to all the
be
iv) WVhere should the router
the Vijayawada Center ?
computers in access the computer
wants to remotely
at Nagpur be used for
(v) (a) The Manager Vijayawada. Which protocol will
in Admin block in
this ?
OR
LAN, MAN or WAN) will be set
(PAN,
(b) Which type of Network connected with Vijayawada Center?
computers
up among the

You might also like