0% found this document useful (0 votes)
133 views8 pages

Cblecspu 02

Uploaded by

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

Cblecspu 02

Uploaded by

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

CBSC 12th Computer Science Sample Paper 02 Page 1

Sample Paper 02
Computer Science (083)
CLASS XII 2024-25
Time: 3 Hours Max. Marks: 70
General Instructions:
1. This question paper contains 37 questions.
2. All questions are compulsory. However, internal choices have been provided in some questions. Attempt
only one of the choices in such questions
3. The paper is divided into 5 Sections- A, B, C, D and E.
4. Section A consists of 21 questions (1 to 21). Each question carries 1 Mark.
5. Section B consists of 7 questions (22 to 28). Each question carries 2 Marks.
6. Section C consists of 3 questions (29 to 31). Each question carries 3 Marks.
7. Section D consists of 4 questions (32 to 35). Each question carries 4 Marks.
8. Section E consists of 2 questions (36 to 37). Each question carries 5 Marks.
9. All programming questions are to be answered using Python Language only.
10. In case of MCQ, text of the correct answer should also be written.

SECTION A

1. State True or False


“Given a dictionary Studict, the statement Studict.items() displays only the keys of the items.”

2. Given the list L = [10, 20, 30, 40, 50], the result of print(L[-2]) is:
(a) 20 (b) 40
(c) 40 (d) 30

3. The method used to get the position of file pointer is


(a) pos() (b) get()
(c) seek() (d) tell()

4. This function is used to calculate total occurrence of given elements of list.


(a) len() (b) sum()
(c) count() (d) extend()

5. What will be the output of the following code snippet?


text = “Artificial Intelligence”
print(text[3:15:4])
Continue on next page.....

Install NODIA App to See the Solutions.


Click Here To Install
Page 2 Sample Paper 02 NODIA

6. You can repeat the elements of the tuple using which operator?
(a) * (b) +
(c) ** (d) %

7. The rule of referential integrity is based on...........


(a) Primary key (b) Foreign key
(c) Alternate key (d) None of these

8. Which method retrieves the next row from the result set as a tuple?
(a) fetchone () (b) fetchall ()
(c) fetchmany () (d) rowcount

9. Which of the following command displays the attributes of a table along with their types and sizes?
(a) Alter (b) Show structure
(c) Show create table (d) View structure

10. Write the missing statement to complete the following code:


file = open(“sample.txt”, “r”)
line1 = file.readline()
last_data = file.read()
file.close()

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


The `except` block in Python is executed only when an exception occurs in the `try` block.

12. Which command is used to add records to a table?


(a) ADD (b) APPEND
(c) ADDRECORD (d) INSERT

13. In a............topology, the nodes are connected by separate cables.


(a) Star (b) Bus
(c) Tree (d) Mesh

14. Given a list Lst = [25, 60, 15, 40, 75]. What will be the output of Lst[: :]?
(a) [25, 60, 15, 40, 75] (b) [ ]
(c) Error (d) [25]

15. Which module is to be imported to use the floor() function?


(a) statistics (b) matplotlib
(c) random (d) math

Continue on next page.....

Install NODIA App to See the Solutions.


Click Here To Install
CBSC 12th Computer Science Sample Paper 02 Page 3

16. Which function is used to convert string into tuple?


(a) string() (b) tup()
(c) tuple() (d) str_tuple()

17. In which mode can a file be opened for both reading and writing?
(a) r (b) r+
(c) a (d) None of these

18. The..........clause can be used as an alternative to multiple OR.


(a) IN (b) BETWEEN
(c) NOT (d) range

19. The purpose of the primary key in a database is to


(a) unlock the database (b) provide a map of the data
(c) uniquely identify a record (d) establish constraints on database operations

Directions : (Q.Nos. 20 and 21) are Assertion and Reason based Questions.

20. Assertion (A) : To use the randint() function , the random module needs to be included in the program.
Reason (R) : Some functions are present in modules and to use them the respective module needs to be
imported.
(a) Both A and R are true and R is the correct explanation of A.
(b) Both A and R are true but R is not the correct explanation of A.
(c) A is true but R is false.
(d) A is false but R is true.

