0% found this document useful (0 votes)
6 views

Computer Science (Class-XII) QP - 1

This document is a question paper for the Class XII Computer Science exam for the session 2024-25, consisting of 37 questions divided into five sections. Each section has a specific number of questions with varying marks assigned, and all programming questions must be answered using Python. The paper includes multiple-choice questions, programming tasks, and SQL queries, covering various topics in computer science.

Uploaded by

cbalajimohan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Computer Science (Class-XII) QP - 1

This document is a question paper for the Class XII Computer Science exam for the session 2024-25, consisting of 37 questions divided into five sections. Each section has a specific number of questions with varying marks assigned, and all programming questions must be answered using Python. The paper includes multiple-choice questions, programming tasks, and SQL queries, covering various topics in computer science.

Uploaded by

cbalajimohan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

SALEM SAHODYA COMPLEX

CLASS: XII SESSION: 2024-25


COMPUTER SCIENCE (083)
Time allowed: 3 Hours Maximum Marks: 70
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.

Q .No. Section-A (21 x 1 = 21 Marks)


Marks
1. State True or False:
Logical operator not has highest precedence among all the logical operators. (1)

2. Identify the output of the following code snippet:


str="abcdef12"
print(str. replace("cd","12")) (1)
(a) ab12ef12 (b) abcdef12 (c) ab12efcd (d) abcdef

3. Which of the following will be correct output if the given expression is evaluated?
>>> not True and False or True
(1)
(a) True (b) False (c) NONE (d) Null

4. What is the output of the expression?


str="xyxxyyzxxy"
print(str.lstrip("xyy")) (1)
(a) zxxy (b) xyxxyyzxxy (c) xyxzxxy (d) none of the mentioned

5. What will be the output of the following string operation.


str="PYTHON@LANGUAGE"
(1)
print(str[2:12:2])

6. What will be the output of the following code ?


tuple_a = 'a', 'b'
tuple_b = ('a', 'b') (1)
print (tuple_a == tuple_b)
(a) 0 (b) 1 (c) False (d) True
7. What will be the output of the following code snippet ?
rec = {"Name" : "Python", "Age" : "20", "Addr" : "NJ", "Country" : "USA"}
id1 = id(rec)
del rec
rec = {"Name" : "Python", "Age" : "20", "Addr" : "NJ", "Country" : "USA"} (1)
id2 = id(rec)
print(id1 == id2)
(a) True (b) False (c) 1 (d) Exception

8. To insert 5 to the third position in list1, we use which command?


(a) list1.insert(3, 5) (b) list1.insert(2, 5) (c) list1.add(3, 5) (d) list1.append(3, 5) (1)

9. If a table which has one Primary key and three alternate keys. How many Candidate keys
will this table have?
(1)
(a) 3 (b) 4 (c) 5 (d) 6

10. Identify the missing part in the code to write the list object in the file
>>> import pickle
>>> x=[1,3,5,7]
>>> f=open('w.dat','wb')
>>> pickle. ___________(x,f) (1)
>>> f.close()

(a ) write( ) (b) writeline( ) (c) load( ) (d) dump( )

11. State whether the following statement is True or False:


The except block deals with the exception, if it occurs.(True/False) (1)

12. What will be the output of the following code?


num=100
def showval(X):
global num
num = 85
if(X%2==0):
num += X
else: (1)
num -= X
print(num,end="#")
showval(33)
print(num)

(a) 100#52 (b) 85#52 (c) 85#33 (d) 185#52


13. Which command is used to delete the database permanently?
(1)
14. To display the detail of employee having ‘e’ in their name in descending order of salary.
The correct SQL statement is:
(a) SELE T*FROM emp WHERE en me L KE “e%” ORDER BY SAL;
(1)
(b) SELE T*FROM emp ORDER BY SAL DES WHERE en me L KE “%e%”;
(c) SELE T*FROM emp WHERE en me L KE “%e%” ORDER BY DES SAL;
(d) SELE T*FROM emp WHERE en me L KE “%e%” ORDER BY SAL DES ;

15. Which of the following is not a valid datatype in SQL?


(1)
(a) Date (b) String (c) Decimal (d) Char

16. All aggregate functions ignore NULLs except for ________ function.
(1)
(a) Distinct (b)Count(*) (c) Average( ) (d) None of these.

