1. State True or False:
“In a Python program, if a break statement is given in a nested loop, it terminates the execution of all loops in one go.”
Ans:
2. In a table in MYSQL database, an attribute A of datatype varchar(20) has the value “Keshav”. The attribute B of datatype char(20) has value “Meenakshi”. How many characters are occupied by attribute A and attribute B?
a) 20,6
b) 6,20
c) 9,6
d) 6,9
3. What will be the output of the following statement:
print(3-2**2**3+99/11)
a) 244
b) 244.0
c) -244.0
d) Error
4. Select the correct output of the code:
s = "Python is fun"
l = s.split()
s_new = "-".join([l[0].upper(), l[1], l[2].capitalize()])
print(s_new)
a) PYTHON-IS-Fun
b) PYTHON-is-Fun
c) Python-is-fun
d) PYTHON-Is -Fun
5. In MYSQL database, if a table, Alpha has degree 5 and cardinality 3, and another table, Beta has degree 3 and cardinality 5, what will be the degree and cardinality of the Cartesian product of Alpha and Beta?
a) 5,3
b) 8,15
c) 3,5
d) 15,8
6. Riya wants to transfer pictures from her mobile phone to her laptop. She uses Bluetooth Technology to connect two devices. Which type of network will be formed in this case?
a) PAN
b) LAN
c) MAN
d) WAN
7. Which of the following will delete key-value pair for key = “Red” from a dictionary D1?
a) delete D1("Red")
b) del D1["Red"]
c) del.D1["Red"]
d) D1.del["Red"]
8. Consider the statements given below and then choose the correct output from the given options:
pride="#G20 Presidency"
print(pride[-2:2:-2])
a) ndsr
b) ceieP0
c) ceieP
d) yndsr
9. Which of the following statement(s) would give an error during execution of the following code?
tup = (20,30,40,50,80,79)
print(tup) #Statement 1
print(tup[3]+50) #Statement 2
print(max(tup)) #Statement 3
tup[4]=80 #Statement 4
a) Statement 1
b) Statement 2
c) Statement 3
d) Statement 4
10. What possible outputs(s) will be obtained when the following code is executed?
import random
myNumber=random.randint(0,3)
COLOR=["YELLOW","WHITE","BLACK","RED"]
for I in range(1,myNumber):
print(COLOR[I],end="*")
print()
a)
RED*
WHITE*
BLACK*
b)
WHITE*
BLACK*
c)
WHITE* WHITE*
BLACK* BLACK*
d)
YELLOW*
WHITE*WHITE*
BLACK* BLACK* BLACK*
11. Fill in the blank:
The modem at the sender’s computer end acts as a ________.
a) Model
b) Modulator
c) Demodulator
d) Convertor
12. Consider the code given below:
b=100
def test(a):
____________ # missing statement
b=b+a
print(a,b)
test(10)
print(b)
Which of the following statements should be given in the blank for #Missing Statement, if the output produced is 110?
a) global a
b) global b=100
c) global b
d) global a=100
13. State whether the following statement is True or False:
An exception may be raised even if the program is syntactically correct.
Ans:
14. Which of the following statements is FALSE about keys in a relational database?
a) Any candidate key is eligible to become a primary key.
b) A primary key uniquely identifies the tuples in a relation.
c) A candidate key that is not a primary key is a foreign key.
d) A foreign key is an attribute whose value is derived from the primary key of another relation.
15. Fill in the blank:
In case of ________ switching, before a communication starts, a dedicated path is identified between the sender and the receiver.
Ans:
16. Which of the following functions changes the position of file pointer and returns its new position?
a) flush()
b) tell()
c) seek()
d) offset()
Q 17 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): List is an immutable data type
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.
Ans:
18. Assertion (A): Python Standard Library consists of various modules.
Reason (R): A function in a module is used to simplify the code and avoids repetition.