21. Assertion (A) : The contents of a Binary file are not directly interpretable.
Reason (R) : Modes in which binary files can be opened are suffixed with ‘b’ like : rb/wb etc.
(a) Both A and R are true and R is the correct explanation of A.
(b) Both A and R are true but R is not the correct explanation of A.
(a) A is true but R is false.
(c) A is false but R is true.

SECTION - B

22. Find the error in following (s).


L1 = [7, 2, 3, 4] Statement 1
L2 = L1 + 2 Statement 2
L3 = L1 * 2 Statement 3
L = L1.pop(7) Statement 4

Install NODIA App to See the Solutions.


Click Here To Install
Page 4 Sample Paper 02 NODIA

23. (a) Observe the code and write the output:


t = ‘APPLE’
t1 = tuple(t)
print(t1)
(b) Predict the output of the following code
x = (2, 3, 4)
y = (3, 4)
t = x + y
print(t)

24. Name two switching techniques used to transfer data between two terminals (computers).
 o
Arrange the following network in ascending order of their area:
LAN, PAN, WAN, MAN

25. Differentiate between an attribute and a tuple with an example.

26. (a) Write the hill forms of


(i) WVVW
(ii) TCP/IP
(b) List down the types of computer networks.

27. Identify the output of the following Python code.


D = {1: “One”, 2: “Two”, 3: “Three”}
L = [ ]
for K, V in D.items():
if V[0] = = “T”:
L.append (K)
print(L)
 o
Identify the output of the following Python statement.
lst1 = [10, 15, 20, 25, 30]
lst1.insert(3, 4)
lst1.insert(2, 3)
print (lst1[– 5])

28. Describe the following terms


(i) Domain
(ii) DB2
 o
Identify commands/functions for the following actions :
(i) To add a new column to a table.
(ii) To get the sum of all values in a column of a table.

Install NODIA App to See the Solutions.


Click Here To Install
CBSC 12th Computer Science Sample Paper 02 Page 5

SECTION - C
29. Write a function Del() to delete the 4th word from a text file school.txt.
 o
Write a function countmy( ) in Python to read the text file “Data.txt” and count the number of times “my”
occurs in the file.
For example If the file contents are:
My first book was. Me and My Family.
It gave me chance to be known to the world.
The output of the function should be
No. of times “my” occur : 2

30. Write Push (contents) and Pop (contents) methods in Python to add numbers and remove numbers
considering them to act as Push and Pop operations of stack.
 o
Write the Push operation of stack containing person names. Notice that the name should only accept
characters, spaces and period (.) except digits. Assume that Pname is a class instance attribute.

31. Write a user-defined function find-name (name), where name is an argument in Python to delete phone
number from a dictionary phone-book on the basis of the name, where name is the key.
 o
Given below is a code to open a text file and perform some operations on it. Answer questions with respect
to the code given
myfile=open(“detail.txt”, “r”)
s =.......... Line 2
print(s)
myfile.close( )
(i) In which mode is the file opend?
(ii) If the entire file is to be read, write a statement in place of Line 2.
(iii) What is the original code performing?

SECTION - D
32. Does python create a file itself if the file doesn’t exist in the memory? Illustrate your answer with an
example:
Write a program using following functions :
(a) inputStud() :To input details of as many students and add them to a csv file “college.csv” without
removing the previous records.
SrNo Studname City Percentage
(b) readCollege() : To open the file “college.csv” and display records whose city is “Kolkata”
 o
Write a statement to create a data.txt file with the following text.
Python file handling is very interesting and useful.
Write a python code using two functions as follows
(a) removerow( ) : To remove a record from the college file “College.csv” having following structure.
SrNo Studname City Percentage

Install NODIA App to See the Solutions.


Click Here To Install
Page 6 Sample Paper 02 NODIA

(b) getCollege( ) : To read the records of the college file “College.csv” and display names of students whose
names start with a lowercase vowel.

33. (a) Consider the tables CARS and SUPPLIER given below. What will be the output of the statement
given?

TABLE: CARS
Ccode Car-Name Make Color Capa-city Cha-rges Scode
501 A-star Suzuki RED 3 14 1
503 Indigo Tata SILVER 3 12 2
502 Innova Toyota WHITE 7 15 2
509 SX4 Suzuki SILVER 4 14 2
510 C-Class Merc-edes RED 4 35 4

