XIIComp SC S E 476
XIIComp SC S E 476
General Instructions:
Section A
6. Which of the following methods is used to add an element to the end of a list in
Python?
print(my_list[2:4])
result=my_dict.get(‘b’,0)
print(result)
a) 1 b) 2 c) 3 d) 0
10. What function is used to read the entire contents of a file as a string in Python?
d) It opens the file in append mode for reading, writing, and creating
13. What is the purpose of the try block in Python error handling?
Reason® : A function is a module is used to simplify the code and avoids repetition.
21. Assertion(A) :A database is centrally stored data and a DBMS is a system to manage
the database.
Reason® :DBMS is a database management system, which is a software managing
the databases.
Section B
22. List out any two differences between list and dictionary?
import random
List=[‘apple’,’orange’,’kiwi’,’grapes’]
for i in range(4):
x=random.randint(1,3)
print(List[x],end=’#’)
a. apple#orange#kiwi#grapes# c. orange#kiwi#grapes#orange#
b. orange#orange#orange#apple# d. orange#orange#kiwi#orange#
26. The code provided below is intended tofind the sum of te didits of a number. However,
there are syntax and logical errors in the code. Rewrite it after removing all errors.
Underline all the corrections made.
def sum_digits(x):
sum=1
while x>=0:
sum+=x%10
x=x/10
print(“the sum of the digit of a number is:”sum)
n=input(“enter the number”)
sum_digits(n)
27. A. Which constraints ensure that that all values in a column are different
B. Which constraints is a combination of a NOT NULL and UNIQUE
C. Write an sql command to add a columns gender with data type char(5) into the table
employee
D. Write an sql command to delete the details of employee whose name ends with ‘i’
Section C
29. Write a python function display_words() that display all the words that contain a
substring ‘is’ from the file data.txt
30. You have a stack named Car that contains records of cars. Each book record is
represented as a list containing car_name,company_name,model and price. Write the
following user-defined functions in Python to perform the specified operations on the
stack Car:
(I) push_car(): This function pushes the car_name and model of the cars ,which
company is Hundai or Suzuki into stack Car.
(II) pop_book(): This function pops the topmost car 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 stack without
deleting it. If the stack is empty, the function should display 'None'
A. l=[30,24,56,78,75,80,93]
for i in l:
if i%10==0:
x+=i//5
elif i%5==0:
y+=i*2
else:
z+=i*3
print(x,y,z)
OR
B. my_dict={}
my_dict[(1,2,4)]=8
my_dict[(4,2,1)]=10
my_dict[(1,2)]=12
sum=0
for k in my_dict:
sum+=my_dict[k]
print(sum)
print(my_dict)
Section D
32. Consider the table Items as given below and write down the .
101 TV LG 12 18000
a. Display the details of item which price within range of 15000 and 20000
33. Write SQL queries for (a) to (g) and write the output for the SQL queries mentioned
shown in (hi) to (h4) parts on the basis of table ITEMS and TRADERS :
a. To display the number of items, which are traded by each trader. The expected
output of this query should be:
b. To display the price, item name and quantity (i.e., qty) of those items which have
quantity more than 150.
c. To display the names of those traders, who are either from DELHI or from
MUMBAI.
d. To display the names of the companies and the names of the items in descending
order of company names.
OR
Obtain the outputs of the following SQL queries based on the data given in tables ITEMS
and TRADERS above.
Section E
36. Jagan is an managing director of Royal Pickle company. He needs to manage the records
of various pickles. For this, he wants the following information of each type of pickle to
be stored:
Pickle_id -int
Pickle_type -varchar(20)
Pickle_Quantity -int
Price -int
No_of_stock -int
You, as a programmer of the company, have been assigned to do this job for Jagan.
a) Write a function to input the data of a candidate and append it in a binary file.
b) Write a function to update the data of candidates whose experience is more than 10
years and change their designation to "Senior Manager".
c) Write a function to read the data from the binary file and display the data of all those
candidates who are not "Senior Manager".
37. Galaxy Provider Ltd. is planning to connect its office in Texas, USA with its branch at
Mumbai. The Mumbai branch has 3 Offices in three blocks located at some distance
from each other for different operations-ADMIN, SALES and ACCOUNTS. As a network
consultant, you have to suggest the best network related solutions for the
issues/problems raised in (a) to (d), keeping in mind the distances between various
locations and other given parameters.
No of computers install at
Distance between various location
various location
a. It is observed that there is a huge data loss during the process of data transfer from
one block to another. Suggest the most appropriate networking device out of the
following, which needs to be placed along the path of the wire connecting one block
c. Which service/protocol out of the following will be most helpful to conduct live
d. Draw the cable layout (block to block) to efficiently connect the three offices of the
Mumbai branch.