xii pre board re test
xii pre board re test
General Instructions:
● This question paper contains 37 questions.
● All questions are compulsory. However, internal choices have been provided in some questions.
Attempt only one of the choices in such questions
● The paper is divided into 5 Sections- A, B, C, D and E.
● Section A consists of 21 questions (1 to 21). Each question carries 1 Mark.
● Section B consists of 7 questions (22 to 28). Each question carries 2 Marks.
● Section C consists of 3 questions (29 to 31). Each question carries 3 Marks.
● Section D consists of 4 questions (32 to 35). Each question carries 4 Marks.
● Section E consists of 2 questions (36 to 37). Each question carries 5 Marks.
● All programming questions are to be answered using Python Language only.
● In case of MCQ, text of the correct answer should also be written.
Section A
1. State True or False: The continue statement in Python skips the rest of the code for the current
iteration and moves to the next iteration.
2. What is the output of the following code?
print(len({1, 2, 3, 2, 1}))
5. Which method is used to retrieve the last element from a stack in Python?
(A) pop() (B) peek() (C) remove() (D) delete()
6. What is the default port number of MySQL?
(A) 1433 (B) 3306 (C) 1521 (D) 5432
7. In SQL, what does the DISTINCT keyword do?
(A) Filters unique rows (B) Deletes duplicate rows
(C) Joins tables (D) None of the above
8. Expand SMTP in networking.
(A) Simple Mail Transfer Protocol
(B) Secure Mail Transfer Protocol
(C) Simple Mail Text Protocol
(D) Server Mail Transmission Protocol
1
9. Which of the following is not a valid Python operator?
(A) // (B) ** (C) %% (D) +=
10. Identify the output of the following SQL query:
SELECT LENGTH("COMPUTER");
11. What does LIFO stand for in the context of data structures?
(A) Last In, First Out (B) Last In, First Open
(C) Last In, First Operation (D) None of the above
19. Which of these SQL commands is used to retrieve data from a table?
(A) SELECT (B) UPDATE (C) DELETE (D) ALTER
20. Assertion (A): Python allows the use of both single and double quotes for defining strings.
Reason (R): Strings are immutable in Python.
(A) Both A and R are true, and R explains A.
(B) Both A and R are true, but R does not explain A.
(C) A is true, but R is false.
(D) A is false, but R is true.
21. Assertion (A): In SQL, the ORDER BY clause is used to arrange the data in ascending or
descending order.
Reason (R): The GROUP BY clause is used to combine rows with similar values into summary
rows.
(A) Both A and R are true, and R explains A.
(B) Both A and R are true, but R does not explain A.
(C) A is true, but R is false.
(D) A is false, but R is true.
SECTION B: Very Short Answer (2 Marks each)
22. Explain the difference between a for loop and a while loop in Python.
26. Explain the purpose of the GROUP BY clause in SQL with an example.
3
Case Study 1:
25. A company maintains a database with a table EMPLOYEES as follows:
Case Study 2:
26. Alex is managing a list of books for a library system. Each book has Title, Author, Genre, and Year.
Write Python functions to:
(I) Add a book to the library.
(II) Search for books by a specific author.
(III) Display all books published after the year 2000.
string = "HELLOCS"
string = string.lower().replace('o', 'x')
print(string)
(A) Helxlcs (B) HELXLCS (C) helxocs (D) None of the above
4.Given a list nums = [10, 20, 30, 40], what will nums[-3:] return?
(A) [10, 20, 30] (B) [20, 30, 40] (C) [30, 40] (D) None of the above
5. What will be the output of the following code snippet?
tuple1 = (1, 3, 5)
tuple2 = (7,)
tuple3 = tuple1 + tuple2
print(len(tuple3))
(A)3 (B) 4 (C) Error (D) None of the above
6.Which of these is not a valid Python keyword?
(A) with (B) async (C) module (D) del
4
8. What is the function of the HAVING clause in SQL?
(A) Filters groups of data based on aggregate functions
(B) Filters individual rows based on conditions
(C) Creates new columns in the result set
(D) Joins two tables in a query
9. If a column is set to NOT NULL, what does this imply?
(A) The column must have unique values (B) The column cannot have
duplicate values
(C) The column must have a value and cannot be left empty (D) The column must be indexed
10. What does SMTP stand for?
(A) Simple Mail Transfer Protocol (B) Secure Mail Transmission Protocol
(C) Server Mail Transfer Process (D) Simple Mail Transport Protocol
11. Expand the term IP in networking.
(A) Internet Process (B) Internet Protocol
(C) Internal Process (D) Internal Protocol
12. Which of these data structures supports Last-In-First-Out (LIFO) operations?
(A) Queue (B) Stack
(C) List (D) Dictionary
13. Fill in the blank: In Python, the method _________ is used to add an element to the end of a list.
(A) .add() (B) .append()
(C) .insert() (D) .extend()
14. What will be the output of this SQL query?
SELECT UPPER('welcome');
(A) WELCOME (B) Welcome
(C) Error (D) None of the above
15. Which device connects different networks and translates data between them?
(A) Modem(B) Router
(C) Switch(D) Repeater
16. Which protocol is used for sending email over the Internet?
(A) HTTP (B) FTP
(C) SMTP(D) POP3
17. Assertion (A): Tuples in Python are mutable.
Reason (R): Tuples allow adding and removing elements dynamically.
(A) Both A and R are true, and R explains A
(B) Both A and R are true, but R does not explain A
(C) A is true, but R is false
(D) A is false, but R is true
18. Assertion (A): SQL commands are case-sensitive.
Reason (R): Reserved keywords in SQL must always be written in uppercase.
(A) Both A and R are true, and R explains A
(B) Both A and R are true, but R does not explain A
(C) A is true, but R is false
(D) A is false, but R is true
19. Which SQL command is used to add a new column to an existing table?
(A) ADD COLUMN (B) ALTER TABLE
(C) CREATE COLUMN (D) INSERT COLUMN
20. What will be the output of the following Python code?
a = [1, 2, 3, 4]
b=a
b.append(5)
print(a)
(A) [1, 2, 3, 4]
(B) [1, 2, 3, 4, 5]
5
(C) Error
(D) [5]
21. What is the purpose of the break statement in Python?
(A) Skip the rest of the code in the current iteration and continue with the next iteration
(B) Terminate the loop or switch statement immediately
(C) Stop the execution of the entire program
(D) Pause the program until user input is received
Section B
22.Explain the difference between a primary key and a foreign key in SQL.
23.Write a Python code snippet to count the number of vowels in the string "COMPUTER".
24.How are dictionaries different from lists in Python?
25.Write a Python function to reverse a list in-place.
26. What will be the output of this code?
import random
num = random.randint(2, 5)
print("Number:", num)
27. Write a SQL query to fetch all records from a table.
28. If
L1 = [1, 2, 3, 2, 1, 2, 4, 2, ...],
L2 = [10, 20, 30, ...]
(I)
A) Write a statement to count the occurrences of 4 in L1.
OR
B) Write a statement to sort the elements of list L1 in ascending order.
(II)
A) Write a statement to insert all the elements of L2 at the end of L1.
OR
B) Write a statement to reverse the elements of list L2.
Section C
29. . Write a Python function to read a file "data.txt" and display all lines that contain the word "Python".
30. Write a Python function push_even(numbers) to push even numbers from a given list into a stack and
display the stack.
31. Predict the output of the following Python code:
def modify_list(lst):
for i in range(len(lst)):
lst[i] = lst[i] ** 2
numbers = [1, 2, 3]
modify_list(numbers)
print(numbers)
Section D (4 x 4 = 16 Marks)
6
O_Id C_Name Product Quantity Price
34.A table, named EMPLOYEES, in the COMPANYDB database, has the following structure:
Field Type
empID int(11)
empName varchar(30)
salary float
department varchar(20)
AddAndDisplay():
Host: localhost
User: root
Password: password
Database: COMPANYDB
35.Samantha has been entrusted with the management of a School Database. She needs to access some
information from the STUDENTS and ENROLLMENTS tables for an analysis. Help her extract the
following information by writing the desired SQL queries as mentioned below.
Table: STUDENTS
7
S_ID SName Age Gender Admission_Date Grade
202 Emma 19 Female 10-09-2021 B
203 Mike 17 Male 01-01-2023 C
204 Sophia 18 Female 21-05-2022 B
205 Liam 20 Male 14-11-2020 A
Table: ENROLLMENTS
SQL Queries:
(I) To display the complete details (from both the tables) of those students whose grade is 'A'.
(II) To display the details of courses (from the ENROLLMENTS table) where the enrollment
status is 'Active'.
(III) To update the status of all students who are enrolled in a course with C_ID = 101 to 'Inactive'.
(IV)
(A) To display the names (SName) of students who are enrolled in course C_ID = 101.
OR
(B) To display the Cartesian product of the STUDENTS and ENROLLMENTS tables.
Section E (2 x 5 = 10 Marks)
36. Candidate Records Management:
Surya is a manager working in a recruitment agency. He needs to manage the records of various candidates.
For this, he wants the following information of each candidate to be stored:
Candidate_ID – integer
Candidate_Name – string
Designation – string
Experience – float
You, as a programmer of the company, have been assigned to do this job for Surya.
(I) Write a function to input the data of a candidate and append it to a binary file.
(II) Write a function to update the data of candidates whose experience is more than 10 years and change
their designation to "Senior Manager".
(III) Write a function to read the data from the binary file and display the data of all those candidates who
are not "Senior Manager".
Tasks:
(I) Suggest the most appropriate location of the server inside the Mumbai campus. Justify your choice.
(II) Which hardware device will you suggest to connect all the computers within each building?
(III) Draw the cable layout to efficiently connect various buildings within the Mumbai campus. Which cable
would you suggest for the most efficient data transfer over the network?
(IV) Is there a requirement of a repeater in the given cable layout? Why/Why not?
(V)
(A) What would be your recommendation for enabling live visual communication between the Admin
Office at the Mumbai campus and the Delhi Head Office from the following options:
a) Video Conferencing
b) Email
c) Telephony
d) Instant Messaging
OR
(B) What type of network (PAN, LAN, MAN, or WAN) will be set up among the computers connected in
the Mumbai campus?