Professional Documents
Culture Documents
Sample Paper-1
Sample Paper-1
SECTION – B
1
2 DEEPAK CBSE Sample Papers
21. (a) "Hello, World!"
(d) dict_values(['R', 'T', 'Y', 'B', 'V'])
22. A foreign key is a set of attributes in a table that refers to the primary key of another table. The foreign key links
these two tables. The foreign key constraint is used to prevent actions that would destroy links between tables. A
foreign key is a field (or collection of fields) in one table, that refers to the primary key in another table.
For example, a person table contain the column Person id, Last name, First name, Age and an order table contains
the column Order id, Order number and Person id. Person id is primary key in person table and Order id is primary
key in order table. But both tables contain one common field i.e. Person id. So Person id column can be used as
foreign key, if we combine both tables.
23. (a) (i) A Peer to Peer network contains equal ranking for each computer, each system can double up as a client as
well as a non-dedicated server.
(ii) A network hub is a node that broadcasts data to every computer or Ethernet-based device.
(b) A router is a networking device that forwards data packets between computer networks. Routers perform the
traffic directing functions on the Internet. A router can link ethernet to a mainframe. A router is different from a
bridge in way that former uses logical addresses and the latter uses physical addresses.
24. The output will be
P*rt**t*sm
OR
The output will be
45 89 75
25. DDL and DML both are differentiated categories of SQL command.
Data Definition Language (DDL) – It allows one to perform various operations on the database such as CREATE,
ALTER, and DELETE objects.
Data Manipulation Language(DML) – It allows one to access and manipulate data. It helps one to insert, update,
delete and retrieve data from the database.
OR
The list of identifiers used in a function call is called actual parameter (s) whereas the list of parameters used in
the function definition is called formal parameter.
Example :
def area (side) : # Line 1
return side * side;
print (area (5)) # Line 2
SECTION – C
26. (a) SELECT * FROM(
SELECT employee_name, salary, DENSE_RANK()
OVER(ORDER BY salary DESC)r FROM Employee) WHERE r = &n:
To find 3rd highest salary set n = 3
(b) (i) Deepak
(ii) 4
(iii) 004
(iv) 004 Fatima 92
COMPUTER SCIENCE |CLASS-12th | 3
27. def funCalc(a, b) :
return a+b, a–b, a*b, a/b, a%b
#__main__
num1= int (input (“Enter number 1 : ”) )
num2= int (input (“Enter number 2 : ”) )
add, sub, mult, div, mod= funCalc (num1, num2)
print (“Sum of given numbers : ”, add)
print (“Subtraction of given numbers : ”, sub)
print (“Product of given numbers : ”, mult)
print (“Division of given numbers : ”, div)
print (“Modulo of given numbers : ”, mod)
Or
class Stack:
def __init__(self):
self.stack = []
AStack = Stack()
AStack.add("Mon")
AStack.add("Tue")
AStack.add("Wed")
AStack.add("Thu")
print(AStack.remove())
print(AStack.remove())
SECTION – D
31. (a) Most suitable place to install the server is HR center, as this center has maximum number of computers.
(b)
(c) Switch
(d) Repeater may be placed when the distance between 2 buildings is more than 70 meter.
(e) WAN, as the given distance is more than the range of LAN and MAN.
32. (a) def VCount():
phr = 'Easy Coding'
vowel = 'aeiouAEIOU'
count = 0
for ch in phr:
if ch in 'aeiouAEIOU':
count = count + 1
else:
6 DEEPAK CBSE Sample Papers
pass
print(count)
VCount()
The above program will display the output 4
(b) (i) The above code will print the statement.
Total retrieved rows in resultset : 10.
(ii) Fetchall() will return all the rows from the resultset in the form of a tuple.
OR
(a) def Swap():
phr = 'rISE eveRY TimE'
for ch in phr:
if ch.isupper():
print(ch.lower(),end ='')
else:
print(ch.upper(),end='')
The above program will be display the output
Rise EVEry tIMe
(b) import mysql.connector
mydb = mysql.connector.connect(
host="localhost",
user="sandeep",
password="123456",
database="School"
)
mycursor = mydb.cursor()
sql = “SELECT * FROM School WHERE grade =‘A’ ”
mycursor.execute(sql)
myresult = mycursor.fetchall()
for x in myresult :
print(x)
33. (i) def calcSum (x, y) :
s=x+y
return s
num1 = float (input (“Enter first number : ”) )
num2 = float (input (“Enter Second number : ”) )
sum = calcSum (num1, num2)
print (“Sum of two given numbers is”, sum)
(ii) def LWCount():
fob = open('MyPoem.txt','r')
txt = fob.read().split()
print(len(txt))
fob.close()
LWCount()
The output will be 7.
COMPUTER SCIENCE |CLASS-12th | 7
OR
(i) Literals are the data item which have a fixed value. String literal are always written in quotes (single or double)
(or triple quotes).
(a) Single Line String : Which quotes should be start and end same line are known as single literals.
(b) Multiline string : It took multiple lines to complete a statement. Multiple line string use \ (backslash) at the
end of each line.
(ii) Slice is a sub part of a string. In python string, we can obtain a sub-part by using t [n : m] where n, m is the
starting and ending position of a sub string and t is string.
For example :
'Welcome Sir' [2, 5] will give lcom.
34. (i) INSERT INTO student VALUES (777,‘‘Rahul Kumar’’, 12,‘‘A’’, 5500);
(ii) SELECT name FROM student WHERE class = 10;
(iii) SELECT name, class FROM student;
OR
(iii) SELECT * from student
where Name = ‘Nandini’ ;