[go: up one dir, main page]

0% found this document useful (0 votes)
17 views10 pages

cblecspu07

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 10

CBSC 12th Computer Science Sample Paper 07 Page 1

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


Integer is a mutable data type in Python.

2. Which of the following functions is used to write data to a binary file?


(a) pickle() (b) writer()
(c) load() (d) dump()

3. _____ can be created using the cursor() method of a connection object.


(a) Cursor object (b) Cursor variable
(c) Connect (d) None of these

4. _____command displays the contents of a table.


(a) DISPLAY (b) VIEW
(c) SELECT (d) SHOW

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


b = 1
for a in range(1, 10, 2):
b += a + 2

Install NODIA App to See the Solutions.


Click Here To Install
Page 2 Sample Paper 07 NODIA

print(b)
(a) 31 (b) 33
(c) 36 (d) 39

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


phrase = “Deep Learning”
print(phrase[4::-1])

7. Which of the following Python function displays the memory id of a variable?


(a) type( ) (b) str( )
(c) getid( ) (d) id( )

8. Which of the following is an advantage of SQL?


(a) High speed (b) Client/Server language
(c) Easy to learn (d) All of these

9. Which operator is used for integer division?


(a) * (b) //
(c) / (d) **

10. Insert the missing statement to complete this code snippet:


file = open(“notes.txt”, “r+”)
file.write(“New Text”)
print(file.read())
file.close()

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


In Python, the `else` block following a `try` block is executed only when no exception occurs in the `try`
block.

12. Predict the output of the following program:


a = 5
b = a = 15
c = (a < 15)
print (“a = ”, a)
print (“b = ”, b)
print (“c = ”, c)
(a) a=15 (b) a=15
b=15 b=10
c=False c=True
(c) a=15 (d) None of these
b=None
c=False

Install NODIA App to See the Solutions.


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

13. Given s=“AISSE@2023”. What will be the output of print(s[-1: :-1])?


(a) ‘3202@ESSIA’ (b) 3
(c) AISSE (d) ESSIA

14. A primary key of a relation must be_____.


(a) UNIQUE only (b) NOT NULL only
(c) Both UNIQUE and NOT NULL (d) Neither UNIQUE nor NOT NULL

15. Which clause is used to group records based on shared values within a specific field?
(a) JOIN (b) GROUP
(c) GROUP BY (d) AGGREGATE

16. Which Python function appends the elements of one list to the end of another list?
(a) join() (b) add()
(c) append() (d) extend()

17. Which of the following functions will read entire contents of a text file?
(a) read() (b) readfull()
(c) readline() (d) readfile()

18. What is another name for a cross join in SQL?


(a) Merging (b) Cartesian product
(c) Natural join (d) Equi join

19. Which protocol serves as the foundation for all application protocols?
(a) FTP (b) TCP/IP
(c) IRCP (d) Telnet

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