17. Identify the protocol primarily used for browsing data.


(1)
(a) FTP (b)TCP (c) SMTP (d) HTTP

18. Which of the following device an interface between computer and network?
(1)
(a) Modem (b) Router (c) Ethernet Card (d) Repeater

19. Which switching technique dedicated channel through the network? (1)

Q20 and Q21 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 (1)
(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
20 Assertion(A) : If the arguments in function called statement match the number and order of
argument as defined in the function definition, such argument are called
(1)
positional arguments.
Reasoning(R): During a function called, the argument list first contain default arguments
followed by positional arguments.
21. Assertion (A): The HAVING clause can only be used with a GROUP BY statement.
Reasoning(R): WHERE clause can be used in place of HAVING clause in (1)
GROUP BY statement.
Q .No. Section-B (7 x 2 = 14 Marks)
Marks
22. What are immutable and mutable types? List immutable and mutable types of Pyhton?
(2)
23. Give two examples of each of the following:
(2)
(i) Keywords (ii) Membership operators.
24. Start with the list [8, 9, 10]. Do the following using list functions:
(i) Write a statement to set the second entry (index 1) to 17 .
OR
Write a statement to remove the first entry from the list. (2)
(ii) Write a statement to add 4, 5 and 6 to the end of the list.
OR
Write a statement to sort the given list.

25.
Consider the following code and find out the possible output(s) from the options given
below. Also write the least and highest value that can be generated.
import random as r
print(1 + r.randint(1 ,1 ) , end = ‘ ‘)
(2)
print(1 + r.randint(1 ,1 ) , end = ‘ ‘)
print(1 + r.randint(1 ,1 ) , end = ‘ ‘)
print(10 + r.randint(10,15))

(a) 25 25 25 21 (b) 23 27 22 20 (c) 23 22 25 20 (d) 21 25 20 24


26. The given Python code contains some error, observe carefully and rewrite it after removing
all syntax and logical errors. Underline all the corrections made.

(2)

27. What is Constraint ? Give example of any two constraints.


OR
(2)
(i) Name the package for connecting Python with MySQL database.
(ii) What is the purpose of cursor object?

28. What is difference between star topology and bus topology of network?
OR (2)
Expand the term IMAP. What is the use of IMAP?

Q .No. Section-C (3 x 3 = 9 Marks)


Marks
29. (a) Write a user defined function in python that displays the number of lines starting with
'H' in the file para.txt
(3)
OR
(b) Write a program that copies a text file "source.txt" onto "target.txt" barring the lines
starting with @ sign.
30. (a) You have a stack named BooksStack that contains records of books. Each book record
is represented as a list containing book_title, author_name, and publication_year.
Write the following user-defined functions in Python to perform the specified operations on
the stack BooksStack:
(i) push_book(BooksStack, new_book): This function takes the stack BooksStack and a
new book record new_book as arguments and pushes the new book record onto the
stack.
(ii) pop_book(BooksStack): This function pops the topmost book record from the stack and
returns it. If the stack is already empty, the function should display "Underflow".
(iii) peep(BookStack): This function displays the topmost element of the stack without
deleting it. If the stack is empty, the function should display 'None'.
(3)
OR
(b) Write the definition of a user-defined function `push_even(N)` which accepts a list of
integers in a parameter `N` and pushes all those integers which are even from the list `N`
into a Stack named `EvenNumbers`. Write function pop_even() to pop the topmost number
from the stack and returns it. If the stack is already empty, the function should display
"Empty". Write function Disp_even() to display all element of the stack without deleting
them. If the stack is empty, the function should display 'None'.
For example:
If the integers input into the list `VALUES` are:
[10, 5, 8, 3, 12]
Then the stack `EvenNumbers` should store:
[10, 8, 12]
31. Predict the output of the following code snippet ?

(3)
OR
Predict the output of the following code:
d = {"apple": 25, "banana": 48, "cherry": 83}
str1 = ""
for key in d:
str1 = str1 + str(d[key]) + "@" + “\n”
str2 = str1[:-1]
print(str2)
Q. No. Section-D (4 x 4 = 16 Marks)
Marks
32. Consider the table GRADUATE given below.

(4)
(a) Write SQL Command for the following:

(i) List the names of those students who have obtained DIV I sorted by NAME.
(ii) Display a report, listing NAME, STIPEND, SUBJECT and amount of stipend received
in a year assuming that the STIPEND is paid every month.
(iii) To count the number of students who are either PHYSICS or COMPUTER SC
graduates.
(iv) To insert new row in the GRADUATE table 11,”KAJOL”, 300 , “computer sc”, 75 , 1
OR
(b) Give the output of following sql statement based on table GRADUATE:

(i) Select MIN(AVERAGE) from GRADUATE where SUBJE T=”PHYSICS”;


(ii) Select SUM(STIPEND) from GRADUATE WHERE div=2;
(iii) Select AVG(STIPEND) from GRADUATE where AVERAGE>=65;
(iv) Select COUNT(distinct SUBJECT) from GRADUATE;

33. Write a Program in Python that defines and calls the following user defined functions :
(a) add( ): To accept and add data of an employee to a CSV file 'furdata.csv'. Each record
consists of a list with field elements as fid, fname and fprice to store furniture
(4)
id, furniture name and furniture price respectively.
(b) search( ): To display the records of the furniture whose price is more than 10000.
34. Consider the following table GARMENT and FABRIC :

TABLE : GARMENT

GCODE DESCRIPTION PRICE FCODE READYDATE

10023 PENCIL SKIRT 1150 F 03 19-DEC-08


10001 FORMAL SHIRT 1250 F 01 12-JAN-08
10012 INFORMAL SHIRT 1550 F 02 06-JUN-08
10024 BABY TOP 750 F 03 07-APR-07
10090 TULIP SKIRT 850 F 02 31-MAR07
10019 EVENING GOWN 850 F 03 06-JUN-08
10009 INFORMAL PANT 1500 F 02 20-OCT-08
10007 FORMAL PANT 1350 F 01 09-MAR08
10020 FROCK 850 F 04 09-SEP-07
10089 SLACKS 750 F 03 20-OCT-08

TABLE : FABRIC (4)

FCODE TYPE

F04 POLYSTE
F02 COTTON
F03 SILK
F01 TERELENE

(i) To display GCODE and DESCRIPTION of each GARMENT in descending order of


GCODE.
(ii) To display the details of all the GARMENT, which have READYDATE in between
08DEC-07 and 16-JUN-08 (inclusive if both the dates).
(iii) To display the average PRICE of all the GARMENT, which are made up of fabric with
FCODE as F03.
(iv) (a) To display fabric wise highest and lowest price of GARMENT from GARMENT
table.(Display FCODE of each GARMENT along with highest and lowest Price).
OR
(b) To display Gcode whose Price is more than 1000.
35. Mr. Shuvam wants to write a program in Python to Display the following record in the
table named EMP in MYSQL database EMPLOYEE with attributes:
•EMPNO (Employee Number ) - integer • ENAME (Employee Name) - string size(30)
• SAL (Salary) - float (10,2) • DEPTNO(Department Number) - integer

(4)
Note: The following to establish connectivity between Python and MySQL:
• Username - root • Password – admin • Host – localhost

The values of fields rno, name, DOB and fee has to be accepted from the user.
Help Shuvam to write the program in Python.

Q. No. Section-E (2 x 5 = 10 Marks)


Marks
36. Rahman 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
(5)
You, as a programmer of the company, have been assigned to do this job for Rahman.

(i) Write a function to input the data of a candidate and append it in 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. MyPace University is setting up its academic blocks at Naya Raipur and is planning to set
up a network. The University has 3 academic blocks and one Human Resource Center as
shown in the diagram below:

(5)
Center to Center distances between various blocks/center is as follows:

(a) Suggest the most suitable place (i.e., Block/Center) to install the server of this
University with a suitable reason.
(b) Suggest an ideal layout for connecting these blocks/centers for a wired connectivity.
(c) Which device will you suggest to be placed/installed in each of these blocks/centers to
efficiently connect all the computers within these blocks/centers.
(d) Suggest the placement of a Repeater in the network with justification.
(e) (i)The university is planning to connect its admission office in Delhi, which is more than
1250km from university. Which type of network out of (LAN, MAN, or WAN) will be
formed?
OR
(ii) What would be your recommendation for enabling live visual communication
between the Business Block and HR Centre from
the following options:
(a) Video Conferencing (b) Email (c) Telephony (d) Instant Messaging

You might also like