CS-QP-2
CS-QP-2
CS-QP-2
Page: 1/10
6. What will be the output of the following code?
tuple1 = (1, 2, 3) tuple2 = tuple1
tuple1 += (4,)
print(tuple1 == tuple2)
(A) True (B) False (C) tuple1 (D) Error (1)
7. If my_dict is a dictionary as defined below, then which of the following
statements will raise an exception?
my_dict = {'apple': 10, 'banana': 20, 'orange': 30}
(A) my_dict.get('orange') (1)
(B) print(my_dict['apple', 'banana'])
(C) my_dict['apple']=20
(D) print(str(my_dict))
The statement which is used to get the number of rows fetched by execute() method
8.
of cursor:
(A) cursor.rowcount (B) cursor.countrows() (1)
(C) cursor.allrows() (D) cursor.countrows()
9. If a table which has one Primary key and two alternate keys. How many Candidate
(1)
keys will this table have?
(A) 1 (B) 2 (C) 3 (D) 4
Page: 2/10
14. What will be the output of the query?
SELECT * FROM products WHERE product_name LIKE 'App%';
(A) Details of all products whose names start with 'App'
(B) Details of all products whose names end with 'App' (1)
(C) Names of all products whose names start with 'App'
(D) Names of all products whose names end with 'App'
15. In which datatype the value stored is padded with spaces to fit the specified length.
(1)
(A) DATE (B) VARCHAR (C ) FLOAT (D) CHAR
Which aggregate function can be used to find the cardinality of a table? (1)
16.
(A) sum() (B) count() (C ) avg() (D) max()
17. Which protocol is NOT used to transfer mails over the Internet?
(1)
(A) SMTP (B) IMAP (C) FTP (D) POP3
18. A _________ is a network device that amplifies and restores the signals for long
distance communications.
(1)
(A) Repeater (B) Hub (C) Switch (D) Router
20. Assertion (A): If the arguments in the function call statement match the number
and order of arguments as defined in the function definition, such arguments are
(1)
called positional arguments.
Reasoning (R): During a function call, the argument list first contains default
argument(s) followed by the positional argument(s).
21. Assertion (A): A SELECT command in SQL can have both WHERE and HAVING clauses.
Reasoning (R): WHERE and HAVING clauses are used to check conditions,
(1)
therefore, these can be used interchangeably.
Q No Section-B ( 7 x 2=14 Marks) Marks
23. (i) Which out of the following operators will NOT work with a string? + , -, *, not
(2)
(ii) What will be the output of the following expression?
myTuple = ("John", "Peter", "Vicky")
Page: 3/10
x = "#".join(myTuple)
print(x)
(II) (1)
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. What possible outputs(s) will be obtained when the following code is executed? What
is the possible minimum and maximum value x can take?
import random
x = random.randint (1,3)
Options are:
a) KDML#PURI#BBSR#CTC# b) KDML#KDML#PURI#PURI#
c) BBSR#KDML#BBSR#KDML# d) All of these 3 options are possible
The given Python code to print all Prime numbers in an interval (range) inclusively.
26.
The given code accepts 02 number (low & high) as arguments for the function (2)
Prime_Series() and return the list of prime numbers between those two numbers
inclusively. Observe the following code carefully and rewrite it after removing all
syntax and logical errors. Underline all the corrections made.
Def Prime_Series(low, high)
primes = [ ]
for i in range(low, high + 1):
flag = 0
if i < 2:
continue
if i == 2:
primes.append(2)
continue
for x in range(2, i):
Page: 4/10
if i % x == 0:
flag = 1
continue
if flag == 0:
primes.append(x)
returns prime
low=int(input("Lower range value: "))
high=int(input("High range value: ")
print(Prime_Series())
27. (I)
A) What constraint should be applied on a table column so that duplicate (2)
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?
(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.
28. A) List any two difference between Star topology and Bus topology.
OR (2)
B) Expand the term TCP/IP. What is the significance of a Gateway in a network with
traffic?
29. A) Write a Python function that displays all the words containing “@gov”
from a text file "Email.txt".
OR (3)
B) Write a Python function that finds and displays all the words smaller than 6
characters from a text file "Friends.txt".
Page: 5/10
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
display "Underflow".
(III) peep(BookStack): This function displays the topmost element of the (3)
stack without deleting it. If the stack is empty, the function should
display 'None'.
OR
(B) A dictionary, StudRec, contains the records of students in the following
pattern:
{admno: [m1, m2, m3, m4, m5]} , i.e., Admission No. (admno) as the key and 5
subject marks in the list as the value.
Each of these records is nested together to form a nested dictionary. Write the
following user-defined functions in the Python code to perform the specified
operations on the stack named BRIGHT.
(i) Push_Bright(StudRec): it takes the nested dictionary as an argument and
pushes a list of dictionary objects or elements containing data as {admno: total
(sum of 5 subject marks)} into the stack named BRIGHT of those students with a
total mark >350.
(ii) Pop_Bright(): It pops the dictionary objects from the stack and displays them.
Also, the function should display “Stack is Empty” when there are no elements in
the stack.
For Example: if the nested dictionary StudRec contains the following data:
StudRec={101:[80,90,80,70,90], 102:[50,60,45,50,40], 103:[90,90,99,98,90]}
Thes Stack BRIGHT Should contain: [{101: 410}, {103: 467}]
The Output Should be:
{103: 467}
{101: 410}
If the stack BRIGHT is empty then display: Stack is Empty
Page: 6/10
31. Predict the output of the following code:
str1 = ""
for key in d:
str1 = str1 + str(d[key]) + "@" + “\n”
str2 = str1[:-1]
print(str2) (3)
OR
line=[4,9,12,6,20]
for I in line:
for j in range(1,I%5):
print(j,’#’,end=””)
print()
Q No. Section-D ( 4 x 4 = 16 Marks) Marks
Page: 7/10
33. Mr. Snehant is a software engineer working at TCS. He has been assigned to develop
code for stock management; he has to create a CSV file named stock.csv to store the
stock details of different products.The structure of stock.csv is : [stockno, sname,
price, qty], where stockno is the stock serial number (int), sname is the stock name
(string), price is stock price (float) and qty is quantity of stock(int).
Mr. Snehant wants to maintain the stock data properly, for which he wants to write
the following user-defined functions:
(4)
(I) AcceptStock() – to accept a record from the user and append it to the file stock.csv.
The column headings should also be added on top of the csv file. The number of
records to be entered until the user chooses ‘Y’ / ‘Yes’.
(II) StockReport() – to read and display the stockno, stock name, price, qty and value of
each stock as price*qty. As a Python expert, help him complete the task.
Page: 8/10
35. A table, named STATIONERY, in ITEMDB database, has the following structure:
Field Type
itemNo int(11)
itemName Varchar(15)
Price Float
Qty Int(11)
(4)
Write the following Python function to perform the specified operation:
AddAndDisplay(): To input details of an item and store it in the table STATIONERY.
The function should then retrieve and display all records from the STATIONERY table
where the Price is greater than 120.
Page: 9/10
Distance between various block and locations:
BLOCK DISTANCE
Development to Admin 28 m
Development to Training 105 m
Admin to Training 32 m
Surajpur campus to Coimbatore campus 340 km
Number of Computers
BLOCK Number of Computers
Development 90
Admin 40
Training 50
(i) Suggest the most appropriate block/location to house the SERVER in the Surajpur
center (out of the 3 blocks) to get the best and effective connectivity. Justify your
answer.
(ii) Suggest why should a firewall be installed at the Surajpur Center?
(iii) Suggest the best wired medium and draw the cable layout (Block to Block) to
most efficiently connect various blocks within the Surajpur Center.
(iv) Suggest the placement of the following devices with appropriate reasons:
a) Switch/Hub b) Router
(v)
(A) Suggest the best possible way to provide wireless connectivity between Surajpur
Center and Raipur Center.
OR
(B) What type of network (PAN, LAN, MAN, or WAN) will be set up among the
computers connected in the SURAJPUR campus?
Page: 10/10