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

CS_QP_SET-3

The document is a mock practice question paper for a Computer Science exam in 2025, consisting of 37 compulsory questions divided into five sections with varying marks. Each section tests different skills, including Python programming, SQL queries, and theoretical knowledge. The paper includes multiple-choice questions, programming tasks, and assertion-reasoning questions.

Uploaded by

daredevil09a
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)
23 views

CS_QP_SET-3

The document is a mock practice question paper for a Computer Science exam in 2025, consisting of 37 compulsory questions divided into five sections with varying marks. Each section tests different skills, including Python programming, SQL queries, and theoretical knowledge. The paper includes multiple-choice questions, programming tasks, and assertion-reasoning questions.

Uploaded by

daredevil09a
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

MOCK PRACTICE 2025

CS (SET-3)
Instructions:

• This question paper contains 37 questions.


• 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.

Q.No SECTION-A (21 x 1 = 21 MARKS) Marks


1 State True or False 1
Variable declaration is implicit in python.

2 Predict the output of the following code snippet 1


Marks = { ‘Manoj’: 92, ‘Suresh’: 79, ‘Vaibhav’:88 }
print ( list( marks.keys( ) ) )
a. ‘Manoj’ , ’Suresh’, ‘Vaibhav’
b. 92, 79, 88
c. [‘Manoj’, ‘Suresh’, ‘Vaibhav’]
d. (‘Manoj’, ‘Suresh’, ‘Vaibhav’)
3 Write the output of the following python expression: 1
print ( (20 >25) and (5==5 ) or ( 18 < 12) )

4 Find the output of the following code snippet 1


S=9, (2, 13, 8), 5, (1, 6)
print ( len (S) )
a. 4
b. 7
c. 6
d. Error
5 Select the correct output of the code: 1
a=’assistance’
a=a.partition(‘a’)
b=a[0] + ‘-‘ + a[1] + ‘-‘ + a[2]
print(b)

Page 1 of 12
a. -a-ssistance
b. -a-ssist-nce
c. a-ssist-nce
d. -a-ssist-ance

6 Which of the following operations on a string will generate an error ? 1


a. ‘python’ * 2
b. ‘python’ + 2
c. ‘python’ + ’2’
d. ‘python’ + ’python’

7 Identify the invalid statement for list L=[1,2,3,4] 1


a. L.remove(3)
b. L.pop(3)
c. L.del(3)
d. del L[3]

8 Write a python dictionary named record with keys 12101, 12102, 12103 and 1
corresponding values as ‘krishna’ , ’prarabdh’ , ’shorya’ respectively.

9 Which of the following types of table constraints will prevent the entry of 1
duplicate rows and NULL value?
a. unique
b. distinct
c. not null
d. primary key

10 Consider the Python statement: f.seek(10, 1) 1


Choose the correct statement from the following:
a. file pointer will move 10 byte in forward direction from beginning
of the file.
b. file pointer will move 10 byte in forward direction from end of the file.
c. file pointer will move 10 byte in forward direction from current location.
d. file pointer will move 10 byte in backward direction from current location.

11 What will be the output of the following code snippet. 1


def divide(a,b):
try:
result=a/b
except ZeroDivisionError:

Page 2 of 12
print('You Cannot divide by zero')
except ValueError:
print('Invalid Input')
except:
print('An error occurred')
finally:
print('The end of the program')
divide(10,0)
a. You Cannot divide by zero
Invalid Input
An error occurred
The end of the program
b. You Cannot divide by zero
Invalid Input
The End of the program
c. You Cannot divide by zero
An error occurred
The end of the program
d. You Cannot divide by zero
The end of the program

12 Consider the code given below and find correct output: 1


x=5
def function1( ):
global x
y=x+x*2
print(y, end=”,”)
x=7
function1()
print(x)
Output:
a. 21 , 7 b. 15 , 5
c. 21 , 5 d. 15, 7

Page 3 of 12
1
13
A table has initially 5 columns and 8 rows. Consider the following sequence of
operations performed on the table –
i. 8 rows are added
ii. 2 columns are added
iii. 3 rows are deleted
iv. 1 column is added
What will be the cardinality and degree of the table at the end of above
operations?
a. 8,13 b. 13,8 c. 14,5 d. 5,8

14 Which statement in MySql will display all the tables in a database? 1


a. SELECT * FROM TABLES;
b. USE TABLES;
c. DESCRIBE TABLES;
d. SHOW TABLES;

15 Fill in the blank: 1


_________________command is used to remove the tuple from the table in
SQL.
a. del b. delete
c. alter d. remove

16 GROUP BY clause is used to sort data 1


a. In ascending order
b. In descending order
c. Both A & B
d. None of the Above

17 Which is the smallest network? 1


a. WAN b. LAN
c. MAN d. PAN

18 MAC address is assigned to the 1


