# cbse class 12 computer science question paper with solutions

Contents

## Practice test paper  3 Computer Science

#### time: three hours                                            max marks: 70

All questions are compulsory. Question paper is divided into 4 sections, A,B,C and D, Section A : unit 1, Section B : unit 2, Section c : unit 3, Section D : unit 4

## SECTION-A

### 1.

(a) would expression 3**1**3 and 3*1**# evaluate to same result ? (True/False)             1
(b) which type of error occur when you execute the following code fragments ?                1
(i) SyntaxError          (ii) NameError          (c) ValueError           (d) TypeError
(i) >>>1 = 6
(ii) >>>’abc’ + 4 – 4
(c) which python libraries/modules need to be imported to use following functions ?
(i) range( )                     (ii) arrange( )
(d) find the errors in following code and write the correct code.
(i) underline the corrections
(ii) write the reasons/error next to it in comment form.
L = [ ‘a’, ‘b’, ‘c’,’d’ ]
v = 6
for i  in len(1) :
L[i] =+ v
v = v – 1
print( “v =”, v, “L =”, L)
(e) predict the outputs of the following programs :
x = [1,2,3]
counter = 0
while counter < len(x) :
print(x[counter] * ‘%’)
for y in x :
print(y* ‘*’)
couner += 1
(f) determine the output of the following :
def myfunction(str1) :
rstr1 = ‘ ‘
index = len(str1)
while index > 0 :
if str1[index – 1].isalpha() :
rstr1 += str1[index – 1]
index = index – 1
return str1
print(myfunction(‘123abcd’))
(g) consider the following code.
import random
print(int(20+random.random()*5),end= ‘  ‘  )
print(int(20+random.random()*5),end= ‘  ‘  )
print(int(20+random.random()*5),end= ‘  ‘  )
print(int(20+random.random()*5))
find the suggested output option (1) to (4).also, write the least value and highest value that can be generated.
(1) 20 22 24 25                                          (2) 22 23 24 25
(4) 23 24 23 24                                           (4) 21 21 21 21

### 2.

(a) what are the two cases required in a recursive function ?
(b) what is the slice expression that gives every third character of string St, starting with the last character and proceeding backward to the first ?
(c) choose correct output for the following sequence of operations ( * signifies top).
push(5),          push(8),       pop,  push(2), push(5), pop, push(1)
(i)8 5 2 5 1            (ii) 8 5 5 2 1         (iii) 2 5 5 1        (iv) 5 2 1
*                                            *                                  *                               *
(d) what is following code doing ?
file = open (“contects.txt”,”a”)
name = input (“please enter name.”)
phno = input (“please enter phone number.”)
file.write (name +”,”+phno+”n”)
file .close()
(e) predict the output.
1i = [1, 2, 3, 4, 5, 6, 7, 8,9,]
k = [ elem*elem2 for elem1 in 1i if (elem1 -4) >1 foem elem2 in 1i [:4] ]
print(K)
(f) Compare and contrast the use of iteration and recursion in terms of memory space and speed.
(g) Your school has sent a team of 9 players in inter school sports meet and players have won some medals
as given below :
players and medals won = “Ana” = 3, “Rajat” = 5, “ginny” =3, “yuvi” = 3,
“Adi” = 2, “sri” = 1, “Urja” = 0, “pia” = 4
Plot a bar chart for the above medal tally showing medals won by each player.
-> Title should be ‘Various Hobbies
-> Give appropriate labels to x and y axis.
Or
Evaluate the following post fix notation of expression (show status of stacks after execution of each operation ):
4,10,5,+,*,15,3,/-
(h) write a python program to get the factorial of a non -negative integer.
or
write a function remove _lowercase() that accepts two filenames, and copies all lines that do not start with a lowercase letter from file into the second.
(i) write a python program to print nth Fibonacci term using recursion.
(j) write a program to implement input-restricted seque. (both the operation i.e.,insertions and deletions should be taken care of.)
or
each node of STACK contains the following information:
(i) pin code of a city      (ii) name of city.
write a program to implement following   operations in above stack
(a) PUSH() to push a node in to the stack.
(b) POP() to remove a node from the stack.

