Roll No………………………………… Series JPR_PB/25-26/12/083/9
NOTE:-
- Please check that this question paper contains 7 printed pages.
- Please check that this question paper contains 37 questions.
- Please write down the serial number of the question in the answer-book before attempting it.
- 15 minutes time has been allotted to read the question paper. Students will read question paper
only and will not write any answer on the answer-book during this period.
Computer Science (083)
Time allowed: 3 Hours Maximum Marks: 70
General Instructions:
• 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 Section A (21x1 = 21 marks) Marks
No.
1 Identify the possible output of the following python statements 1
import random
for n in range(2,5,2):
print([Link](1,n,end=’*’)
a)1*3* b) 1*4* c) 1*3*4 d)2*3*
2 What will be the output of the following python statement? 1
L=[3,6,9,12]
L=L+15
print(L)
a) [3,6,9,12,15] b) [18,21,24,27 c) [5,3,6,9,12,15] d) error
3 Consider the given expression: 1
print(7%5==2 and 4%2>0 or 15//2==7.5)
Which of the following will be correct output for the given expression?
a) True b) False c) None d) Null
4 A relation can have only one ______ key and one or more than one ______ keys. 1
a) CANDIDATE, ALTERNATE b) CANDIDATE, PRIMARY
c) PRIMARY, CANDIDATE d) ALTERNATE, CANDIDATE
5 Select the correct output of the code: 1
s = "Question paper 2022-23"
s= [Link]('2')
print(s)
a) ['Question paper ', '0', '', '-', '3'] b) ('Question paper ', '0', '', '-', '3')
c) ['Question paper ', '0', '2', '', '-', '3'] d) ('Question paper ', '0', '2', '', '-', '3')
6 Identify the output of the following python code: 1
D = {1:"one",2:"two", 3:"three"}
L=[]
for k,v in [Link]():
if 'o' in v:
[Link](k)
print(L)
a) [1,3] b) [2,3] c) [1,2] d) [3,1]
7 Identify the output of the following python statement: 1
print(15-3**2**2+84/12)
8 Consider the given SQL Query: 1
SELECT city, COUNT(*) FROM customers
HAVING COUNT(*) > 10 GROUP BY city;
Ritwik is executing this query but not getting correct output. Help him to correct
the query.
9 Which of the following statement(s) would give an error during execution of 1
following code?
s = ‘This is a good day!!’
print(s) #Statement 1
print(s[0]+ ‘O’ ) #Statement 2
s[0] = ‘n’ #Statement 3
print(max(s)) #Statement 4
a) Statement 1 b) Statement 2 c) Statement 3 d) Statement 4
10 Select the correct output of the following python code: 1
st = "Python functions are fun to learn"
t = [Link]("fun")
print(t)
a) ('Python ', '', 'functions are fun to learn')
b) ('Python functions are ', 'fun', ' to learn')
c) ('Python ', 'functions', ' are fun to learn')
d) ('Python ', 'fun', 'ctions are fun to learn')
11 What is the minimum, maximum value that can be obtained by the variable 1
lottery when the following code is executed?
import random
seed = [Link]()
lottery = seed + [Link](1,3)
a) 1, 3.9999 b) 1, 4 c) 0, 3.9999 d) 0, 2.9999
12 A void function returns a __________ value to its caller. 1
a) 0 b) Nothing c) Null d) None
13 Predict the output produced by the following SQL query: 1
SELECT INSTR("WELLINGTON",SUBSTR("By Studying we become
smart",9,3));
a) “ING” b) “WELL” c) 5 d) 4
14 Which of the following will delete key-value pair for key = “Red” from a dictionary 1
D1?
a) delete D1("Red") b) del D1["Red"]
c) del.D1["Red"] d) [Link]["Red"]
15 In MYSQL database, if a table T1 has degree d1 and cardinality c1 and another 1
table T2 has degree d2 and cardinality c2 what will be the degree and cardinality
of the Cartesian product of both table?
a) d1*d2, c1+c2 b) d1+c1, d2+c2 c) d1+d2, c1*c2 d) d1*c1, d2+c2
16 The ____________command can be used to makes changes in the rows of a 1
table in SQL.
a) insert b) alter c) create d) update
17 Fill in the blank: 1
In case of _______ switching, bandwidth is reserved from source to destination.
18 Network device which sends the data over optimizing paths through connected 1
hops is:
a) Hub b) Router c) Repeater d) Gateway
19 Fill in the blank: 1
A _____ establishes connection between various networks / sub-networks while a
______ establishes connection between various networking devices.
a) Router, Switch b) Switch, Router
c) Modem, Hub d) Gateway, repeater
Q20 and Q21 are Assertion(A) and Reason(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): For a tuple object t, t[0]=(1) will result in error but t=(1,) will not. 1
Reason (R): When an attempt is made to update the value of an immutable
variable, the old variable is destroyed and a new variable is created by the same name in
memory.
21 Assertion (A): The PRIMARY KEY and UNIQUE Constraint are the same. 1
Reason (R): The columns with PRIMARY KEY or UNIQUE Constraint have unique values
for each row.
Q Section B (7x2 = 14 marks) Marks
No
22 Explain the difference between title() and capitalize() functions of python with 2
reference to strings. Give suitable example as well.
OR
Explain the difference between append() and extend() functions of python with
reference to lists. Provide suitable examples.
23 The code provided below is intended to remove the first and last characters of a 2
given string and return the resulting string. However, there are syntax and logical
errors in the code. Rewrite it after removing all the errors. Also, underline all the
corrections made.
define removeFirstLast(str):
if len(str) < 2:
return str
newstr = str[1:-2]
return newstr
result = removeFirstLast("Hello")
Print("Resulting string: " result)
24 A. (Answer using Python built-in methods/functions only) 2
1. Check if a string S contains no digits and no special symbols.
2. To remove the second element from a list L.
OR
B. Predict the output of the following python code:
L = [2, 5, 7, 3, 1, 89]
[Link](2,9)
print(L)
[Link](5)
print(L)
25 Write a Python program with a function UNIQUE_LIST() that accepts a list of 2
integers and returns a list with only the elements that appear exactly once.
Example
Input: [10, 20, 10, 30, 40, 40, 50]
Output: [20, 30, 50]
OR
Write a python program to accept a list of integers and count the frequency of
each integer using dictionary and print the integer and its frequency.
26 Consider the python code: 2
data = {'x':1, 'y':2, 'z':3}
sum_val = 0
for k in data:
sum_val += [Link](k) + len(k)
print(sum_val)
What will be the output of this program?
27 Differentiate between WHERE clause and HAVING clause in SQL. 2
OR
Differentiate between count() and count(*) functions of SQL with suitable
examples.
28 A. Define the following terms: 2
I. Router
II. Repeater
OR
B. Differentiate between static web page and dynamic web page.
Q Section C (3x3 = 9 marks) Marks
No
29 A. Write a Python program to read file [Link] and count: 3
Total number of vowels
Total number of consonants
OR
B. Write a Python program to read file [Link] and count:
Count of upper case letters
Count of lower case letter
Count of numbers(0-9)
30 A list of numbers is used to populate the contents of a stack using a function 3
push(stack,data) where stack is an empty list and data is the list of numbers. The
function should push all the numbers that are even to the stack.
Also write the function pop(stack) that removes and returns the top element of the
stack on its each call.
Also write the function calls.
31 A. Predict output of following python code: 3
expr = "562*+4-"
stack = [ ]
for ch in expr:
if [Link]():
[Link](int(ch))
else:
a = [Link]()
b = [Link]()
if ch == '+':
[Link](b + a)
elif ch == '*':
[Link](b * a)
elif ch == '-':
[Link](b - a)
print(stack[0]) OR
B. Predict the output of the following Python code:
wildlife_sanctuary = ["Kaziranga", "Ranthambhore", "Jim Corbett", "Sundarbans",
"Periyar", "Gir", "Bandipur"]
output = [ ]
for sanctuary in wildlife_sanctuary:
if sanctuary[-1] in 'aeiou':
[Link](sanctuary[0].upper())
print(output)
Q Section D (4x4 = 16 marks) Marks
No
32 Consider the table EMPL given below: 4
A. Write SQL query for (i) to (iv) statements given below:
(i) To display department wise maximum and minimum salary.
(ii) To display Name and Job of those employees whose name contains the letter
‘a’.
(iii) To display number of employees working in each department, such that only
departments with more than 3 employees are displayed.
(iv) To display record of employees of HR department who are Vice President.
OR
B. Write output of the SQL queries (i) to (iv) based on the above table EMPL:
(i) SELECT ename, dept FROM EMPL where ename like “_a%”;
(ii) SELECT id, ename, addr FROM EMPL where job in (‘VP’, ‘Clerk’);
(iii) SELECT DISTINCT dept FROM EMPL;
(iv) SELECTAVG(sal) FROM EMPL WHERE job = ‘Salesman’;
33 A. What is the advantage of using a csv file for permanent storage? 4
B. Write a Program in Python that defines and calls the following user defined
functions:
(i) ADD() – To accept and add data of an employee to a CSV file
‘[Link]’. Each record consists of a list with field elements as empid,
name and mobile to store employee id, employee name and employee
salary respectively.
(ii) (ii) COUNTR() – To count the number of records present in the CSV file
named ‘[Link]’.
34 Write SQL Queries for (i) to (iv) based on the tables PASSANGER and FLIGHT 4
Table: PASSENGER
PNO NAME GENDER FNO
1001 RAHUL MALE F101
1002 SONIYA FEMALE F104
1003 NILESH MALE F102
1004 HARSHITA FEMALE F103
Table: FLIGHT
FNO ORIGIN DESTINATION F_DATE FARE
F101 DELHI MUMBAI 2025-12-21 4300
F102 JAIPUR MUMBAI 2025-11-20 4800
F103 DELHI JAIPUR 2025-11-04 5500
F104 MUMBAI GOA 2025-10-25 4500
F105 MUMBAI JAIPUR 2025-11-01 4000
(i) Write query to change fare of flight from MUMBAI to GOA to 6000.
(ii) To delete all flight details which have travel before 2025-11-04.
(iii) To display Name of passengers and origin of flight for passengers who are
travelling to MUMBAI.
(iv) A. To display passenger name along with their travel date and fare.
OR(Only for part iv)
B. To display the cross join of both the tables.
35 A MySQL database named ‘Hogwarts’ has a table ‘WIZARDS’ with the following 4
attributes:
W_code : String
W_name : String
Power : Integer
House : String
Consider the following details to establish Python–MySQL connectivity:
Username: hogwarts_admin
Password: Alohomora@394
Host: localhost
Write a Python program to increase the magical power of all the wizards who
belong to the house “Gryffindor” by 10% in the WIZARDS table.
Q Section E (2x5 = 10 marks) Marks
No
36 A binary file “[Link]” has structure [Book_No, Book_Name, Author, Price].
(i) Write a user defined function CreateFile() to input data for a record and 2
add to [Link] +
(ii) Write a function CountRec(Author) in python, which accepts the Author 3
Name as a parameter and counts and returns number of books by the
given author name.
37 Superior Education Society is an educational Organization. It is planning to setup 5
its Campus at Nagpur with its head office at Mumbai. The Nagpur Campus has 4
main buildings – ADMIN, COMMERCE, ARTS and SCIENCE.
You as a network expert have to suggest the best network related solutions for
their problems raised in (a) to (e), keeping in mind the distances between the
buildings and other given parameters:
Shortest distances between various buildings:
ADMIN to COMMERCE - 55 m
ADMIN to ARTS - 90 m
ADMIN to SCIENCE - 50 m
COMERCE to ARTS - 55 m
COMMERCE to SCIENCE - 50 m
ARTS to SCIENCE - 45 m
MUMBAI Head Office to NAGPUR Campus – 850 KM
Number of Computers installed at various buildings are as follows:
ADMIN – 110
COMMERCE – 75
ARTS – 40
SCIENCE – 12
MUMBAI Head Office – 20
a) Suggest the most appropriate location of the server inside the Nagpur Campus
to get the best connectivity for maximum number of computers. Justify your
answer.
b) Suggest and draw the cable layout to efficiently connect various buildings within
the Nagpur campus for connecting the computers.
c) What technology/measures will you suggest to establish online face-to-face
communication between the ADMIN office of Nagpur Campus and Mumbai Head
office?
d) Suggest the placement of following devices with appropriate reasons:
i. Switch/Hub
ii. Repeater
e)
(i)Suggest the device/software to be installed in Nagpur Campus to take care of
data security and unauthorized access.
(ii) Which type of network (PAN , LAN,MAN or WAN) will be formed while
connecting the Mumbai headoffice and Nagpur campus ?