1. Write the output on execution of the following Python code:
L1=[10,20,25,30]
L1.insert(1,15)
print(L1)
Ans: [10, 15, 20, 25, 30]
2. What will be the output of the following expression?
Msg = "programming is amazing"
print(Msg.split("m"))
a) ['progra', '', 'ing is a', 'azing']
b) ['progra', 'ming is a', 'azing']
c) ('progra', '', 'ing is amazing')
d) ['program', 'ing is a', 'zing']
3. Which of the following data types in Python is mutable?
a) Tuple
b) String
c) Integer
d) List
4. A column in one table matching a primary key of another table is called a:
a) Composite key
b) Candidate key
c) Foreign key
d) Super key
5. Consider the following Python code:
t = (1, 2, 3)
l = [4, 5]
print(t + l)
What will happen when this code is executed?
a) [1, 2, 3, 4, 5]
b) (1, 2, 3, 4, 5)
c) Error, because a tuple cannot be concatenated with a list
d) ((1, 2, 3), [4, 5])
6. What possible output is expected to be displayed on the screen at the time of
execution of the Python program from the following code?
import random
games = {0: "Chess",1: "Scrabble",2: "Sudoku",3: "Tic-Tac-Toe",4: "Puzzle"}
start_key = random.randint(1, 2)
end_key = random.randrange(3, 4)
for k in range(start_key, end_key + 1):
print(games[k], end="@@")
a) Sudoku@@Tic-Tac-Toe@@Puzzle@@
b) Scrabble@@Sudoku@@Tic-Tac-Toe@@
c) Chess@@Scrabble@@Tic-Tac-Toe@@
d) Scrabble@@Tic-Tac-Toe@@
7. Predict the output for the following:
Dl={"Pen":12, "Pencil":6, "Scale":5, "InkPen":20}
print(12 in Dl)
a) False
b) Error
c) None
d) True
8. Long-distance communication without line-of-sight is mainly achieved using:
a) Microwaves
b) Ultraviolet
c) Radio waves
d) X-rays
9. Which MySQL query will display all employees whose salaries are between 90,000
and 100,000 (including limits)?
a) SELECT * FROM Employees WHERE salary > 90000 AND salary < 100000;
b) SELECT * FROM Employees WHERE salary IN (90000, 100000);
c) SELECT * FROM Employees WHERE salary BETWEEN 90000 AND 100000;
d) SELECT * FROM Employees WHERE salary = 90000 OR salary = 100000;
10. What will be the output of the following Python statement:
print(25+100**1**3/5)
Ans: 45.0
11. What is the data type of the result when the expression 5 // 2 is evaluated in Python?
a) float
b) int
c) string
d) None
12. Every network interface card (NIC) comes with its own ________ address.
a) Internet Protocol (IP)
b) Open Systems Interconnection (OSI)
c) Physical (MAC) Address
d) Dynamic Host Configuration Protocol (DHCP)
13. In a student table, “Class” can only take values from {IX, X, XI, XII}. This set is called
the ________.
a) Domain
b) Tuple
c) Attribute
d) Key
14. What would be written in the file errorlog.txt after the following code is run?
def data(num):
try:
return 190/(29-num)
except ZeroDivisionError:
logfile = open ("errorlog.txt", "w")
logfile.write ("Num was 29")
logfile.close()
data(29)
Ans: Num was 29
15. Which of the following will NOT change if you insert a new record into a table?
a) Cardinality
b) Degree
c) Number of tuples
d) Total rows
16. What will be the output of the following Python code?
y = 8
def update():
y = y + 2
print(y)
update()
a) 10
b) 8
c) Error
d) None
17. In ______ switching, before a communication starts, a dedicated path is identified
between the sender and the receiver.
a) Graph
b) Plot
c) Circuit
d) Packet
18. What will be the output of the following Python code?
text = "Drone Expo"
print(text[-2: :-4])
Ans: peD
19. Which MySQL command correctly removes an attribute Age from table Student?
a) ALTER TABLE Student DROP COLUMN Age;
b) ALTER TABLE Student REMOVE Age;
c) DROP COLUMN Age FROM Student;
d) DELETE COLUMN Age FROM Student;
Q.20 and Q.21 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
Q.20 Assertion (A): The expression (1, 2, 3, 4).append(5) in Python will modify the original sequence datatype.
Reason (R): In rb mode, if the file does not exist, Python creates a new empty file.
Ans: c) A is True but R is False
21. Assertion (A): The MySQL query SELECT Student_Name FROM Student WHERE Guardian_Phone IS NULL; displays the names of students whose guardian phone number is not recorded.
Reason (R): In MySQL, you can also use = to check for NULL values; it is equivalent to IS NULL to identify columns with no value.