a. Router b. Switch
c. NIC Card d. Graphic Card

19 For communication, data in a network is divided into smaller chunks 1


called_____________________________
a. packets b. parcels
c. photons d. slice

Page 4 of 12
Q20 and 21 are ASSERTION AND REASONING 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):- If the arguments in a function call statement match the number 1
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).

21 Assertion (A): In SQL, the aggregate function avg() calculates the average value 1
on a set of values and produces a single result.
Reason (R): The aggregate functions are used to perform some fundamental
arithmetic tasks such as min(), max(), sum() etc

Q.No SECTION – B ( 7 * 2 = 14 Marks) Marks

22 Identify the data type of each of the following values. 2


a. True
b. ‘ True ’
c. 10/2
d. 10 % 2

23 Predict the output for the following python snippet 2


def calc (p , q = 3 ):
ans=1
for x in range ( q ) :
ans=ans*p
return ans
print(calc(3) )
print(calc(3,2) )

24 A. Write the python statement for each of the following tasks using BUILT-IN 2
functions/methods only:
1. To check whether all the characters in the string S1 are digits or not.
2. To delete the elements from index no 3 to 7 in the list L1.
OR

Page 5 of 12
B. Consider the following list exam and write python built in function for the
following questions
Exam=[‘hindi’,’english’,’maths’,’science’]
1. To insert subject ‘computer science’ as last element.
2. To sort the list in reverse alphabetical order.

25 What possible outputs(s) are expected to be displayed on screen at the time of 2


execution of the program from the following code? Also specify the maximum
AND minimum values that can be assigned to the variable Num when P = 7.
import random as r
val = 35
P=7
Num = 0
for i in range(1, 5):
Num = val + r.randint(0, P - 1)
print(Num, " $ ", end = "")
P=P-1
(a) 41 $ 38 $ 38 $ 37 $
(b) 38 $ 40 $ 37 $ 34 $
(c) 36 $ 35 $ 42 $ 37 $
(d) 40 $ 37 $ 39 $ 35 $

26 Rewrite the following Python program after removing all the syntactical errors 2
(if any), underlining each correction:
def checkval:
x = input("Enter a number")
if x % 2 =0:
print (x, "is even")
elseif x<0:
print (x, "should be positive")
else:
print (x, "is odd")

Page 6 of 12
27 2
1. In a database there is a table cabinet. The data entry operator is not able
to put NULL in a column of cabinet? what may be the possible reason(s)?
2. In a database there is a table cabinet. The data entry operator is not able
to insert duplicate values in a column of cabinet ? what may be the
possible reason(s)?
OR
1. There is a column C1 in a table T1. The following two statements
Select count(*) from T1; and Select count(C1) from T1;
Are giving different outputs. What may be the possible reason?
2. How are NULL values treated by aggregate functions?

28 A. Write the full form of the following: 2


1. POP 2. HTTPS
B. how is hub different from switch
OR
A. Write the full form of following
1. VoIP 2. FTP
B. define the term protocol with respect to networks.

Q.No SECTION – C ( 3 * 3 = 9 Marks) Marks

29 Write a function Show_words( ) in python to read the content of a text file 3


‘NOTES.TXT” and display the entire content in capital letters. Example if the file
contains:
“This is a test file”
Then the function should display the output as:
THIS IS A TEST FILE
OR
Write a user defined function read_story( )in python that displays the words that
ends with the character ‘H’ or ‘h’ in the text file ‘story.txt’

30 Mr.Ajay has created a list of elements. Help him to write a program in python with 3
functions, PushEl(element) and PopEl() to add a new element and delete an
element from a List of elements, considering them to act as push and pop
operations of the Stack data structure. Push the element into the stack only when
the element is divisible by 4.
For eg:if L=[2,5,6,8,24,32]
then stack content will be 32 24 8

Page 7 of 12
OR
Tushar received a message(string) that has uppercase and lowercase letters. He
wants to extract all the upper case letters from the string and push them into a
stack. Help him to do this task by performing the following user defined functions
in python.
a. Push the uppercase alphabets of the string into a stack.
b. Pop and display the content of the stack. Once the stack is empty it should
display the message ‘End of Stack’
For example: If the message is
“All the Best for your Pre-Board Examination”
The output should be: EBPBA
End of Stack

31 Find & write the output of the following python code: 3


def makeNew(mystr):
newstr=’’
count=0
for i in mystr:
if count%2 != 0:
newstr=newstr+str(count)
else:
if i.islower():
newstr=newstr+i.upper()
else:
newstr=newstr+i
count+=1
newstr=newstr+mystr[:1]
print(‘The new string is : ‘, newstr)
makenew(‘sTUdeNT’)
OR
s="PREboardCS*2024!"
j=2
for i in s.split('*'):
k=i[:j]
if k.isupper():
j=j+1
elif k.isdigit():

