Page 40 - PYTHON-12
P. 40
11. State whether the following statement is True or False: (1)
The else block will not execute if try block contains a return statement.
12. What will be the output of the following code? (1)
count = 0
def outer():
count = 5
def inner():
global count
count += 2
print("Inner count:", count)
inner()
print("Outer count:", count)
outer()
print("Global count:", count)
(a) Inner count: 2
Outer count: 5
Global count: 2
(b) Inner count: 7
Outer count: 5
Global count: 7
(c) Inner count: 7
Outer count: 7
Global count: 5
(d) Inner count: 2
Outer count: 2
Global count: 2
13. Which SQL command would you use to change the name of an existing table from Students to Learners? (1)
14. What will be the output of the given query? (1)
SELECT * FROM sales WHERE customer_ID = 102 OR purchase_date > '2023-06-01';
(a) Details of sales made to customer ID 102 and all purchases after June 1, 2023
(b) Details of all sales made to customers other than 102 before June 1, 2023
(c) Details of all sales made to customer ID 102 or purchases after June 1, 2023
(d) Details of purchases made after June 1, 2023 only if the customer ID is 102
15. Which data type would you choose to store a 10-digit phone number including the country code? (1)
(a) CHAR(10) (b) VARCHAR(15)
(c) INT(10) (d) DATE
16. Which of the following is true about DISTINCT keyword in SQL? (1)
(a) It allows duplicates in query results.
(b) It removes duplicate rows from the result set.
(c) It filters out NULL values from the result set.
(d) It is used to sort data in ascending order.
Practice Paper A.3