Professional Documents
Culture Documents
Sahodaya Comp Set 2 QP
Sahodaya Comp Set 2 QP
ASSOCIATION
General Instructions:
1. This question paper contains five sections, Section A to E.
2. All questions are compulsory.
3. Section A has 18 questions carrying 01 mark each.
4. Section B has 07 Very Short Answer type questions carrying 02 marks each. Three internal choice is
given in Q19, Q21 and Q24
5. Section C has 05 Short Answer type questions carrying 03 marks each. One internal choice is given in
Q28
6. Section D has 02 Long Answer type questions carrying 04 marks each.
7. Section E has 03 questions carrying 05 marks each. Two internal choice is given in Q34 and Q35.
8. All programming questions are to be answered using Python Language only.
SECTION - A
1 State True or False 1
“The characters of string will have two-way indexing.”
2 Which of the following is the valid variable name? 1
(a) f%2 (b) 20ans (c) ans (d) $ans
3 What will be the output of the following code? 1
a) {4:’Four’,5: ‘Five’}
b) Method update() doesn’t exist for dictionary
c) {1: “One”,2: “Two”, 3: “C”}
d) {1: “One”,2: “Two”, 3: “C”,4: ‘Four’,5: ‘Five’}
4 Evaluate the expression given below if A=16 and B=15. 1
A % B // A
a) 1 b) 0.0 c) 0 d) 1.0
5 Select the correct output of the following code : 1
1
a) [I#N#F#O#R#M#A#T#I#C#S]
b) [‘I’, ‘N’, ‘F’, ‘O’, ‘R’, ‘M’, ‘A’, ‘T’, ‘I’, ‘C’, ‘S’]
c) [‘I N F O R M A T I C S’]
d) [‘INFORMATICS’]
6 Which of the following are the modes of both writing and reading in binary format 1
in file?
a) wb+
b) w
c) w+
d) wb
7 Fill in the blank 1
command is used to modify the attribute datatype or size in a table
structure.
a) update b) alter c) insert d) None of these
8 Which of the following clause is used to sort records in a table? 1
a) GROUP
b) GROUP BY
c) ORDER BY
d) ORDER
9 Which of the following statement(s) would give an error after executing the 1
following code?
a) statement 1
b) statement 2
c) statement 3
d) statement 4
10 Fill in the blank: 1
constraint is used to restrict entries in other table’s non key attribute,
whose values are not existing in the primary key of reference table.
a) Primary Key
b) Foreign Key
c) Candidate Key
d) Alternate Key
11 A text file student.txt is stored in the storage device. Identify the correct option 1
out of the following options to open the file in read mode.
i. myfile = open('student.txt','rb')
ii. myfile = open('student.txt','w')
iii. myfile = open('student.txt','r')
iv. myfile = open('student.txt')
a) only i
b) both i and iv
2
c) both iii and iv
d) both i and iii
12 Fill in the blank: 1
define rules regarding the values allowed in columns and is
the standard mechanism for enforcing database integrity.
a) Attribute
b) Constraint
c) Index
d) Commit
13 State True or False: 1
A try block in Python must always be followed by an except block.
14 What will the following expression be evaluated to in Python? 1
print(6*3 / 4**2//5-8)
(a) -10 (b) 8.0 (c) 10.0 (d) -8.0
15 The operation whose result contains all pairs of tuples from the two relations, 1
regardless of whether their attribute values match.
a) Join
b) Intersection
c) Union
d) Cartesian Product
16 To create a connection between MYSQL database and Python application 1
connect() function is used. Which of the following are mandatory arguments
required to connect any database from Python.
a) Username, Password, Hostname, Database Name, Port
b) Username, Password, Hostname
c) Username, Password, Hostname, Database Name
d) Username, Password, Hostname, Port
Q17 and 18 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
17 Assertion (A):- All the keyword arguments passed must match one of the 1
arguments accepted by the function
Reasoning (R):- You cannot change the order of appearance of the keyword.
18 Assertion (A): CSV file is a human readable text file where each line has a number 1
of fields, separated by commas or some other delimiter.
Reason (R): writerow() function can be used for writing into writer object.
SECTION – B
3
str(n):
d=d+x
return d
n=int(input(‘Enter any number”))
s=sumdigits(n)
print(“Sum of digits”,s)
21 Write a function sumcube(L) to test if an element from list L is equal to the sum of 2
the cubes of its digits i.e. it is an "Armstrong number". Print such numbers in the
list.
Example:
If L contains [67,153,311,96,370,405,371,955,407]
The function should print 153,370,371,407
(OR)
Write a function called letter_freq(my_list) that takes one parameter, a list of
strings(mylist) and returns a dictionary where the keys are the letters from mylist
and the values are the number of times that letter appears in the mylist,
Example:
If the passed list is as: wlist=list("aaaaabbbbcccdde")
then it should return a dictionary as{“a”:5,”b”:4,‟c‟:3,‟d‟:2,‟e‟:1}
22 Predict the output of the following code: 2
SECTION – C
4
26 Deduce the output of the following python code: 3
27 A vegetable store “Fresh Stock” maintains the inventory using a SQL table. The table
is given below for your view.
5
29 Consider the table “Employee” given below:
Based on the given table, write SQL queries for the following:
i. Increase the salary by 10% whose salary is less than 3500.
ii. Display the Ename, DeptID, Dname and Salary as “Gross Salary” of all
Employee whose location is New Delhi.
iii. Delete the record of the employee whose DeptID is 1.
30 A list contains following record of a student: [Rno, Name, Dob, Class] Write the
following user defined functions to perform given operations on the stack named
‘status’:
(i) Push_element() - To Push an record of student to the stack
(ii) Pop_element() - To Pop the objects from the stack and display them. Also,
display “Stack Empty” when there are no elements in the stack.
OR
Write a function in Python, Push(book) where, book is a dictionary containing the
details of a book in form of {bookno : price}.
The function should push the book in the stack which have price greater than 300.
Also display the count of elements pushed into the stack.
For example:
If the dictionary contains the following data:
Dbook={"Python":350,"Hindi":200,"English":270,"Physics":600, “Chemistry”:550}
The stack should contain
Chemistry Physics Python
The output should be:
The count of elements in the stack is 3
SECTION- D
31 Consider the tables STUDENT and Stream given below: 1*4=
4
6
Write SQL queries for the following:
i. Display Admission no and Stream ID from the tables STUDENT and
STREAM.
ii. Display the structure of the table STUDENT
iii. Display all the details from the table STUDENT whose class is XII.
iv. Display the name of the student whose name ends with ‘n’ and they belong
to grade XII.
32 Ranjan Kumar of class 12 is writing a program to create a CSV file “user.csv”
which will contain user name and password for some entries. He has written the
following code. As a programmer, help him to successfully execute the given task.
SECTION - E
33 Teach and Learn is leading software developing company resides in Chennai as it 1*5
head office. They have four major blocks administrative office, developing block,
finance block and reception block. Their distance between the blocks is provided.
7
Shortest distance between the blocks
No of computers
• Developing block → 50
• Finance block → 70
• Administrative Office → 120
• Reception → 40
i. Suggest the most suitable location to install the main server and justify.
ii. Suggest the best cable layout for the effective network connectivity which
connects all the blocks with the server.
iii. Suggest the device to be installed in each building:
a. Modem, b. Switch
iv. The company is planning to connect with the external organization which is
located in New York, which type of network will be formed.
v. The company often communicate with video call for different reasons with
their clients at abroad. Which type of protocol is used of the above situation.
(OR)
35 i. Give one point of difference between primary key and unique key. 2+3
ii. Write the following missing statements to complete the code: