ComputerScience SQP
ComputerScience SQP
General 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.
Page: 1/10
print(str.split("n"))
(A) ('I', 'ter', 'atio', 'al')
(B) ['I', 'ter', 'atio', 'al']
(C) ['I', 'n', 'ter', 'n', 'atio', 'n', 'al']
(D) Error
Page: 2/10
11. State whether the following statement is True or False:
The finally block in Python is executed only if no exception occurs in the (1)
try block.
13. Which SQL command can change the degree of an existing relation? (1)
15. In which datatype the value stored is padded with spaces to fit the specified
length.
(A) DATE
(1)
(B) VARCHAR
(C) FLOAT
(D) CHAR
16. Which aggregate function can be used to find the cardinality of a table?
(A) sum()
(B) count() (1)
(C) avg()
(D) max()
Page: 3/10
18. Which network device is used to connect two networks that use different
protocols?
(A) Modem
(1)
(B) Gateway
(C) Switch
(D) Repeater
19. Which switching technique breaks data into smaller packets for
transmission, allowing multiple packets to share the same network (1)
resources.
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): In the case of positional arguments, the function call and
function definition statements match in terms of the number
and order of arguments. (1)
Reasoning (R): During a function call, positional arguments should precede
keyword arguments in the argument list.
21. Assertion (A): A SELECT command in SQL can have both WHERE and
HAVING clauses.
(1)
Reasoning (R): WHERE and HAVING clauses are used to check
conditions, therefore, these can be used interchangeably.
Page: 4/10
B) Write a statement to sort the elements of list L1 in ascending order.
(II)
A) Write a statement to insert all the elements of L2 at the end of L1.
OR
B) Write a statement to reverse the elements of list L2.
25. Identify the correct output(s) of the following code. Also write the minimum
and the maximum possible values of the variable b.
import random
a="Wisdom"
b=random.randint(1,6)
(2)
for i in range(0,b,2):
print(a[i],end='#')
26. Give an example of a table which has one Primary key and two alternate
(2)
keys. How many Candidate keys will this table have?
27. (I)
A) What constraint should be applied on a table column so that
duplicate values are not allowed in that column, but NULL is
allowed.
OR
B) What constraint should be applied on a table column so that
NULL is not allowed in that column, but duplicate values are
allowed. (2)
(II)
A) Write an SQL command to remove the Primary Key constraint
from a table, named MOBILE. M_ID is the primary key of the
table.
OR
B) Write an SQL command to make the column M_ID the Primary
Key of an already existing table, named MOBILE.
Page: 5/10
Section-C ( 3 x 3 = 9 Marks)
29. A) Write a Python function that displays all the words containing @cmail from a
text file "Emails.txt".
OR (3)
B) Write a Python function that finds and displays all the words longer than 5
characters from a text file "Words.txt".
30. A) You have a stack named BooksStack that contains records of books. Each
book record is represented as a list containing book_title, author_name, and
publication_year.
Write the following user-defined functions in Python to perform the specified
operations on the stack BooksStack:
(I) push_book(BooksStack, new_book): This function takes the stack
BooksStack and a new book record new_book as arguments and pushes
the new book record onto the stack.
(II) pop_book(BooksStack): This function pops the topmost book record from
the stack and returns it. If the stack is already empty, the function should (3)
display "Underflow".
(III) peep(BookStack): This function displays the topmost element of the stack
without deleting it. If the stack is empty, the function should display 'None'.
OR
B) Write a Python program to input an integer and display all its prime factors in
descending order, using a stack. For example, if the input number is 2100, the
output should be: 7 5 5 3 2 2 (because prime factorization of 2100 is
7x5x5x3x2x2)
Hint: Smallest factor, other than 1, of any integer is guaranteed to be prime.
31. Consider the table ORDERS as given below, and write the following queries:
+------+----------+------------+----------+-------+
| O_Id | C_Name | Product | Quantity | Price |
+------+----------+------------+----------+-------+
| 1001 | Jitendra | Laptop | 1 | 12000 |
| 1002 | Mustafa | Smartphone | 2 | 10000 |
| 1003 | Dhwani | Headphone | 1 | 1500 |
|. |. |. | .| . |
|. |. |. | .| . |
|. |. |. | .| . | (3)
+------+----------+------------+----------+-------+
Note: The table contains many more records than shown here.
A)
(I) To display the total Quantity for each Product, excluding Products
with total Quantity less than 5.
(II) To display the orders table sorted by total price in descending order.
(III) To display the distinct customer names from the Orders table.
OR
Page: 6/10
B)
(I) To display the total number of orders quantity-wise.
(II) To delete all the orders where the Product is Laptop.
(III) Display the sum of Price of all the orders for which the quantity is null.
32. A)
I. When is ZeroDivisionError exception raised in Python?
II. Give an example code to handle ZeroDivisionError? The code
should display the message "Division by Zero is not allowed" in
case of ZeroDivisionError exception, and the message "Some
error occurred" in case of any other exception.
OR (4)
B)
I. When is NameError exception raised in Python?
II. Give an example code to handle NameError? The code should
display the message "Some name is not defined" in case of
NameError exception, and the message "Some error occurred" in
case of any other exception.
33. A csv file "Happiness.csv" contains the data of a survey. Each record of
the file contains the following data:
● Name of a country
● Population of the country
● Sample Size (Number of persons who participated in the survey in
that country)
● Happy (Number of persons who accepted that they were Happy) (4)
For example, a sample record of the file may be:
Signiland, 5673000, 5000, 3426
Write the following Python functions to perform the specified operations
on this file:
(I) Read all the data from the file and display all those records for
which the population is more than 5000000.
(II) Count the number of records in the file.
34. Saman has been entrusted with the management of Law University
Database. He needs to access some information from FACULTY and
COURSES tables for a survey analysis. Help him extract the following
information by writing the desired SQL queries as mentioned below. (4)
Table: FACULTY
F_ID FName LName Hire_Date Salary
Page: 7/10
102 Amit Mishra 12-10-1998 12000
103 Nitin Vyas 24-12-1994 8000
104 Rakshit Soni 18-5-2001 14000
105 Rashmi Malhotra 11-9-2004 11000
106 Sulekha Srivastava 5-6-2006 10000
Table: COURSES
C_ID F_ID CName Fees
C21 102 Grid Computing 40000
C22 106 System Design 16000
C23 104 Computer Security 8000
C24 106 Human Biology 15000
C25 102 Computer Network 20000
C26 105 Visual Basic 6000
(I) To display complete details (from both the tables) of those
Faculties whose salary is less than 12000.
(II) To display the details of courses whose fees is in the range of
20000 to 50000 (both values included).
(III) To increase the fees of all courses by 500 which have "Computer"
in their Course names.
(IV) (A) To display names (FName and LName) of faculty taking
System Design.
OR
(B) To display the Cartesian Product of these two tables.
Page: 8/10
Q.No. SECTION E (2 X 5 = 10 Marks) Marks
(5)
Page: 9/10
ADMIN DECORATORS 48 m
FOOD MEDIA 58 m
FOOD DECORATORS 46 m
MEDIA DECORATORS 42 m
Distance of Delhi Head Office from Mumbai Campus = 1500 km
Number of computers in each of the blocks/Center is as follows:
ADMIN 25
FOOD 18
MEDIA 30
DECORATORS 20
DELHI HEAD
OFFICE 18
(I) Suggest the most appropriate location of the server inside the
MUMBAI campus. Justify your choice.
(II) Which hardware device will you suggest to connect all the
computers within each building?
(III) Draw the cable layout to efficiently connect various buildings
within the MUMBAI campus. Which cable would you suggest
for the most efficient data transfer over the network?
(IV) Is there a requirement of a repeater in the given cable layout?
Why/ Why not?
(V) A) What would be your recommendation for enabling live
visual communication between the Admin Office at the
Mumbai campus and the DELHI Head Office from the following
options:
a) Video Conferencing
b) Email
c) Telephony
d) Instant Messaging
OR
B) What type of network (PAN, LAN, MAN, or WAN) will be set
up among the computers connected in the MUMBAI
campus?
Page: 10/10