[go: up one dir, main page]

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

cblecspu04

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 04 Page 1

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


“The method that can be used to delete a range of values from a list is del”.

2. Given L= [2,3,4,5,6]. The output of print(L[–1:–5]) is


(a) [6,5,4] (b) Error
(c) [ ] (d) [6,5]

3. What are the rows of a relation called?


(a) relation (b) tuples
(c) data structure (d) an entity

4. If a table carries 10 columns and 15 rows, what is its degree?


(a) 10 (b) 150
(c) 15 (d) 25

5. Which function returns True if all characters in a string are digits?


(a) isalnum() (b) isdigit()
(c) isnumber() (d) isalpha()
Continue on next page.....

Install NODIA App to See the Solutions.


Click Here To Install
Page 2 Sample Paper 04 NODIA

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


message = “Computer Science”
print(message[:8:-2])

7. The seek(n) places the file pointer at position n with reference to


(a) Beginning (b) End
(c) Current position (d) Position 10

8. For the tuple t = (2, 5, 1, 6, 3), what will be the result of executing t.sort()?
(a) (1,2,3,5,6) (b) (6,5,3,2,1)
(c) Error (d) None of these

9. t1=(9,6,7,6)
t2=(2.8,12,20)
The output of the statement below is
print( min(t1) + max(t2))
(a) 26 (b) 25
(c) Error (d) None of these

10. Identify the missing code to complete this snippet:


file = open(“myfile.txt”, “a”)
file.write(“Appending new content”)
file.seek(0)
print(file.read())
file.close()

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


The `try` block in Python can exist without an accompanying `except` block.

12. The ceil() function is part of which module?


(a) pandas (b) pyplot
(c) random (d) math

13. Which command is used to view a list of all databases in the system?
(a) Show (b) Show databases
(c) Display databases (d) View databases

14. Which among the following are constraints ?


(a) Primary key (b) Unique
(c) NOT NULL (d) All of these

Continue on next page.....

Install NODIA App to See the Solutions.


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

15. in and not in are........Operators.


(a) Arithmetic (b) Membership
(c) Logical (d) Identity

16. Modulation and demodulation are performed by which device?


(a) microwave (b) satellite
(c) modem (d) gateway

17. A set of possible data values is called


(a) attribute (b) degree
(c) tuple (d) domain

18. The..........attribute of the connection string specifies the password to connect to the database.
(a) code (b) password
(c) passwd (d) All of these

19. Which character must be added to the mode when opening a binary file?
(a) b (b) x
(c) u (d) b*

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