20. Assertion (A) : Pickling is a way to convey a Python object into character stream.
Reason (R) : To perform pickling, the pickle module needs to be imported.
(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. A.

Continue on next page.....

Install NODIA App to See the Solutions.


Click Here To Install
Page 4 Sample Paper 07 NODIA

21. Assertion (A) : A recursive function does not require a loop.


Reason (R) : A recursive function calls itself again and again until a certain condition is true.
(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.

SECTION B
22. Examine the code provided below and determine the output:
s = “oceanview”
count = 0
for a in s:
if a in “stuv”:
count += 1
print(count)

23. (a) Given the following code :


d={‘Bed’:145000, ‘Almirah’:9000,
‘Chair’:1000}
for v in d.keys():
if d[v]>100000:
d[v]– =10000
print(d)
What will be the output of the print statement?
(b) State the value stored in the variable Num after each of the following statements.
(i) Num = 2 * 3 – 4
(ii) Num = 2+3–1*3
(iii) Num = (2+3)*2

24. Provide a detailed explanation of a database and a Database Management System (DBMS).

25. What is the distinction between video conferencing and chat?


 o
What is WWW?

26. (a) Write the full forms of :


(i) RJ45 (ii) XML
(b) Write one advantages of Bus topology compared to Star and one advantage of star topology compared
to Bus.

Continue on next page.....

Install NODIA App to See the Solutions.


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

27. What output will the following code produce?


y = str(456)
x = “hi” * 4

print(x, y)
x = “hi” + “there”
y = len(x)
print(y, x)
 o
Write function names for the following with respect to strings.
(i) To make the first letter of a string in capital
(ii) To find the index of the 1st occurrence of a string in another

28. Define DDL and explain its commands with examples.


 o
What is DML? Explain with its commands.

SECTION C
29. Write a Python program to open a binary file named “College.dat,” which contains student records with
the structure:
Roll Name SemPercentage
The program should display only the records of students whose percentage is above 30.
 o
Create a method countopen() to count and display the number of lines that start with the word “OPEN”
(case-insensitive) in a text file named “start.txt”.
For example, if “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 ‘OPEN’ is/are: 3

30. Describe the traversal operation in a stack and provide the algorithm for traversing a stack to display its
contents. There is no need to write the actual code.
 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.
7,11,*,80,+,50,+

Install NODIA App to See the Solutions.


Click Here To Install
Page 6 Sample Paper 07 NODIA

31. Write a user-defined function that accepts a string and checks whether it is a palindrome (a string that reads
the same forwards and backwards).
 o
A program in python to modify records of a binary file “hotel.dat” using random access. The program would
accept the room id , search the record by random access and display. It will then accept the new data and
modify the file.
The file structure is :
Roomld Customer Name Days
import pickle
1st=[]
f=open(“hotel.dat”, “rb+”)
ans=‘y’
while ans==‘y’:
r=int(input(“Enter roomid to
modify :”))
1st=pickle.load(f)
size=f.tell()
f.seek(0)
f.seek((r-1)*size)
1st=pickle.load(f)
print(“old record ”)
print(“Room Id :”, 1st[0])
print(“Customer :”, 1st[1])
print(“Days :”, 1st[2])
f.seek(0)
... ... ... # Statement 1
print(“Enter new record ”)
nm=input(“Enter, customer name
:”)
days=input(“Enter days :”)
rs=str(r)
1st=[rs,nm,days]
pickle.dump(1st,f)
ans=input(“Modify another(y/n)”)
f.close()
(i) What type of data is returned by the load() method?
(ii) Which method closes a binary file?
(iii) What will be inserted in statement 1?

SECTION D
32. (a) Underline the errors in the following code and write the correct code:
s= WelcometoCS”
For a IN s :
If a IN “aeiou” :
print(a)
else
print(“False”)

Install NODIA App to See the Solutions.


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

(b) Write a code in Python to update the class of a student to 12 whose roll number is 22. The table
structure is as follows :
RollNo Name Class Perc
Note :
Database : PythonDB
Table : Student
Host : localhost
UserId : root
Password : arihant
 o
(a) Write the output of the following function
def showOutput( ):
num=4 + float(7)/int(2.0)
print(“num =”, num)
(b) Write a code in Python to delete the record of a student whose rollno is 33. The table structure is as
follows
RollNo Name Class Perc
Note :
Database : PythonDB
Table : Student
Host : localhost
UserId : root
Password : arihant

33. (a) Consider the following tables PERSON and ORDERS

Table : PERSON
P_Id Last_Name First_Name City
1 Sharma Abhay Mumbai
2 Gupta Mohan Delhi
3 Verma Akhil Mumbai

Table : ORDERS
O_Id Order_No P_Id
1 10050 3
2 25000 3
3 5687 1
4 45000 1
5 35000 15
With respect to the tables given above write a command to display the Lastname, Firstname and
corresponding order number arranged by Lastname.
(b) With respect to the table PAYMENTS given below, write, output of the following questions.

TABLE : PAYMENTS
Empld Emp_Name Salary Department
1 Ridhi 20000 D1

Install NODIA App to See the Solutions.


Click Here To Install
Page 8 Sample Paper 07 NODIA

2 Rohit 25000 D2
3 Rakesh 20000 D2
4 Roshan 44000 D1
5 Rohini 15000 D3
6 Radha 14000 D1
(i) To display the average of employees salary from PAYMENTS table.
(ii) To count the total number of employees from PAYMENTS table Department wise
(iii) To count distinct values of column Department from PAYMENTS table.
(iv) To display department wise number of employees , but for only those departments where number of
employees are more than 2.

34. Write SQL commands from (i) to (iv) on the basis of the table INTERIORS given below

TABLE : INTERIORS
No ITEMNAME TYPE DATEOF-STOCK PRICE DISC-OUNT
1 Red rose Double Bed 23/02/02 32000 15
2 Soft touch Baby cot 20/01/02 9000 10
3 Jerry’s home Baby cot 19/02/02 8500 10
4 Rough wood Office Table 01/01/02 20000 20
5 Comfort zone Double Bed 12/01/02 15000 20
6 Jerry look Baby cot 24/02/02 7000 19
7 Lion king Office Table 20/02/02 16000 20
8 Royal tiger Sofa 22/02/02 30000 25
9 Park sitting Sofa 13/12/01 9000 15
10 Dine Paradise Dining Table 19/02/02 11000 15
11 White Wood Double Bed 23/03/03 20000 20
12 James 007 Sofa 20/02/03 15000 15
13 Tom look Baby cot 21/02/03 7000 10
(i) To show all information about the Sofa from the INTERIORS table.
(ii) To list the ITEMNAME, which are priced at more than 10000 from the INTERIORS table.
(iii) To list ITEMNAME and TYPE of those items, in which DATEOFSTOCK is before 22/01/02 from the
INTERIORS table in descending order of ITEMNAME.
(iv) To insert a new row in the INTERIORS table with the following data
{14, ‘TrueIndian’, ‘Office Table’, ‘25/03/03’, 15000, 20}
 o
Write the command to display the sum of prices of items of type “cot”.

Continue on next page.....

Install NODIA App to See the Solutions.


Click Here To Install
CBSC 12th Computer Science Sample Paper 07 Page 9

35. What is the purpose of the writerows() function for handling CSV files?
A binary file named “Hotel.dat” stores hotel customer details with the following structure:
Roomld CustomerName Days
Write a program in python for adding and displaying records from the binary file using following functions
(a) Reserve() : To add data of customers to the binary file.
(b) ShowReservations() : To open the file “Hotel.dat” and display all the records.

SECTION E
36. Tech Up Corporation (TUC) is a professional consultancy firm planning to establish new offices in India, with
Hyderabad as its central hub. As their network consultant, you are tasked with assessing their requirements
and recommending optimal solutions. Their queries are listed below from (i) to (v).
Physical locations of TUC’s blocks:

Block to block distances (in metre)

Block (From) Block (To) Distance


Human Resource Conference 60
Human Resource Finance 120
Conference Finance 80
Expected number of computers to be installed in each block

Block Computers
Human Resource 125
Finance 25
Conference 60
(i) What will the most appropriate block, where TUC should plan to install their server?
(ii) Draw a block to block cable layout to connect all the buildings in the most appropriate manner for
efficient communication.
(iii) Write names of different types of Modems.
(iv) Which of the following devices will be suggested by you to connect each computer in each of the
buildings?
(a) Gateway (b) Switch (c) Modem
(v) Company is planning to connect its Block in Hyderabad which is more than 20 km. Which type of
network will be formed?

Continue on next page.....

Install NODIA App to See the Solutions.


Click Here To Install
Page 10 Sample Paper 07 NODIA

37. Consider the following table

TABLE : INTERIORS
No ITEM NAME TYPE DATE OF STOCK PRICE DISCOUNT
1 Red rose Double Bed 23/02/02 32000 15
2 Soft touch Baby cot 20/01/02 9000 10
3 Jerry’s home Baby cot 19/02/02 8500 10
(i) What should be the data type for the DATEOFSTOCK column?
(ii) Write a command to add a new record as follows :
4, “Morris”,”Sofa Set”
Rest of the field values are not given
(iii) Write statements to :
(a) Write a command to display only the Column ITEMNAME, Net Amount(PRICE-DISCOUNT)
(b) Display only ITEMNAME and Discount column.
 o
(Option for part (iii) only)
(a) Which clause is to be used to search non blank values in the table?
(b) Which command will be used to make the “No” column as the primary key?

 EN

Install NODIA App to See the Solutions.


Click Here To Install

You might also like