CS QP
CS QP
CLASS XII
COMPUTER SCIENCE (Code: 083)
Page: 1/11
5. What will be the output of the following code snippet?
message= "Good Morning" (1)
print(message[2::2])
8. Which of the following will delete key-value pair for key = “Name” from a dictionary
D1?
(A) delete D1("Name")
(1)
(B) del D1["Name"]
(C) del.D1["Name"]
(D) D1.del["Name"]
9. If a table which has two Primary key and five candidate keys. How
many alternate keys will this table have?
(A) 1
(B) 2 (1)
(C) 3
(D) 4
Page: 2/11
12. What will be the output of the following code?
g = 20
def add():
global g
g = g + 5
print(g,end='#')
add() (1)
g=45
print(g,end='%')
(A) 25#45%
(B) 5#20%
(C) 25#25%
(D) 50%20#
13. Which SQL command can remove a column from an existing relation? (1)
15. In which datatype the value stored is padded with spaces to fit the specified
length.
(A) DATE
(B) VARCHAR (1)
(C) FLOAT
(D) CHAR
18. Which network device is used to convert analog signal to digital signal
and vice versa?
(A) Modem
(B) Gateway (1)
(C) Switch
(D) Repeater
Page: 3/11
19. In case of _____________ switching, before a communication starts, a
dedicated path is identified between the sender and the receiver (1)
Q20 and Q21 are Assertion(A) and Reason(R) based questions. Mark
the correct choice as:
(A) Both A and R are true and R is the correct explanation for A
(B) Both A and R are true and R is not the correct explanation
for A
(C) A is True but R is False
(D) A is False but R is True
(1)
Reasoning (R): DROP and DELETE are used to delete rows and
columns, therefore, these can be used interchangeably.
Q No Section-B ( 7 x 2=14 Marks) Marks
(II)
A) Write a statement to insert all the elements of L2 at the end of L1.
OR
Write a statement to remove all the elements from list L2.
Page: 4/11
25. Identify the correct output(s) of the following code. Also write the minimum
and the maximum possible values of the variable b.
import random
a="Chandigarh"
b=random.randint(1,6) (2)
for i in range(0,b):
print(a[i],end='#')
(A) C# (B) C#h#a#n#
The code given below accepts a number as an argument and returns the
26. reverse number. Observe the following code carefully and rewrite it after
removing all syntax and logical errors. Underline all the corrections made..
(2)
27. (I)
A) What constraint should be applied on a table column to
ensure that the values in a column satisfy a specific condition.
OR
B) What constraint should be applied on a table column that is a
combination of NOT NULL and UNIQUE. (2)
(II)
A) Write an SQL command to remove the Primary Key constraint
from a table, named STUDENT. S_ID is the primary key of the
table.
OR
Write an SQL command to make the column S_ID the PrimaryKey of an
already existing table, named STUDENT.
Page: 5/11
28. A) List one advantage and one disadvantage of ring topology.
OR (2)
B) Expand the term HTTPS. What is the use of HTTPS?
29. A) Write a Python function that displays all the words containing @gmail
from a text file "Story.txt".
(3)
OR
B) Write a Python function that finds and displays all the words having 5
characters from a text file "Story.txt".
30. A) You have a stack named Books that contains records of books. Each
book record is represented as a list containing book_title,
author_name, and publication_year.
Write the following user-defined functions in Python to perform the
specified operations on the stack Books:
(I) push_book(Books, new_book): This function takes the stack
BooksStack and a new book record new_book as arguments and
pushes the new book record onto the stack.
(II) pop_book(Books): This function pops the topmost book record from
(3)
the stack and returns it. If the stack is already empty, the function
should display "Underflow".
(III) peep(Books): This function displays the topmost element of the
stack without deleting it. If the stack is empty, the function should
display 'None'.
OR
(B) A list, NList contains following record as list elements:
[City, Country, distance from Delhi]
Each of these records are nested together to form a nested list.
Write the following user defined functions in Python to perform the
specified operations on the stack named travel.
(ii) Pop_element(): It pops the objects from the stack and displays
Page: 6/11
them. Also, the function should display “Stack Empty” when there
are no elements in the stack.
(3)
31 Predict the output of the following code:
OR
Predict the output of the following code:
line=[14,18,12,16]
for I in line:
for j in range(1,I%5):
print(j,"@",end="")
print()
Page: 7/11
Q No. Section-D ( 4 x 4 = 16 Marks) Marks
32.
(4)
OR
Write the outputs of the SQL queries (i) to (iv) based on the relation
BOOK given below:
TABLE : BOOK
BNO BNAME TYPE
F101 THE PRIEST FICTION
L102 GERMAN EASY LITERATURE
C101 TARZAN IN THE LOST WORLD COMIC
F102 UNTOLD STORY FICTION
C102 WAR HEROES COMIC
Page: 8/11
33. A csv file "country.csv" contains the data of a survey. Each record of thefile
contains the following data:
● Name of a country
● Population of the country
● Sample Size (Number of persons who participated in the survey in
that country)
● working (Number of persons who are working)
(4)
For example, a sample record of the file may be:
[‘Ireland’, 5673000, 5000, 3426]
Write the following Python functions to perform the specified operations on
this file:
(I) Read all the data from the file in the form of a list and display all
those records for which the population is more than 5000000.
(II) Count the number of records in the file.
34. Shekhar has been entrusted with the management of Law University
Database. He needs to access some information from FACULTY and
COURSES tables for a survey analysis. Help him extract the following
information by writing the desired SQL queries as mentioned below.
Table: FACULTY
F_ID FName LName Hire_Date Salary
102 Amit Mishra 12-10-1998 12000
(4)
103 Nitin Vyas 24-12-1994 8000
104 Rakshit Soni 18-5-2001 14000
105 Rashmi Malhotra 11-9-2004 11000
106 Sulekha Srivastava 5-6-2006 10000
Table: COURSES
C_ID F_ID CName Fees
C21 102 Grid Computing 40000
C22 106 System Design 16000
C23 104 Computer 8000
Security
C24 106 Human Biology 15000
C25 102 Computer 20000
Network
C26 105 Visual Basic 6000
Page: 9/11
35. A table, named EDUCATION, in SUPPLY database, has the following
structure
Field Type
itemNo int(11)
itemName varchar(15)
price float
qty int(11)
Write the following Python function to perform the specified operation: (4)
AddAndDisplay(): To input details of an item and store it in the table
EDUCATION. The function should then retrieve and display all records
from the EDUCATION table where the Price is greater than 150.
Page: 10/11
(II) Write a function to update the data of candidates whose experience
is more than 10 years and change their designation to "Senior
Manager".
(III) Write a function to read the data from the binary file and display the
data of all those candidates who are not "Senior Manager".
ADMIN 30
FOOD 18
MEDIA 25
DECORATORS 20
DELHI HEAD
OFFICE 18
Page: 11/11
(I) Suggest the most appropriate location of the server inside the
MUMBAI campus. Justify your choice.
(II) Where hub/switch should be placed? Justify your answer.
(III) Draw the cable layout to efficiently connect various buildings
within the MUMBAI campus. Which cable would you suggest for
the most efficient data transfer over the network?
(IV) Is there a requirement of a repeater in the given cable layout?
Why/ Why not?
(V) A) What would be your recommendation for enabling live visual
communication between the Admin Office at the Mumbai campus
and the DELHI Head Office from the following options:
a) Video Conferencing
b) Email
c) Telephony
d) Instant Messaging
OR
B) What type of network (PAN, LAN, MAN, or WAN) will be set up
among the computers connected in the MUMBAI campus?
Page: 12/11