20. Assertion (A) : A function with 3 formal parameters must be called with 3 actual parameters.
Reason (R) : Since, all the formal parameters are used to produce the output from the function , the
function expects the same number of parameters from the function call.
(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) : A binary file uses the dump() function to write data into it.
Reason (R) : The load() function reads data from a binary file.
(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.....

Install NODIA App to See the Solutions.


Click Here To Install
Page 4 Sample Paper 04 NODIA

SECTION B
22. What will be the output of following code ?
L = [15, 25, 45, 55]
L.append(65)
L.insert(2, 35)
L.sort()
print(L)

23. Find outputs of following code.


(a) L = [200, 25, [15, 35, 55], 150]
L1 = [14, 25, 27]
L.extend(L1)
print(L[2][1])
print(L)
(b) t1 = (8, 5, 3, 15)
t2 = (20, 14, 18)
print(t1 + t2)
print(t1 * 3)
print(t2 - t1)

24. List two advantages and two disadvantages of bus topology.


 o
Which part of TCP/IP is responsible for dividing a file or message into very small parts, at the source
computer? Also, define, TCP/IP.

25. Explain the concept of a primary key, and provide an example of a primary key from a table with meaningful
data.

26. (a) Write the full forms of


(i) LAN
(ii) XML
(b) What was the role of ARPANET in the computer network?

27. What will be the output of the following code, when executed?
d = {‘Name’: ‘Sita’, ‘Subjects’: [‘Math’, ‘Biology’, ‘History’], ‘Marks’: [85,
92, 76]}
print(d[‘Subjects’])
print(d[‘Subjects’][1])
 o
What will be the output of the following code, when executed?
tupnames=(“India”, “Australia”,
(“UK”, “Nepal”), “Bangladesh”)

Install NODIA App to See the Solutions.


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

print(tupnames[5 : ])
print(tupnames[2][1])

28. List the major components of a database system.


 o
What is a join? What are the different types of joins?

SECTION C
29. Suppose a STACK is allocated 6 memory locations and starts as empty (Top = 0). Provide the output of
the following program segment:
AAA = 5
BBB = 8
Push(STACK, AAA)
Push(STACK, 3)
Push(STACK, BBB + 1)
Push(STACK, AAA + BBB)
Push(STACK, 12)
while (Top > 0):
Element = STACK.Pop()
print(Element)
 o
Consider the following operations are done on a stack. What will be the final status of the stack after all
the operations are performed.
(a) Push(True)
(b) Push(False)
(c) Push(10)
(d) Pop()
(e) Push(50)
(f) Push(70)
(g) Pop()
(h) Pop()

30. Write a program to accept a filename and a position. Using the inputs, call a function SearchFile(Fname,
pos) to read the contents of the file from the position to the end. Now, display all those words that start
with “U” or “u”.
 o
Write a program to search a Employee record according to Id from the “emp.txt” file. The “emp.txt” file
contains Id, Name and Salary fields. Assume that first field of the employee records (between Id and Name)
is separated with a comma(,).

Continue on next page.....

Install NODIA App to See the Solutions.


Click Here To Install
Page 6 Sample Paper 04 NODIA

31. The code given below opens a binary file and writes records of customer’s roomid, Name and days of stay .
Some of the codes are missing .Write codes to fill up the blanks :
import....... # Blank1
hotellst=[]
cname=“ ”
days=0.0
roomid=0
ans=‘y’
f=open(“hotel.dat”, “wb”)
print(“Welcome to my Hotel ”)
while ans== ‘y’:
roomid=input(“Enter Roomld :”)
cname=input(“Enter Customer name
:”)
days=float(input(“Enter days of
stay :”))
hotellst=[...., ....., .....]
# Blank2 To create the record to
be written .........# Blank3 To
write the data to the binary file.
ans=input(“Continue(y/n)”)
f.close()
(i) Write the missing code for Blank1.
(ii) Write the missing code for Blank2.
(iii) Write the missing code for Blank3.
 o
Write a user defined function change(L) to accept a list of numbers and replace the number in the list with
its factorial.
Example :
Input : [3,4,5,6,7]
Output: [6, 24, 120, 720, 5040]

SECTION D
32. (a) The code given below will give an error on execution. Identify the type of the error and modify the code
to handle such type of an error.
x = int(input(“Enter the value of
x : ”))
y = int(input(“Enter the value of
y : ”))
z = x/y
print (“The value of z : ”, z)
(b) Note the following to establish the connection between Python and MySQL:
A resultset is extracted from the database using the cursor object (that has been already created) by
giving the following statement.
Mydata=cursor.fetchone( )
(i) How many records will be returned by fetchone() method?
(ii) What will be the datatype of Mydata object after the given command is executed?

Install NODIA App to See the Solutions.


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

 o
(a) Predict the output :
str = “Python Program”
def sTringoutput(str):
print(str[3:5])
print(str[–10])
print(str[5:])
print(str[–28])
(b) Define fetchmany([size]). How does fetchone() method differ from fetchall() method?

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

Table: Student
Rno Sname Class Hcode
1 Raj 12ScA C1
2 Shekhar 11ComC C2
3 Ravi 12HumB C2
4 Jaisnav 12ScB C3

Table: House
H code L name
C1 East
C2 West
C3 South
C4 North
SELECT S.Sname , H.Lname FROM Student S, House H WHERE S.Hcode = H.Hcode AND
SName LIKE “R%”;
(b) Consider the following table STORE and answer the questions

TABLE: STORE
Item No Item S code Qty Rate Last Buy
2005 Sharpener Classic 23 60 8 31-JUN-09
2003 Balls 22 50 25 01-FEB-10
2002 Gel Pen Premium 21 150 12 24-FEB-10
2006 Gel Pen Classic 21 250 20 11-MAR-09
2001 Eraser Small 22 220 6 19-JAN-09
2004 Eraser Big 22 110 8 02-DEC-09
2009 Ball Pen 0.5 21 180 18 03-NOV-09
Write SQL commands for the following statements:
(i) To display details of all the items in the STORE table in ascending order of LastBuy.
(ii) To display ItemNo and Item name of those items from STORE table, whose Rate is more than `15.
(iii) To display the details of those items whose Supplier code (Scode) is 22 or Quantity in Store (Qty) is
more than 110 from the table STORE.

Install NODIA App to See the Solutions.


Click Here To Install
Page 8 Sample Paper 04 NODIA

34. Granuda consultants are setting up a secured network for their office campus at Faridabad for their day-
to-day office and web based activities. They are planning to have connectivity between 3 buildings and the
head office situated in Kolkata.
Answer the questions (i) to (v) after going through the building positions in the campus and other details,
which are given below:
Distance between various buildings
Building RAVI to Building JAMUNA 120 m
Building RAVI to Building GANGA 50 m
Building GANGA to Building JAMUNA 65 m
Faridabad Campus to Head Office 1460 km

Number of computers
Building RAVI 25
Building JAMUNA 150
Building GANGA 51
Head Office 10
(i) Suggest the most suitable place (i.e. block) 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 building inside the campus.
(iii) Suggest the placement of the following devices with justification:
(a) Switch
(b) Repeater
(iv) The organisation is planning to provide a high speed link with its head office situated in the Kolkata
using a wired connection. Which of the following cable will be most suitable for this job?
(a) Optical fibre
(b) Co-axial cable
(c) Ethernet cable
 o
(v) Consultancy is planning to connect its office in Faridabad which is more than 10 km from Head office.
Which type of network will be formed?

35. Consider the following tables GARMENT and FABRIC. Write SQL commands for the statements (i) to
(iv).

TABLE: GARMENT
GCODE DESCRIPTION PRICE FCODE READY-DATE
10023 PENCIL SKIRT 1150 F03 19-DEC-08
10001 FORMAL SHIRT 1250 F01 12-JAN-08
10012 INFORMAL SHIRT 1550 F02 06-JUN-08
10024 BABY TOP 750 F03 07-APR-07
10090 TULIP SKIRT 850 F02 31-MAR-07
10019 EVENING GOWN 850 F03 06-JUN-08
10009 INFORMAL PANT 1500 F02 20-OCT-08

Install NODIA App to See the Solutions.


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

10007 FORMAL PANT 1350 F01 09-MAR-08


10020 FROCK 850 F04 09-SEP-07
10089 SLACKS 750 F03 20-OCT-08

TABLE: FABRIC
FCODE TYPE
F04 POLYSTER
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 GARMENTs, which have READYDATE in between 08-DEC-07 and
16-JUN-08 (inclusive of both the dates).
(iii) To display the average PRICE of all the GARMENTs. Which are made up of FABRIC with FCODE as
F03.
(iv) To display FABRIC wise highest and lowest price of GARMENTs from GARMENT table. (Display
FCODE of each GARMENT along with highest and lowest price.)

SECTION E
36. What are the advantages of CSV files?
Write a Python program that includes the following functions to work with a file named “teacher.csv,”
which contains columns for city, teacher name, and salary amount.
(a) Search() : Search and print all rows where city is “delhi”.
Sample “teacher.csv” :

City Teacher Name Salamount


Delhi, Anil Sharma, 10000
Pune, Mr Dua, 20000
Delhi, Mr Das, 25000
(b) Searchfromfile() : From the file “teacher.csv” print all rows where teacher name is “Anil”.
 o
What are the Disadvantages of CSV files?
Write a program using functions :
(a) addTransaction() : To append bank transactions of following structure to “bank.csv”
TranlD TranDate Amount Type
(b) getTran() : To display those transactions whose type is “Deposit”.

Continue on next page.....

Install NODIA App to See the Solutions.


Click Here To Install
Page 10 Sample Paper 04 NODIA

37. Consider the following “Student” table:

Table : Student
Adm No Roll No Name Class Marks
2715 1 Ram 12 90
2816 2 Shyam 11 95
2404 3 Ajay 10 92
2917 4 Tarun 12 94
(i) Can the “Class” column be used as the primary key of the table?
(ii) What is the cardinality of the table?
(iii) Write statements to :
(a) Display the average Marks .
(b) Display the different Classes .
 o
(Option for part (iii) only)
Write statements to :
(a) Change the data type of Marks column so that it can take fractional values upto 2 decimals .
(b) Increase width of Name column to varchar(50).

 EN

Install NODIA App to See the Solutions.


Click Here To Install

You might also like