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

Computer

Uploaded by

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

Computer

Uploaded by

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

CBSC 12th Computer Science Sample Paper 08 Page 1

Sample Paper 08
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


“A tuple is an Editable data store”.

2. Determine the output of the following code:


>>> a = 12
>>> b = 4
>>> print(“Output is”,(a+10*2+b))
(a) Output is 32 (b) Output is 36
(c) Output is None (d) None of these

3. The __________ mode opens a file for both reading and writing.
(a) wr (b) rw
(c) r+ (d) a+

4. Give the output for the following program segment given below.
for i in range (-5,-7,-1):
print (i + 1)
(a) -7,-6,-5 (b) -5,-6,-7
(c) No output (d) Error

Continue on next page.....


Page 2 Sample Paper 08 NODIA APP

5. In the readline() function, a line is terminated by:


(a) ‘\n’ (b) EOF
(c) Either (a) or (b) (d) None of these

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


text = “Machine Learning”
print(text[7:2:-2])

7. The join operation can combine __________ tables.s.


(a) 1 (b) 2
(c) 3 (d) Multiple

8. A table can have maximum..........primary key(s).


(a) 1 (b) 2
(c) 3 (d) Many

9. Which comments start with # symbol?


(a) Double line (b) Multi-line
(c) Single line (d) All of these

10. Identify the missing code to complete this snippet:


file = open(“logs.txt”, “r”)
logs = file.readlines()
print(logs[0])
file.close()

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


word = “Comprehension”
print(word[::3])

12. To ensure that values in the Salary column of a table are restricted to being more than 50000, which
constraint should be used?
(a) NULL (b) PRIMARY KEY
(c) CHECK (d) NOT NULL

13. To insert a record from Python to a mysql database the...........function needs to be executed.
(a) execute() (b) executeUpdate()
(c) executeQuery() (d) None of these

Continue on next page.....


CBSC 12th Computer Science Sample Paper 08 Page 3

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

15. A table can be sorted by...........fields.


(a) 1 (b) 2
(c) More than 2 (d) None of these

16. A device that connects the network cable to the NIC is


(a) RJ45 (b) Repeater
(c) Hub (d) Switch

17. Which index number represents the last character of a string?


(a) – 1 (b) 1
(c) 0 (d) n – 1

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


a, b = 8, 4
x, y = a + b, b - 2
z = x - y
print(“x:”, x, “y:”, y, “z:”, z)
(a) x: 12 y:3 z:10 (b) x: 10 y:3 z:12
(c) x: 16 y:3 z:12 (d) x: 12 y:2 z:10

19. The...........clause groups records by common values of a column.


(a) BETWEEN (b) ORDER BY
(c) HAVING (d) GROUP BY

Directions (Q. Nos. 20-21) are Assertion and Reason based questions.