Page 8 of 12
j=j+2
else:
j=j+3
print(s [ j : : j ] )

Q.No SECTION – D ( 4 * 4 = 16 Marks) Marks


32 (Write a output for SQL queries (i) to (iii), which are based on the table: 4
SCHOOL and ADMIN given below:

A. Write the following queries


B. Write the output

Write the output:


a. select sum(periods), subject from school group by subject ;
b. select teachername, gender from school, admin where
designation=’coordinator’ and school.code=admin.code;
c. select count(distinct subject) from school
d. select * from school where periods between 24 and 27.
OR
Write the query:
a. Display the subject wise total no of teachers.
b. Display the name and experience of teachers whose name starts from ‘P’
and ends on ‘I’
c. Add the following record in the school table
(1743, ‘Manoj’, ‘Computer Science’, 10/05/2004, 20, 6)
d. Display the subject and HOD of all departments.

33 A csv file events.csv contains the details of events organized by firm M/s 4
MakeMyEvents. Each record of the file contains the following data
Id of the Event

Page 9 of 12
Event description
Venue of the event
Total No of Guest invited
Total cost of organizing the event
Write the following functions in Python to perform the specific operations on this
file :
(i) Search( ) – To display the details of those events having more than
1000 guests.
(ii) CountR( ) – To calculate and display the average cost of event.
• Assume the first row of the file event.csv have headers
For example
Event_id Description Venue Guests Cost
1001 Birthday BigBites 250 150000
1002 Marriage RajMandir 1100 1250000

34 Consider the tables given below. 4


Table : STOCK
Itcode Itname Dcode Qty UnitPrc StkDate
444 Drawing Copy 101 10 21 31-June-2009
445 Sharpener Camlin 102 25 13 21-Apr-2010
450 Eraser Natraj 101 40 6 11-Dec-2010
452 Gel Pen Montex 103 80 10 03-Jan-2010
457 Geometry Box 101 65 65 15-Nov-2009
467 Parker Premium 102 40 109 27-Oct-2009
469 Office File 103 27 34 13-Sep-2010

Table : DEALERS
Dcode Dname Location
101 Vikash Stationers Lanka Varanasi
102 Bharat Drawing Emporium Luxa Varanasi
103 Banaras Books Corporation Bansphatak Varanasi

a. To display all the information about items containing the word “pen” in the
field Itname in the table STOCK.
b. List all the itname sold by Vikash Stationers.
c. List all the Itname and StkDate in ascending order of StkDate.

Page 10 of 12
d. List all the Itname, Qty and Dname for all the items for the items quantity
more than 40.
OR

e. List all the details of the items for which UnitPrc is more than 10
and <= 50.
35 Virat has created a table named TRAVELS in MySQL: 4
The fields of the table are
Tour_id-string
Destination – string
Geo_Cond=string
Distance-integer(In KM)
Note the following to establish connectivity between Python & MySQL :
UserName = root
Password=bharat
The table TRAVELS exists in a MYSQL database named TOUR.
Virat wants to display All records of TRAVELS relation whose Geographical
condition is hilly area and distance less than 1000 KM. Help Virat to write
program in python

Q.No SECTION – E ( 2 * 5 = 10 Marks) Marks

36 Vedansh is a Python programmer working in a school. For the Annual Sports 5


Event, he has to created a binary file ‘Result.dat’ with Student_Id, St_Name,
Game_Name and Result to store the results of students in different sports
events. As a python expert help Vedansh to.
1. Write a function to input the details of all the participants in the binary file
Result.dat.
2. display the records of those students who won the game, which is
inserted in the Result field with ‘Won’ and ‘Loss’ data.

37 TCS decided to open a new AI innovation center at Delhi. The center consists 5
of Five Buildings and each contains number of computers. The details are
shown below.

Building-2
Building-1 Building-3

Building-5 Building-4

Page 11 of 12
Distance between the buildings
Building No of computers
Building 1 and 2 20 Meters
1 40
Building 2 and 3 50 Meters
2 45
Building 3 and 4 120 Meters
3 110
Building 3 and 5 70 Meters
4 70
Building 1 and 5 65 Meters
5 60
Building 2 and 5 50 Meters

Computers in each building are networked but buildings are not networked so
far. The Company has now decided to connect building also.
I. Suggest a cable layout for connecting the buildings
II. Do you think anywhere Repeaters required in the campus? Why
III. The company wants to link this office to their head office at Mumbai
a. Which type of transmission medium is appropriate for such link?
b. What type of network would this connection result into?
IV. Where server is to be installed? Why?
V. Suggest the wired Transmission Media used to connect all buildings
efficiently.
OR
Which device will you suggest to be placed/installed in each of these buildings to
efficiently connect all the computers within these buildings.

----All The Best ----

Page 12 of 12

You might also like