0% found this document useful (0 votes)
28 views9 pages

xii pre board re test

cs

Uploaded by

wish26089
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views9 pages

xii pre board re test

cs

Uploaded by

wish26089
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

WILSONIA SCHOLARS’ HOME

Pre-Board Question Paper Re-Test ( 2024- 25)


CLASS : XII MM : 70
SUBJECT : COMPUTER SCIENCE(083) Time: 3hours

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}))

(A) 5 (B) 3 (C) Error (D) None of the above

3. Which of these operations is not supported by Python tuples?


(A) Slicing (B) Indexing (C) Assignment (D) Concatenation
4. Identify the output of:

nums = [10, 20, 30]


print(nums[1:])
(A) [10, 20, 30] (B) [20, 30] (C) [10] (D) Error

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");

(A) 8 (B) 7 (C) Error (D) None of the above

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

12. Which of these data structures supports First-In-First-Out (FIFO)?


(A) Queue (B) Stack (C) List (D) Set
13. SMTP is used for:
(A) Sending emails (B) Storing files
(C) Transferring data packets (D) Encrypting emails
14. Which function in Python is used to find the length of a tuple?
(A) size() (B) count() (C) len() (D) None of the above
15. Which of the following commands is used to add a column to an existing SQL table?
(A) INSERT COLUMN (B) ALTER TABLE (C) ADD COLUMN (D) UPDATE COLUMN
16. Which protocol is used to retrieve emails from a server?
(A) SMTP (B) POP3 (C) FTP (D) HTTP
17. In Python, which of these is not a mutable data structure?
(A) List (B) Tuple (C) Dictionary (D) Set
18. What is the output of the following Python code?
x = [1, 2, 3, 4] print(x[:2])

(A) [1, 2] (B) [3, 4] (C) [2, 3, 4] (D) Error

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.

23. Write a Python code snippet to check if a number is even or odd.

24. How is the DELETE command in SQL different from TRUNCATE?


2
25. Write a Python code snippet to find the maximum element in a list without using the max() function.

26. Explain the purpose of the GROUP BY clause in SQL with an example.

27. What is the output of the following code?


my_dict = {1: 'A', 2: 'B'
my_dict[3] = 'C'
print(len(my_dict))
28.List two differences between TCP and UDP.
SECTION C: Short Answer (3 Marks each)

29. Write a Python function to check if a string is a palindrome.


30. Write a SQL query to find the second-highest salary in a table EMPLOYEES.
31. Predict the output:
def calc_area(radius):
return 3.14 * radius ** 2
print(calc_area(5))
32.Write a Python function to read a CSV file and print all rows where the second column contains the
value "Yes".
SECTION D: Long Answer (4 Marks)
32. A)
SQL Queries:
(I) To display the total quantity for each product, excluding products with total quantity less than 5:
(II) To display the orders table sorted by total price in descending order:
(III) To display the distinct customer names from the Orders table:
(IV) To display the sum of the price of all orders where the quantity is NULL:
OR:
B)
Output of Queries:
(I)SELECT C_Name, SUM(Quantity) AS TotalQuantity FROM ORDERS GROUP BY C_Name;
(II)SELECT * FROM ORDERS WHERE Product LIKE '%phone%';
(III)SELECT O_Id, C_Name, Product, Quantity, Price FROM ORDERS WHERE Price BETWEEN 1500
AND 12000;
(IV)SELECT MAX(Price) FROM ORDERS;
33.
34. SQL Queries for Faculty and Courses Tables:
(I) To display complete details of faculties with salary < 12000:
(II) To display details of courses with fees in the range of 20000 to 50000:
(III) To increase fees of all courses by 500 with "Computer" in their names:
(IV)
(A) To display names (FName and LName) of faculty teaching System Design:
or
(B) To display the Cartesian product of the two tables:

35. Python Function for Adding and Displaying Records:


Function to input item details, store in the STATIONERY table, and retrieve records with Price > 120:

SECTION E: Case-Based Questions (5 Marks each)

3
Case Study 1:
25. A company maintains a database with a table EMPLOYEES as follows:

empID Name Department Salary


101 John IT 60000
102 Emily HR 50000
103 Alex IT 70000
104 Sophia Finance 55000

Perform the following tasks:


(I) Write a SQL query to retrieve the names of employees from the IT department.
(II) Write a SQL query to increase the salary of all employees by 10%.

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.

1. State True or False:


The "pass" statement in Python skips execution of a block of code.

2.Identify the output of the following code:

string = "HELLOCS"
string = string.lower().replace('o', 'x')
print(string)
(A) Helxlcs (B) HELXLCS (C) helxocs (D) None of the above

3. What is the output of this expression?

print(3 * "CS" + "4")


(A)CSCSCS4 (B) CSCSCS 4 (C) Error (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

7. Which of the following statements opens a file in append mode in Python?


(A) file = open("example.txt", "w")
(B) file = open("example.txt", "r")
(C) file = open("example.txt", "a")
(D) file = open("example.txt", "x")

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)

32. Consider the following SQL table ORDERS:

6
O_Id C_Name Product Quantity Price

101 Jitendra Laptop 2 50000

102 Aditi Smartphone 3 15000

103 Sneha Tablet 1 20000

Perform the following operations:


a. Write a query to display the total price (Price * Quantity) for each order.
b. Write a query to display all orders where the product is either "Laptop" or "Tablet".
c. Write a query to display distinct customer names.
d. Write a query to update the price of "Smartphone" to 18000.

33. A CSV file named "survey.csv" contains the following fields:


Name, Age, Country, Happy (Yes/No).

Write Python functions to:


a. Count the total number of happy people in the file.
b. Display all records where the age is greater than 30.

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)

Write the following Python function to perform the specified operation:

AddAndDisplay():

 To input details of an employee and store them in the EMPLOYEES table.


 The function should then retrieve and display all records from the EMPLOYEES table where the
salary is greater than 50000.

Assume the following for Python-Database connectivity:

 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

S_ID SName Age Gender Admission_Date Grade


201 John 18 Male 15-08-2022 A

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

E_ID S_ID C_ID Enrollment_Date Status


301 201 101 15-08-2022 Active
302 202 102 10-09-2021 Active
303 203 103 01-01-2023 Inactive
304 204 101 21-05-2022 Active
305 205 104 14-11-2020 Active

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".

37. Networking for Event Horizon Enterprises:


Event Horizon Enterprises is an event planning organization. It is planning to set up its India campus in
Mumbai with its head office in Delhi. The Mumbai campus will have four blocks/buildings:
8
 ADMIN
 FOOD
 MEDIA
 DECORATORS
You, as a network expert, need to suggest the best network-related solutions for them to resolve the
issues/problems mentioned in points (I) to (V), keeping in mind the distances between various
blocks/buildings and other given parameters.
Block-to-Block Distances (in meters):
From To Distance
ADMIN FOOD 42 m
ADMIN MEDIA 96 m
ADMIN DECORATORS 48 m
FOOD MEDIA 58 m
FOOD DECORATORS 46 m
MEDIA DECORATORS 42 m
Distance of Delhi Head Office from Mumbai Campus = 1500 km
Number of Computers in Each Block/Building:
 ADMIN: 30
 FOOD: 18
 MEDIA: 25
 DECORATORS: 20
 DELHI HEAD OFFICE: 18

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?

You might also like