100% found this document useful (1 vote)
321 views

CS Sample Paper 7

Uploaded by

stavyagarg123
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
100% found this document useful (1 vote)
321 views

CS Sample Paper 7

Uploaded by

stavyagarg123
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/ 9

Page 1 Sample Paper 7 Computer Science Class 12

Sample Paper 7
Computer Science (083)
CLASS XII 2023-24
Time: 3 Hours Max. Marks: 70
General Instructions:
1. Please check this question paper contains 35 questions.
2. The paper is divided into 4 Sections- A, B, C, D and E.
3. Section A, consists of 18 questions (1 to 18). Each question carries 1 Mark
4. Section B, consists of 7 questions (19 to 25). Each question carries 2 Marks.
5. Section C, consists of 5 questions (26 to 30). Each question carries 3 Marks.
6. Section D, consists of 2 questions (31 to 32). Each question carries 4 Marks.
7. Section E, consists of 3 questions (33 to 35). Each question carries 5 Marks.
8. All programming questions are to be answered using Python Language only.

Section A

1. Which of the following functions write data to a binary file?


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

2. _____can be create using cursor( ) method of connection object.


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

3. _____command displays the contents of a table.


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

4. State True or False


Integer is a mutable data type in Python.

5. Identify the output of the following Python statement:


b = 1
for a in range(1, 10, 2):
b += a + 2
print(b)
(a) 31 (b) 33
(c) 36 (d) 39

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


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

Install NODIA App to See the Solutions.


Click Here To Install
Page 2 Sample Paper 7 Computer Science Class 12

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


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

8. Which of the following operator performs an integer division?


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

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

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


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

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

12. The........clause can group records on the basis of common values in a field.
(a) AGGREGATE (b) GROUP
(c) GROUP BY (d) JOIN

13. The python function that adds a list at the end of another list is
(a) join() (b) add()
(c) append() (d) extend()

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

15. The cross join is also called


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

Install NODIA App to See the Solutions.


Click Here To Install
Page 3 Sample Paper 7 Computer Science Class 12

16. ______is the base protocol for all application protocols.


(a) FTP (b) TCP/IP
(c) IRCP (d) Telnet

Direction : (Q.Nos. 17-18) are Assertion and Reason based questions.

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

18. 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
19. Observe the code given below and find the output :
s= “oceanview”
count=0
for a in s:
if a in “stuv”:
count+=1
print(count)

20. What is the difference between video conferencing and chat?


 o
What is WWW?

21. (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) Write the value stored in the variable Num by each of the following statements.
(i) Num = 2 * 3 – 4
(ii) Num = 2+3–1*3
(iii) Num = (2+3)*2

Install NODIA App to See the Solutions.


Click Here To Install
Page 4 Sample Paper 7 Computer Science Class 12

22. Explain database and DBMS in detail.

23. (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.

24. What output will the following code produce?


y=str(123)
x= “hello”*3
print(x,y)
x=“hello” + “world”
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

25. What is DDL? Explain with its commands.


 o
What is DML? Explain with its commands.

Section C
26. (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.

Install NODIA App to See the Solutions.


Click Here To Install
Page 5 Sample Paper 7 Computer Science Class 12

(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

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.

27. Write a code in Python to open a Binary file “College.dat” containing records of students as per following structure:
Roll Name SemPercentage
The code should display only records of students from the file where the percentage is greater than 30.
 o
Write a method countopen( ) to count and display the number of lines starting with the word ‘OPEN’ (including
lower cases and upper cases) present in a 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 ‘OPEN’ is/are: 3

Install NODIA App to See the Solutions.


Click Here To Install
Page 6 Sample Paper 7 Computer Science Class 12

28. (a) Write SQL commands from (i) to (iv) on the basis of the table INTERIORS given below
TABLE : INTERIORS

No ITEMNAME TYPE DATEOF- PRICE DISC-OUNT


STOCK

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}
(b) Write the command to display the sum of prices of items of type “cot”.

29. Write a user defined function to accept a string and check whether it is palindrome or not.
(A palindrome is a string that is same as its reverse)

30. Explain the traversal operation in a stack.


Write the algorithm for Traversal of a stack to display its contents.
You need not 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 7 Sample Paper 7 Computer Science Class 12

Section D

31. Tech Up Corporation (TUC) is a professional consultancy company. The company is planning to set up their new
offices in. India with its hub at Hyderabad. As a network adviser, you have to understand their requirement and
suggest to them the best available solutions. Their queries are mentioned as (i) to (v) below.
Physical locations of the blocks of TUC

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?

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”)
(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
Install NODIA App to See the Solutions.
Click Here To Install
Page 8 Sample Paper 7 Computer Science Class 12

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. What is the use of writerows() function for CSV files?


A binary file “Hotel.dat” exists storing details of hotel customers as per 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.
 o
What is csv. reader() function?
A binary file “Telephone.dat” exists storing details of BSNL customers as per following structure:
PhoneNo CustomerName ConnType
Write a program in python for adding and displaying record count from the binary file using following functions
(a) NewCustomer() : To add data of customers to the binary file “Telephone.dat”.
Note : The existing connection data should be preserved.
(b) PrintConnections() : To open the file “Telephone.dat” and display the connections and number of connections.

Section E
34. Consider the following table
TABLE : INTERIORS
No ITEMNAME TYPE DATEOF- PRICE DIS-CO-UNT
STOCK
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

Install NODIA App to See the Solutions.


Click Here To Install
Page 9 Sample Paper 7 Computer Science Class 12

(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.
(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?

35. 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?

 EN

Install NODIA App to See the Solutions.


Click Here To Install

You might also like