1. State if the following statement is True or False:
Using the statistics module, the output of the below statements will be 20:
import statistics
statistics.median([10, 20, 10, 30, 10, 20, 30])
Ans: True
2. What will be the output of the following code?
L = ["India", "Incredible", "Bharat"]
print(L[1][0] + L[2][-1])
a) IT
b) it
c) It
d) iT
3. Consider the given expression:
print(19<11 and 29>19 or not 75>30)
Which of the following will be the correct output of the given expression?
a) True
b) False
c) Null
d) No output
4. In SQL, which type of Join(s) may contain duplicate column(s)?
Ans: Equi-Join or Cartesian Join
5. What will be the output of the following Python code?
str= "Soft Skills"
print(str[-3::-3])
a) lSf
b) Stkl
c) StKi
d) l
6. Write the output of the following Python code :
for k in range(7, 40, 6):
print(k, end='-')
Ans: Error as unsupported operand type(s) for +: 'int' and ‘str'
7. What will be the output of the following Python statement:
print(10-3**2**2+144/12)
Ans: -59.0
8. Consider the given SQL Query:
SELECT department, COUNT(*) FROM employees HAVING COUNT(*) > 5 GROUP BY department;
Saanvi is executing the query but not getting the correct output. Write the correction.
Ans: SELECT department, COUNT(*) FROM employees GROUP BY department HAVING COUNT(*) > 5;
9. What will be the output of the following Python code?
try:
x = 10 / 0
except ZeroDivisionError:
print("Division by zero error!")
except Exception:
print("Some other error!")
a) Division by zero error!
b) Some other error!
c) ZeroDivisionError
d) Nothing is printed
10. What will be the output of the following Python code?
my_dict = {"name": "Alicia", "age": 27, "city": "DELHI"}
print(my_dict.get("profession", "Not Specified"))
a) Alicia
b) DELHI
c) None
d) Not Specified
11. 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
L = [10, 30, 50, 70]
Lower = random.randint(2, 2)
Upper = random.randint(2, 3)
for K in range(Lower, Upper + 1):
print(L[K], end='@')
a) 50@70@
b) 90@
c) 10@30@50@
d) 10@30@50@70@
12. What will be the output of the following Python code?
i = 5
print(i, end='@@')
def add():
global i
i = i + 7
print(i, end='##')
add()
print(i)
a) 5@@12##15
b) 5@@5##12
c) 5@@12##12
d)12@@12##12
13. Which SQL command can change the cardinality of an existing relation?
a) Insert
b) Delete
c) Both a) & b)
d) Drop
14. What is the output of the given Python code?
st='Waterskiing is thrilling!'
print(st.split("i"))
a) ['Watersk', 'ng ', 's thr', 'll', ‘ng!']
b) ['Watersk', '', 'ng ', 's thr', 'll', 'ng!']
c) ['Watersk', 'i', 'ng ', 's thr', 'll', ‘ng!']
d) Error
15. In SQL, a relation consists of 5 columns and 6 rows. If 2 columns and 3 rows are added to the existing relation, what will be the updated degree of a relation?
a) Degree: 7
b) Degree: 8
c) Degree: 9
d) Degree: 6
16. Which SQL command is used to remove a column from a table in MySQL?
a) UPDATE
b) ALTER
c) DROP
d) DELETE
17. ______ is a protocol used for retrieving emails from a mail server.
a) SMTP
b) FTP
c) POP3
d) PPP
18. Which of the following is correct about using a Hub and Switch in a computer network?
a) A hub sends data to all devices in a network, while a switch sends data to the specific device.
b) A hub sends data only to the devices it is connected to, while a switch sends data to all devices in a network.
c) A hub and switch function the same way and can be used interchangeably.
d) A hub and switch are both wireless networking devices.
19. Which of the following is used to create the structure of a web page?
a) CSS
b) HTML
c) JavaScript
d) FTP
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): The append() method adds an element to the end of a list and modifies the list in place.
Ans: d) A is False but R is True.
21. Assertion (A): A primary key must be unique and cannot have NULL values.
Reason (R): The primary key uniquely identifies each row in the table.