## SECTION-B

### 3.

(a) A repeater takes a weak and corrupted signal and ______ it.
(i) Amplifies                     (ii) Regenerates
(iii) Resembles                 (iv) Reroutes
(b) All computers connected to the internet and wanting to use it for sending/receiving data must follow a common set of rules for communication called _____ .
(c) CSMA/CD can be used by wireless networks. (True/False)
(d) A HUB is a
(i) Broadcast device            (ii) Uni cast device
(iii) Multicast device       (iv) None of the above
(e) Write full forms for (i) WAN  (ii)IP  (iii) TCP        (iv) TAP
(f) What is routing table ? What type of information is stored in routing table ?
(g) Identify the term/protocol/device from given description.
(i) process of carrying a message information by altering the frequency of a carrier wave.
(ii) a subsystem of Internet that converts domain names into IP addresses/ numbers.
(iii) Error during transmission that alters 2 or more bits during transmission.
(h) Ravya Industries has set up its new center at Kaka Nagar for its office  and web based activities.
The company compound has 4 buildings as shown in the diagram shown here :

(i) Suggest the most suitable place (i.e., building) to house the server of this organisation with a suitable reason.
(ii) Suggest the placement of the following devices with justification :
(a) Internet Connecting Device/Modem    (b) Switch
(iii) The organization is planning to link its sale counter situated in various parts of the same city, which type of network out of LAN, MAN or WAN will be formed ? justify your answer.

### 4.

(a) The operation whose result contains all pairs of tuples from the two relations, regardless of whether their attribute values match.
(i) join                      (ii) Cartesian product
(iii) Intersection      (iv) Set difference
(b) The data type CHAR(n) and VARCHAR(n) are used to create _____ , and ______ types of string/text fields in a database.
(i) Fixed, equal                     (ii) equal, variable
(iii) Fixed, Variable              (iv) Variable, equal
(c) Which of the following keywords will you use in the following query to display all the values of the column dept_name ?
SELECT _____ dept_name FROM company ;
(i) ALL    (ii) From   (iii) Distinct    (iv) Name
(e) the SQL SELECT provides clauses for sorting data and for summarizing results.
OR
What do you understand by the terms     Candidate key and Cardinality of relation in relational database ?
(f) what are two two types of HTTP requests ?
OR
What is the difference between HTTP GET and HTTP POST request ?
(g) Consider the following tables CABHUB and CUSTOMER and answer the following parts of this question :

Give the output of the following SQL queries :
(i) SELECT COUNT (DISTINCT Make) FROM CABHUB ;
(ii) SELECT COUNT(*), Make FROM CABHUB ;
(iii) SELECT vehicleName FROM CABHUB WHERE  Capacity = 4 ;
(h) consider the following tables CONSIGNOR and CONSIGNEE. write SQL queries commands for the following statements.
(i) To display the names of all Consignors from Mumbai.
(ii) To display the CneeID, CnorName, CnorAddress, CneeName, CneeAddress for every Consignee.
(iii) To display consignee details in ascending order of CneeName.
(iv) To display numbers of consignors from each city.

## SECTION-D

### 5.

(a) An example of an open source DBMS.
(i) MySQL          (ii) Oracle      (iii) SQL server   (iv) Sybase
(b) what is meant by the ‘cyber-crime’ ?
(i) Any crime that uses computers to jeopardize or attempt to jeopardize national security
(ii) The use of computer network to commit financial or identify fraud
(iii) The theft of digital information
(iv) Any crime that involves computers and networks
(c) How can you protect your digital properties ?
(e) How should one dispose off the E-waste ?
(f) Compare freeware and Shareware.