CBSE Sample Papers For Class 12 Computer Science Set 7
CBSE Sample Papers For Class 12 Computer Science Set 7
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.
Question 29.
Write a user defined function change(L) to accept a list of numbers and replace the number in the list with
its factorial. [3]
Example : Input: [3,4,5,6,7]
Output: [6, 24, 120, 720, 5040]
Question 30.
Suppose STACK is allocated 6 memory locations and initially STACK is empty (Top = 0). [3]
Given the output of the program segment:
AAA = 4
BBB = 6
Push (STACK, AAA)
Push (STACK, 4)
Push (STACK, BBB +2)
Push (STACK, AAA + BBB)
Push (STACK, 10)
while (Top>0) :
Element = STACK. Pop ( )
print(Element)
Section – D
Question 31.
Consider the following table Student [1 × 4 = 4]
Table: Student
Write statements to
(a) Display the average Marks.
(b) Display the different Classes.
(c) Change the data type of Marks column so that it can take fractional values upto 2 decimals.
(d) Increase width of Name column to varchar(50).
Question 32.
Write a program using functions : [4]
addTransaction() To append bank transactions of following structure to “bank.csv”
TranID TranDate Amount Type
getTran() To display those transactions whose type is “Deposit”.
Section – E
Question 33.
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. [1 × 5 = 5]
Answer the questions (a) to (e) 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 25
Building JAMUNA 150
Building GANGA 51
Head Office 10
(a) Suggest the most suitable place (i.e. block) to house the server of this organisation. Also, give a reason
to justify your suggested location.
(b) Suggest a cable layout of connections between the building inside the campus.
(c) Suggest the placement of the following devices with justification:
(i) Switch
(ii) Repeater
(d) 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?
(i) Optical fibre
(ii) Co-axial cable
(iii) Ethernet cable
(e) 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?
Question 34.
(a) List the major components of database system. [1 + 4 = 5]
(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?
Or
(a) What is join? What are the different kinds of joins?
(b) Define fetchmany([size]). How does fetchone() method differ from fetchall() method?
Question 35.
(a) What are the advantages of CSV files? [2 + 3 = 5]
(b) Write a Python program using following functions to :
A file “teacher.csv” contains a city, teacher name and Salamount.
Search() Search and print all rows where city is “delhi”.
Sample “teacher.csv” :
Searchfromfile() From the file “teacher.csv” print all rows where teacher name is “Anil”.
Or
(a) What are the disadvantages of CSV files?
(b) Somya, wants to write the code for opening the binary file “hotel.dat” and write records of customer’s
roomid, name and days of stay.