20. Assertion (A) : Default parameters to a function are not compulsory but are a good practice to specify.
Reason (R) : If default parameters are specified the formal parameters will take the default values , if any
of the actual parameters are not passed.
(a) Both A and R are true and R is the correct explanation for A.
(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.

Continue on next page.....


Page 4 Sample Paper 08 NODIA APP

21. Assertion (A) : A recursive function requires a base condition.


Reason (R) : The base condition is the one that makes the function exit at a point.
(a) Both A and R are true and R is the correct explanation for A.
(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.

SECTION B
22. Determine the output for the following Python expressions:
(i) ‘amazing’.center(15, ‘#’)
(ii) ‘python123’.isalnum()

23. (a) Given the following code :


str1 = input (“Enter the string:”)
final = “”
for i in range(len(str1)):
if (i%2 == 0):
final = final + str1[i]
print(“Modified string is : ”,
final)
What is the above code doing?
(b) Consider the following list and answer the below questions.
l = [6, 9, 8, ‘Hi’, ‘Hello’, 45,
23, ‘New’]
(i) l[4:]
(ii) l[-4]
(iii) l[2:5]
(iv) ‘World’ in l

24. Identify the types of networks formed in the following cases :


(a) Two friends sharing files between a distance of 1000 km.
(b) A device transmitting voice to stations within a distance of 30 km.
 o
Write names of protocols used in following cases :
(a) A network user downloading a photograph from a server
(b) Two friends chatting over the web.

25. Write few advantages of SQL.

26. (a) Why is 256.200.192.1 not considered a valid IP address?


(b) What is the purpose of an IP address and how does it differ from a domain name? Provide examples to
illustrate each.
CBSC 12th Computer Science Sample Paper 08 Page 5

27. Distinguish between tuple and list.


 o
How can you add following data in empty dictionary?

Keys Values
A One
B Two
C Three
D Four

28. What is equi join ? Explain with an example.


 o
Identify the aggregate functions from the following list:
COUNT() , LEFT() , RIGHT() , MAX() , AVG() , TRIM()

SECTION C
29. Write a method Filterwords() to find and display words from the text file NewsLetter.txt that have a length
of less than 4 characters.
 o
Write a method countAN() that checks the number of occurrance of “A” and “N” in a text file “Story.txt”.

30. A linear stack named status contains the following information:


Employee’s Phone Number
Employee’s Name
Write the methods needed to perform the specified operations on the status stack.
(i) Push_element ( ) To Push an object containing Phone number of Employee and Name of Employee into
the stack.
(ii) Pop_element ( ) To Pop an object from the stack and to release the memory.
 o
Write a function to pop an element from a stack “s” using a function stackpop().

31. Write a user-defined function patterns(n) to display the following pattern for n lines, based on the number
passed to the function. The number should be entered in the main() function..
Example :
Enter a number : 4
4
44
444
4444
Enter a number 5
5
55
555
Page 6 Sample Paper 08 NODIA APP

5555
55555
 o
A user defined method to open a text file “para.txt” and display count of number of ‘c’ or ‘C’ and number
of ‘e’ or ‘E’ separately.
def test():
f=open(“Para.TXT”)
n1=0
n2=0
while True:
1=........... //Statement
if not 1:
break
for i in 1:
if (i ==‘E’ or i ==‘e’):
n1=n1+1
elif(i==‘C’ or i==‘c’):
n2=n2+1
print(n1)
print(n2)
f.close()
(a) Which module needs to be imported to use text file handling functions?
(b) Write the functionname to close a file object.
(c) Write the code best suitable for statement as marked.

SECTION D
32. (a) Write a program to find all numbers between 200 and 300 (inclusive) that are divisible by 7 but not
multiples of 5.
(b) Consider the table Faculty whose columns’ name are
F_ID, Fname, Lname, Hire_date,
Salary, Course_name
Write the code to insert the following record into the above table.

101 Riya Sharma 12-10-2004 35000 Java Advance


102 Kiyaan Mishra 3-12-2010 28000 Data Structure

 o
(a) Identify which of the following names are invalid and explain why:
(i) PaidInterest
(ii) S-num
(iii) Percent
(iv) 123
(b) What is the utility of fetchall() method? Write a code to fetch all the records of a Student table from
PythonDB Database.
Note :
CBSC 12th Computer Science Sample Paper 08 Page 7

Host : localhost
Database : PythonDB
User : root
Password:arihant
Table : Student

33. Which file can be opened with notepad as well as MS Excel?


A CSV file “Garment.csv” file exists containing records of different types of garments as per following
structure.
GarmentlD Type Gender Cost
Write a python program to add and search records of garments from the csv file and display using the
following functions :
(a) AddGarment() : Function to input details of garments and store them to the file “Garment.csv”, if the
garment type is “cotton” or “silk”.
(b) ShowGarments() : To open the file “ Garment.csv”, display details and number of “silk”.garments

34. (a) Consider the tables EMP and SALGRADE storing details of employees and their salaries.

Table: EMP
empno ename sal date
110 Priya 7000 11-11-2010
111 Seema 14000 15-02-2014
151 Sachin 30000 18-04-2015
142 Deepa 25000 20-05-2015

Table : SALGRADE
empno city lowsal hisal grade
110 Delhi 5000 10000 2
111 NCR 11000 13000 1
142 Meerut 10000 20000 5
With respect to the tables given above write a command to display the Employee names and the corresponding
cities.
(b) With respect to the tables given above , write commands for the following :
(i) To display the average salaries of all employees who are not from Delhi.
(ii) To display, maximum salary from the EMP table among employees whose date is after “2014”
(iii) To find the count of employees who are from “Delhi”
(iv) To display each employee’s name and Grade.

Continue on next page.....


Page 8 Sample Paper 08 NODIA APP

35. Given the following tables for a database LIBRARY


Write SQL commands (i) to (iv) with respect to the tables BOOKS and ISSUED

TABLE: BOOKS
Book_Id Book Name Author_Name Publishers Price Type Qty
F0001 The Tears William Hopkins First Publ 750 Fiction 10
F0002 Thunder bolts Anna Roberts First Publ 700 Fiction 5
T0001 My First C++ Brain & Brooke EPB 250 Text 10
T0002 C++ Brainworks A.W. Rossaine TDH 325 Text 5
C0001 Fast Cook Lata Kapoor EPB 350 Cookery 8

TABLE : ISSUED
Book_Id Quantity_Issued
F0001 3
T0001 1
C0001 5
(i) To show Book name, Author name and Price of books of EPB Publishers.
(ii) To list the names from books of Fiction type.
(iii) To display the names and price of the books in descending order of their price.
(iv) To increase the price of all books of First Publ Publishers by 50.
 o
Write the command to remove all the records of the BOOKS table keeping the structure.

SECTION E
36. G.R.K International Inc. is planning to connect its Bengaluru Office Setup with its Head Office in Delhi.
The Bengaluru Office G.R.K. International Inc. is spread across an area of approx. 1 square kilometres
consisting of 3 blocks. Human Resources, Academics and Administration. You as a network expert have to
suggest answers to the questions (i) to (v) raised by them.
Note Keep the distances between blocks and number of computers in each block in mind, while providing
them the solutions.

Shortest distances between various blocks

Human Resources to Administration 100 m


Human Resources to Academics 65 m
CBSC 12th Computer Science Sample Paper 08 Page 9

Academics to Administration 110 m


Delhi Head Office to Bengaluru Office Setup 2350 km
Number of computers installed at various blocks
Block Number of Computers
Human Resources 155
Administration 20
Academics 100
Delhi Head Office 20
(i) Suggest the most suitable block in the Bengaluru Office Setup to host the server. Give a suitable reason
with your suggestion.
(ii) Suggest the cable layout among the various blocks within the Bengaluru Office Setup for connecting the
blocks.
(iii) Suggest the placement of switch.
(iv) Suggest the most suitable media to provide secure, fast and reliable data connectivity between Delhi
Head Office and the Bengaluru Office Setup.
(v) Expand the following
WAN
LAN

37. Consider the following table

TABLE : PATIENTS
No Name Age Department Dateofadm Charges Sex
1 Kettu 16 ENT 24/02/23 300 F
2 Ankita 29 Cardiology 20/02/23 800 F
3 Rekha 45 Gynaecology 22/02/23 300 F
4 Kushi 19 Cardiology 13/01/23 800 M
5 Antim 31 Nuclear Medicine 19/02/23 400 M
(i) What should be the width of the Dateofadm field?
(ii) Write commands to remove the records of “Cardiology” department.
(iii) Write statements to :
(a) Display a report showing Name, charges and discount (15%) for all patients.
(b) Display names of female patients .
 o
(option for part (iii) only)
(a) Which function will find the total charges of all patients?
(b) Name the constraint that will restrict duplicate values in Name column.

 EN
CBSC 12th Computer Science Sample Paper 09 Page 1

Sample Paper 09
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


“A tuple is a immutable data type.”

2. The alternate to math.pow() function is______operator.


(a) ** (b) c $
(c) + = (d) /

3. Two tables are joined using a common field known as ______.


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

4. To print all elements of tuple in reverse order using______.


(a) [: – 1] (b) [: : – 1]
(c) [1 : : ] (d) [: : 1]

5. Given : s=“[email protected]”. What will be the output of print(s[2: :2])?


(a) ‘juagalcm’ (b) ‘jua@galcm’
(c) ‘ajua@galcm’’ (d) ‘jua@gmalcm’’
Continue on next page.....
Page 2 Sample Paper 09 NODIA APP

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


sentence = “Learning Python”
print(sentence[8:15])

7. Which of the following Python functions do not require importing of a module?


(a) type() (b) input()
(c) sqrt() (d) Both (a) and (b)

8. Which of the following modes open a text file, such that the new data is written in it keeping the existing
contents ?
(a) r+ (b) rw+
(c) w+ (d) a

9. The_____clause with the update command specifies the attribute to be modified.


(a) FIELD (b) ATTRIBUTE
(c) CHANGE (d) SET

10. Complete the code by filling in the blank with the appropriate line to move the file pointer:
file = open(“output.txt”, “r”)
data = file.read(20)
file.seek(5) # Move the file pointer to position 5
next_data = file.read(10)
file.close()

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


The `raise` statement in Python is used to manually trigger an exception.

12. Which type of network is typically used for a single site, covering a small range around an individual, such
as in a home or office setup?
(a) DSL (b) RAM
(c) WAN (d) PAN

13. Determine the output of the following code:


s1 = ‘Hello’
s2 = ‘World’
s = s1 + s2
print(s)
(a) Hello World (b) HelloWorld
(c) ‘Hellow’ ‘World’ (d) Error

14. The_____clause with GROUP BY, can filter groups from the query output.
(a) WHERE (b) FILTER
(c) HAVING (d) CHECK
CBSC 12th Computer Science Sample Paper 09 Page 3

15. Given a list L= [6,12,9,40,2,1]. Which of the following statements will arrange the list in reverse order
(a) L.arrange() (b) L.sort()
(c) L.sort(reverse=True) (d) L.sort(reverse=False)

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

17. An alternate key can be


(a) only 1 in a table. (b) a table can have maximum 2 alternate keys.
(c) a table can have at most 3 alternate keys. (d) multiple in a relation.

18. Which SQL category provides statements for manipulating database objects?
(a) DDL (b) DML
(c) DCL (d) TCL

19. Which attribute is used to return access mode with that file was opened?
(a) file.mode (b) mode.file
(c) file*mode (d) None of these

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

20. Assertion (A) : A python function can return more than one value to the calling function.
Reason (R) : The return statement takes only a list as parameter.
(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) : While opening a binary file the mode may not be specified.
Reason (R) : The open function for file opening by default takes the mode parameter as ‘rb’ for binary files,
if no mode is specified.
(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.

Continue on next page.....


Page 4 Sample Paper 09 NODIA APP

SECTION B
22. Find the output of the following code :
i = 1
while(i < 5):
print(i)
i = i * 2

23. (a) Correct the error if any in the following statement.


(i) a + 5 = b
(ii) 1 = 2b + c * d
(iii) name = Aryan
(iv) a = 20
print a;
(b) Evaluate the following expression
If a = b = 10, c = 5
a = b*3//4 + c//4 + 4– b + 5//6

24. Provide one appropriate example of a URL and a domain name.


 o
Is it possible to use a URL to access a webpage? If so, how?

25. Explain the UPDATE command in SQL, including its basic syntax and an example.

26. (a) Write any two characteristics of IP address.


(b) What is VoIP?

27. Write the one example of following terms.


(i) Identifier (ii) Punctuator
(iii) Keyword (iv) Constant
 o
What will be the output of the following code?
a, b = 8, 4
x, y = a + b, b - 2
z = x - y
print(“x:”, x, “y:”, y, “z:”, z)

28. Expand the following abbreviation :


(i) SQL (ii) DML
(iii) DDL (iv) TCL
 o
Mention two characteristics of SQL.
CBSC 12th Computer Science Sample Paper 09 Page 5

SECTION C
29. Write a Python function that accepts a sentence and counts the occurrences of the words “is” and “was”.
Example
Input: “It is what it is. The situation was complex and still is.”
Output:
Number of “is”: 3
Number of “was”: 1
 o
Write a definition of a function that takes input a sentence and display the list of words that start with a
lowercase vowel and list of words that start with a uppercase vowel separately.
Example
Input : A quick black elephant enters Into a jungle.
Output
List of words starting with lowercase vowels [‘elephant’, ‘enters’, ‘a’]
List of words starting with uppercase vowels [‘A’, ‘Into’]

30. How can you create a Python function to repeatedly accept person names and add them to a list, ensuring
that each name only contains letters, spaces, and periods (.) without any digits?
 o
Find the final contents of a stack that encounters the following tokens.
Assume that an operand is pushed to stack and a binary operator pops two operands from stack and pushes
the result to the stack.
100,8,3,*,50,2,+,+,*

31. Write a program that calculates the sum and mean of a series of numbers entered by the user.
 o
A user-defined method to open a text file “para.txt” and write its contents to another file fter removing the
3rd line
def Func():
with open (‘Para.txt’, ‘r’) as f:
l=f.readlines()
f.close()
print(l)
del l[3]
print(l)
f=open (‘Para.txt’, ‘w’)
f...........
f.close()
(a) Which module needs to be imported to use operating system functions like rename() and remove().
(b) Write the function name to open a text file.
(c) Fill the blank as marked in above code.

Continue on next page.....


Page 6 Sample Paper 09 NODIA APP

SECTION D
32. (a) Write a Python program to find maximum and minimum elements in a tuple.
(b) Consider the table MobileStock with following fields
M_Id, M_Name, M_Qty, M_Supplier
Write the Python code to fetch all records with fields M_Id, M_Name and M_Supplier from database
Mobile.
 o
(a) Which of the following are invalid names and why?
(i) Paidlnterest (ii) S-num
(iii) Percent (iv) 123
(b) Write the steps for Database connectivity with short explanation of each step.

33. What does tell() method do?


(a) AddRegistration() :To accept more student registration data and store them to the binary file keeping
the existing registration data.
A Binary file “Registration.dat” exists storing details of students who have been registeredfor CBSE
board exams. The file stores following data of students :
RegnNo StudName class No of subjects
(b) CountRegistrations() : Display count of registrations using the functions.

34. Consider the following tables PRODUCT and CLIENT

TABLE : PRODUCT
PID ProductName Manufacturer Price
TP01 Powder LAK 40
FW05 Face Cleaner ABC 45
BS01 Liquid Soap ABC 55
SH06 Dove Shampoo XYZ 120
FW12 Face Wash XYZ 95

TABLE : CLIENT
C_ID ClientName City P_ID
01 Cosmetic Shop Delhi FW05
06 Total Health Mumbai BS01
12 Life care Delhi SH06
15 Pretty Store Delhi FW12
16 Dreams Bengaluru TP01
(a) To display the ClientName, City from table CLIENT and ProductName and Price from table PRODUCT,
with their corresponding matching P_ID.
(b) Write SQL queries for statements (i) to (iv)
CBSC 12th Computer Science Sample Paper 09 Page 7

(i) To display the details of those Clients, whose City is Delhi.


(ii) To display the details of products, whose Price is in the range of 50 to 100 (both values included).
(iii) To display product name and their manufacturer whose Price is more than 100.
(iv) To display client name for those whose product id is FW12.

35. Write SQL commands (i) to (iv) for the following tables :

TABLE : STUDENT
S NO NAME STREAM FEES AGE SEX AID
1 RAJAN KUMAR COMPUTER 750.00 17 M A1
2 DEEPA JENEJA COMPUTER 750.00 18 F A2
3 KESHAR MEHRA BIOLOGY 500.00 16 M A2
4 SACHIN SINGH ENG. DR 350.00 18 M A1
5 PRACHI ECONOMICS 300.00 19 F A3
6 NISHA ARORA COMPUTER 750.00 15 F A3
7 NEEL KUMAR ECONOMICS 300.00 16 M A1
8 SARIKA VASWANI BIOLOGY 500.00 15 F A1

TABLE: ADDRESS
AID City
Al Jaipur
A2 Bengaluru
A3 Delhi
(i) List the name of all the students, who have taken stream as COMPUTER.
(ii) To count the number of female students.
(iii) To display the number of students stream wise.
(iv) To display names of the students with corresponding cities.
 o
Write the command to display all the tables in the database.

Continue on next page.....


Page 8 Sample Paper 09 NODIA APP

SECTION E
36. Expertia Professional Global (EPG) is an online corporate training provider specializing in IT-related
courses. The company is establishing a new campus in Mumbai, and as a network expert, you are tasked
with analyzing the physical layout of various buildings and determining the optimal number of computers
to be installed in each location. During the planning phase, you must provide the most effective solutions
for the queries (i) to (v) that have been raised by the company..
Physical locations of the buildings of EPG

Building to building distance (in metre)

From To Distance
Administrative Building Finance Building 60
Administrative Building Faculty Studio Building 120
Finance Building Faculty Studio Building 70
Expected computers to be installed in each building

Buildings Computers
Administrative Building 20
Finance Building 40
Faculty Studio Building 120
(i) Suggest the most appropriate building, where EPG should plan to install the server.
(ii) Suggest the most appropriate building to building cable layout to connect all three buildings for efficient
communication.
(iii) Which type of network out of the following is formed by connection the computers of these three
buildings?
(a) LAN (b) MAN (c) WAN
(iv) Write the difference between LAN and MAN.
(v) Expand the following
(a) WAN (b) MAN

Continue on next page.....


CBSC 12th Computer Science Sample Paper 09 Page 9

37. Consider the following table ORDERS :

TABLE : ORDERS
O_Id Order Date OrderPrice Customer
1 2008/11/12 1000 Hansen
2 2008/10/23 1600 Nilsen
3 2008/09/02 700 Hansen
4 2008/09/03 300 Hansen
5 2008/08/30 2000 Jensen
6 2008/10/04 100 Nilsen
(i) Write a statement to create the above table.
(ii) Write a command to change the width of Customer column to varchar(30)
(iii) Write statements to :
(a) Display the field names, their type , size and constraints .
(b) Display details of orders where orderprice is in the range 500 to 1500
 (Option for part iii only)
o
(a) Write a command to increase orderprice of all orders by 15%.
(b) Name the constraint that will restrict both NULL and DUPLICATE values in the O_Id field.

 EN
CBSC 12th Computer Science Sample Paper 10 Page 1

Sample Paper 10
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


‘A dictionary is ordered by index”.

2. The output of print(math.ceil(17.34)) is


(a) 18 (b) 17
(c) 10 (d) 20

3. The...........clause is used in SQL to specify a range of values.


(a) WHERE (b) DROP
(c) BETWEEN (d) RANGE

4. Two friends have connected their computers but are experiencing weak signals. Which device should they
use to improve signal strength?
(a) Repeater (b) Hub
(c) Switch (d) Modem

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


phrase = “Database Management”
print(phrase[-5:-15:-4])
Page 2 Sample Paper 10 NODIA APP

6. ______method creates a cursor object while connecting a Python application with a Mysql database.
(a) connection( ) (b) connect( )
(c) cursor( ) (d) None of these

7. In which mode is a file opened by default?


(a) r (b) rw+
(c) w (d) a

8. Which attribute is used to return access mode with that file was opened?
(a) mode.file (b) mode.file.name
(c) file.mode (d) file.mode.type

9. Identify the option that is not a DDL (Data Definition Language) command:
(a) ALTER (b) CREATE
(c) DROP (d) DELETE

10. Fill in the blank to finish the code snippet:


file = open(“datafile.txt”, “r”)
file.seek(30)
data = file.read(20)
_________________
print(file.read())
file.close()

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


The `try` and `except` blocks in Python are used for debugging purposes only.

12. Which module is required to use the mode function?


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

13. The.........command can be used to remove all records of a table along with the table structure.
(a) DELETE TABLE (b) DROP TABLE
(c) REMOVE TABLE (d) None of these

14. What is the output of the following code?


a = 5
b = 3
print(a + 10 * 2 + b)
(a) 32 (b) 28
(c) 40 (d) 45
CBSC 12th Computer Science Sample Paper 10 Page 3

15. Which function is used to generate a sequence of numbers over a period of time?
(a) range() (b) len()
(c) limit() (d) lim()

16. Which of the following symbol is used in Python for comments?


(a) $ (b) @
(c) // (d) #

17. Given a list Lst= [65,182,90,420,20,10]. What will be the correct statement to take out the 3rd element from
the list?
(a) Lst.pop(2) (b) L.find(2)
(c) L.pop(–1) (d) L.del(90)

18. What is the relationship between Primary key, Candidate key, and Alternate key?
(a) Primary key = Candidate key - Alternate key
(b) Candidate key= Primary key - Alternate key
(c) Alternate key= Primary key+ Candidate key
(d) None of the above

19. The first integrity rule for relational databases ensures that_____
(a) Primary key is unique
(b) Foreign key is unique
(c) Primary key is unique and NOT NULL
(d) There is only one candidate key

Directions (Q.Nos. 20-21) are Assertion and Reason based questions.

20. Assertion (A) : User-defined functions must stay in a Python module.


Reason (R) : Each user-defined function must stay in a module ,which is linked to a folder where all the user
defined functions of the module stay.
(a) Both A and R are true and R is the correct explanation for A.
(b) Both A and R are true but R is not the correct explanation for A.
(c) A is true but R is false.
(d) A is false but R is true.

21. Assertion (A) : Python supports addition of data in file , preserving the previous data.
Reason (R) : The write mode erases all previous data of a pre-existing file.
(a) Both A and R are true and R is the correct explanation for A.
(b) Both A and R are true but R is not the correct explanation for A.
(c) A is true but R is false.
(d) A is false but R is true.
Page 4 Sample Paper 10 NODIA APP

SECTION B
22. Write the corresponding Python expression for the following mathematical expression.
a
(i) z = a + b – d2

(ii) z = x2 + y 3

23. (a) Identify which of the following identifiers are valid. If any are invalid, provide the reason..
(i) name_1 (ii) _SUM
(iii) $Sum (iv) num ^ 2
(b) Find the output of the following code
i=1
while (i<4):
print(i)
i=i*2

24. Mr. GopiNath, Associate Manager of Unit Nations corporate, recently discovered that the communication
between his company’s accounts office and HR office is extremely slow, and signals drop quite frequently.
These offices are 120 meters apart and connected by an Ethernet cable.
(i) Suggest him a device which can be installed in between the office for smooth communication.
(ii) What type of network is formed by having this kind of connectivity out of LAN, MAN and WAN?
 o
Define hub and write its functions and types.

25. Differentiate between char(n) and varchar(n) data types with respect to databases.

26. (a) Mention any two advantages of E-mail over conventional, mail.
(b) Mr. Lal owns a factory which manufactures automobile spare parts. Suggest him the advantages of
having a web page for his factory

27. Name the tokens that are available in Python.


 o
Find the syntax error in the following program and underline after correct them.
90 = w
while(w > 60)
print(w)
w = w – 50

28. Explain the use of ORDER BY clause.


 o
What are DDL and DML?
CBSC 12th Computer Science Sample Paper 10 Page 5

SECTION C
29. Write a method countFile() that counts and displays the number of lines starting with the word “FILE”
(considering both lowercase and uppercase) in the text file “start.txt”.
e.g. If the file “start.txt” contains the following lines:
Get the data value to be deleted,
Open the file for reading from it.
Read the complete file into a list
Delete the data from the list
Open the file
Open same file for writing into it
Write the modified list into file.
Close the file.
The method should display
Total lines started with word ‘FILE’ is/are: 0
 o
Define a function that takes a sentence as input and displays a list of words that end with a lowercase vowel
and a list of words that end with a lowercase consonant.

30. Write the Push operation for a stack that stores person names. Ensure that the names only accept characters,
spaces, and periods (.), excluding digits. Assume that Pname is an instance attribute of the class.
 o
Determine the final contents of a stack that processes the following tokens. Assume that an operand is
pushed onto the stack, and a binary operator pops two operands from the stack, performs the operation,
and then pushes the result back onto the stack..
(100, 8, 3, *, 50, 2, +, +, *)

31. Write a program that counts how often each element appears in a list provided by the user.
 o
A user-defined method to open the text file “Author.txt” and display the lines that contain an even number
of words.
def evenwords():
f=open(“Author.txt”)
ln=f.readlines()
for line in ln:
linex=............// Statement
if len(linex)%2==0:
print(line)
f.close()
(a) How is readline() method different from readlines() method in Python?
(b) Write the use of the reader object in csv file operations.
(c) Fill the blank as marked statement.

Continue on next page.....


Page 6 Sample Paper 10 NODIA APP

SECTION D
32. (a) Write a Python program to merge the following dictionaries into a new one:
d1 = {‘X’: 15, ‘Y’: 25}
d2 = {‘Z’: 35, ‘W’: 45}
d3 = {‘P’: 55, ‘Q’: 65}
(b) Consider the table MobileStock with following fields
M_Id, M_Name, M_Qty, M_Supplier
Write the Python code to fetch all records with fields M_Id, M_Name and M_Supplier from database
Mobile.
 o
(a) Sohan has a list containing 8 integers as marks of subject Science. You need to help him to create a
program with separate user defined function to perform the following operations based on the list.
(i) Push those marks into a stack which are greater than 75.
(ii) Pop and display the content of the stack.
Simple Input
Marks = [75, 80, 56, 90, 45, 62, 76, 72]
Sample Output
80 90 76
(b) Consider the following table Traders with following fields

TCode TName City


T01 Electronic Sales Mumbai
T03 Busy Store Corp Delhi
T02 Disp House Inc Chennai
Write Python code to display the names of those traders who are either from Delhi or from Mumbai.

33. What is difference between tell() and seek() methods?


A Binary file “lottery.dat” stores details of lottery ticket holders . The file stores the following details :
TicketNo State Type Prizemoney
Write a program using two functions to operate the file data.
(a) AddBuyers(State) : To accept more ticket details and store them into the file only if the ticket is not
from state passed as parameter to the function.
(b) TicketSearch(tid) : To open the file “lottery.dot” and display details of the ticket whose id is supplied
as the parameter to the function.

34. Consider the tables FAMILY and Occupation:

TABLE FAMILY
No Name Female Members Male Members Income Occup-ationId
1 Mishra 3 2 7000 O1
2 Gupta 4 1 50000 O2
3 Khan 6 3 8000 O2
4 Chaddha 2 2 25000 O1
CBSC 12th Computer Science Sample Paper 10 Page 7

5 Yadav 7 2 20000 O3
6 Joshi 3 2 14000 O2
7 Maurya 6 3 5000 O1
8 Rao 5 2 10000 O3

Table : OCCUPATION
Occupationld Type
O1 Service
O2 Business
O3 Mixed
(a) To display Family name , corresponding occupation and income where male members are more than 2.
(b) Write SQL queries for statements (i) to (iv) based on tables FAMILY and Occupation.
(i) To select all the information of family, whose Occupation is Service.
(ii) To list the name of family, where female members are more than 3.
(iii) To list all names of family with income in ascending order.
(iv) To count the number of family, whose income is less than 10000.

35. Study the following tables DOCTOR and SALARY and write SQL commands for the questions (i) to (iv).

TABLE: DOCTOR
ID NAME DEPT SEX EXPER-IENCE
101 John ENT M 12
104 Smith ORTHOPEDIC M 5
107 George CARDIOLOGY M 10
114 Lara SKIN F 3
109 K George MEDICINE F 9
105 Johnson ORTHOPEDIC M 10
117 Lucy ENT F 3
111 Bill MEDICINE F 12
130 Morphy ORTHOPEDIC M 15

TABLE: SALARY
ID BASIC ALLOWANCE CONSULTATION
101 12000 1000 300
104 23000 2300 500
107 32000 4000 500
114 12000 5200 100
109 42000 1700 200
105 18900 1690 300
130 21700 2600 300
Page 8 Sample Paper 10 NODIA APP

(i) Display NAME of all doctors who are in MEDICINE department having more than 10yrs experience
from the table DOCTOR.
(ii) Display the average salary of all doctors working in ENT department using the tables DOCTOR and
SALARY. SALARY = BASIC + ALLOWANCE.
(iii) Display the minimum ALLOWANCE of female doctors.
(iv) Display the highest consultation fee among all male doctors.
 o
Write the command to change the data type of consultation to double(8,3).

SECTION E
36. Workalot Consultants are establishing a secure network for their office campus in Gurgaon to support
their daily office and web-based activities. They plan to set up connectivity between three buildings on the
campus and the head office located in Mumbai. Please answer the questions (i) to (v) after reviewing the
building positions and other details provided below.

Distance between various buildings

Building GREEN to Building RED 110 m


Building GREEN to Building BLUE 45 m
Building BLUE to Building RED 65 m
Gurgaon Campus to Head Office 1760 km
Number of computers

Building GREEN 32
Building RED 150
Building BLUE 45
Head Office 10
(i) Suggest the most suitable place (i.e. building) to house the server of this organisation. Also, give a
reason to justify your suggested location.
(ii) Suggest a cable layout of connections between the buildings inside the campus.
(iii) Suggest the placement of the following devices with justification :
(a) Switch
CBSC 12th Computer Science Sample Paper 10 Page 9

(b) Repeater
(iv) Write the use of Modem in a network.
(v) What is the use of firewall in network?

37. Consider the following table FLIGHTS :

TABLE : FLIGHTS
FL_NO STARTING ENDING NO_FLIGHT NO_STOPS
IC301 MUMBAI DELHI 8 0
IC799 BENGALURU DELHI 2 1
MC101 INDORE MUMBAI 3 0
IC302 DELHI MUMBAI 8 0
AB812 KANPUR BENGA- LURU 3 1
IC899 MUMBAI KOCHI 1 4
AM501 DELHI TRIVAN- DRUM 1 5
MU499 MUMBAI MADRAS 3 3
IC701 DELHI AHME- DABAD 4 0
(i) The command to create the table was written as :
Create table FLIGHTS( FL_NO integer, STARTING char(20), ENDING char(30), NO_FLIGHT
integer, NO_STOPS integer);
What is wrong with command ?
(ii) What is the cardinality of the table ?
(iii) Which functions will be used to :
(a) Display total number of flights .
(b) Display number of flights whose FL_NO starts with “IC”
 o
(option for part (iii) only)
Write function names to :
(a) Show the average Number of stops.
(b) Show the maximum number of stops.

 EN

You might also like