Table : SUPPLIER
Scode Sname
1 Great Suppliers
2 Himalayan Vehicles
3 Road Motors
4 Speed
SELECT CarName, Sname, Charges FROM CARS C, SUPPLIER S WHERE C.Scode= S. Scode
AND Charges > 15;
(b) Write the output for SQL queries (i) to (iv), which are based on the table CARDEN.

TABLE: CARDEN
Ccode CarName Make Color Capa-city Charges
501 A-star Suzuki RED 3 14
503 Indigo Tata SILVER 3 12
502 Innova Toyota WHITE 7 15
509 SX4 Suzuki SILVER 4 14
510 C-Class Mercedes RED 4 35
(i) SELECT COUNT(DISTINCT Make) FROM CARDEN;
(ii) SELECT COUNT(*) Make FROM CARDEN;
(iii) SELECT CarName FROM CARDEN WHERE Capacity = 4;
(iv) SELECT SUM (Charges) FROM CARDEN WHERE Color = “SILVER”;
34. Write the output of the queries (i) to (iv) based on the table FURNITURE given below.

Table : FURNITURE
FID NAME DATE OF PURCHASE COST DISCOUNT
B001 Double Bed 03-JAN-2018 45000 10
T010 Dinning Table 10-MAR-2020 51000 5
B004 Single Bed 19-JUL-2021 22000 0
C003 Long back Chair 30-DEC-2016 12000 3

Install NODIA App to See the Solutions.


Click Here To Install
CBSC 12th Computer Science Sample Paper 02 Page 7

T006 Console Table 17-NOV-2019 15000 12


B006 Bunk bed 01-JAN-2021 28000 14
(i) SELECT SUM(DISCOUNT) FROM FURNITURE WHERE COST>15000;
(ii) SELECT MAX(DATEOFPURCHASE) FROM FURNITURE;
(iii) SELECT * FROM FURNITURE WHERE DISCOUNT>5 AND FID LIKE “T%”;
(iv) SELECT DATEOFPURCHASE FROM FURNITURE WHERE NAME IN (“Dinning Table”, “Console
Table”);

35. Sony corporation has set up its 4 offices in the city of Srinagar, with its offices X, Z, Y, U:

Branch to Branch distance is given below:

X to Z 40 m
Z to Y 60 m
Y to X 135 m
X to U 70 m
Z to U 165 m
Z to U 80 m
Number of computers in each of the offices is as follows:

X 50
Z 130
Y 40
U 15
(i) Suggest a suitable cable layout of connectivity of the offices.
(ii) Suggest placement of server in the network with suitable reason.
(iii) Suggest placement of following devices in the network:
(a) Switch/Hub
(b) Repeater
(iv) Suggest a suitable topology for connecting the computers in each building.

SECTION - E
36. Consider the table APPLICANTS

TABLE: APPLICANTS
No NAME FEE GEN-DER C_ID JOINYEAR

Install NODIA App to See the Solutions.


Click Here To Install
Page 8 Sample Paper 02 NODIA

1012 Amandeep 30000 M A01 2012


1102 Avisha 25000 F A02 2009
1103 Ekant 30000 M A02 2011
1049 Arun 30000 M A03 2009
1025 Amber 40000 M A02 2011
1106 Ela 40000 F A05 2010
1017 Nikita 35000 F A03 2012
1108 Arluna 30000 F A03 2012
2109 Shakti 35000 M A04 2011
1101 Kirat 25000 M A01 2012
(i) Which field qualifies to be the Primary key.
(ii) If all the records of Male applicants are deleted, what will be the cardinality of the table.
(iii) Write statements to
(a) Increase FEE of “M” (Male) applicatnts by 2000.
(b) Display details of “F” (Female) applicants in descending order of FEE.
 o
(Option for part (iii) only)
Write statements to
(a) Change width of column FEE to 20.
(b) Remove the column C_ID.

37. (a) Carefully observe the following Python code and answer the question that follow:
x = 5
def func2():
x = 3
global x
x = x + 1
print(x)
print(x)
On execution the above code, produces the following output:
6 3
Explain the output with respect to the scope of the variables.
(b) Write the code to create a table Product in database Inventory with following fields

Fields Datatype
PID varchar(5)
PName char(30)
Price float
Rank varchar(2)
Note the following to establish the connection between Python and MySQL:
Host : localhost
Username : system
Password : hello
Database : Inventory

Install NODIA App to See the Solutions.


Click Here To Install

You might also like