0% found this document useful (0 votes)
20 views11 pages

CS Ak

Uploaded by

shubh laddha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views11 pages

CS Ak

Uploaded by

shubh laddha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

DELHI PUBLIC SCHOOL BANGALORE EAST

SUBJECT: COMPUTER SCIENCE (CODE:083)


ANNUAL EXAMINATION (2023-24) (Answer Key)

GRADE: XI MAX MARKS: 70


DATE: 16/02/2024 TIME: 3 HOURS
NAME:
General Instructions:
• The question paper is divided into 5 Sections – Section A to E
• Section A consists of 18Questions (1-18). Each question carries 1 mark.
• Section B consists of 07Questions (19-25). Each question carries 2 marks.
• Section C consists of 05Questions (26-30). Each question carries 3 marks.
• Section D consists of 2 Questions (31-32). Each question carries 4 marks.
• Section E consists of 3 Questions (33-35). Each question carries 5 marks.
• All questions are compulsory.

Section A
Each question carries 1 mark
Q. Question Ma
No rks
1. Find the invalid identifier from the following. 1M
a) none
b) Address
c) Name
d) pass
2. Any work/information that exists in digital form either on internet or on an electronic 1M
device, is known as _______________ property.
Ans: digital
3. The expression for the absorption law is given by ________________. 1M
a) A+AB=A
b) A+AB=B
c) AB+AA’=A
d) A+B=B+A
ANS: A+AB=A
4. The decimal addition of 164 and 13 is177 what will be the binary addition ? 1M
Ans: 010100100 + 1101 or convert 177 in to binary
= 010110001
5. Statement I: Patents are defined as monopoly rights which one granted by the government, 1M
for full disclosure of invention for a limited period of time, that is for 20 years.
Statement II: The purpose of granting patents is to encourage inventions by promoting their
protection and utilization so as to contribute to the development of Industries.
a) Both Statement I and Statement II are correct
Page 1 of 11
b) Both Statement I and Statement II are incorrect
c) Statement I is correct but Statement II is incorrect
d) Statement I is incorrect but Statement II is correct
6. Select the incorrect way to remove the key marks from a dictionary. 1M
student = { "name": "Emma", "class": 9, "marks": 75 }
i) student.pop("marks")
ii) del student["marks"]
iii) student.remove("marks")
iv) student.popitem("marks")
a) i and ii
b) iii and iv
c) only iii
d) only ii
7. Which of the following is False? 1M
a) String is immutable.
b) capitalize() function in string is used to return a string by converting the whole
given string into uppercase.
c) lower() function in string is used to return a string by converting the whole given
string into lowercase.
d) None of these.
8. The following characters represents __________________. 1M
\n ,\t
a) Escape Sequence
b) Special Character
c) Don’t have any common term
d) keyword
9. String traversal can be done using ‘for’ loop only. (True/False) 1M
Ans: False
10. Which of the following is the correct way to create an empty dictionary? 1M

a) sampleDict =dictionary()
b) sampleDict = dict()
c) sampleDict = dict{}
d) sampleDict = empty{}

11. What is the list in Python? 1M

a) An immutable type of data type which can only store string.


b) A mutable type of data type which can store only string.
c) A mutable type of data type which can only store numbers.
d) A mutable type of data type which can store anything.

Page 2 of 11
12. What will be the output of the following python code? 1M
tp=(5,)
tp1=tp*2
print(len(tp1))

a) 10
b) 2
c) 1
d) Error
Ans: b)2
13. What will be the output of the following code? 1M
L1=[1,276,986,1783]
print(276 in L1)
a) True
b) Error
c) False
d) 276
14. What is the output of the following python code? 1M
1+3 - 2**10//6
Ans: -166
15. Which of the following value of ‘X’ makes the condition False in the given code? 1M
if(X>7 or X==3) and X!=11:
print("H")
a) 8
b) 9
c) 5
d) 33
16. Write the output of the following python code. 1M
print(range(5,0,-2))
a) range(5,0,-2)
b) Error
c) No output
d) 5 3 1
Q17 and 18 are ASSERTION AND REASIONING based questions. Mark the correct
choice as
a) Both (A) and (R) are correct and R is the correct reason of A
b) Both (A) and (R) are correct but R is NOT the correct reason of A
c) (A) is correct but (R) is not correct
d) (A) is not correct but (R) is correct

Page 3 of 11
17. Assertion(A): All freeware are open source. 1M
Reason(R): There is a difference between open source and freeware.
Ans:
Ans: d) (A) is not correct but (R) is correct
18. Assertion(A): Mutable type dictionaries internally store elements through immutable keys. 1M
Reason(R): In every Key: Value pair, the key must be of immutable type always, to facilitate
internal mapping of elements.

Ans: a) Both (A) and (R) are correct and R is the correct reason of A

Section B
Each question carries 2 marks

19. Rewrite the following program using ‘while’ loop: 2M

for i in range(20,0,-2):
print("i =",i)
Ans:
i=20
while(i>0):
print("i =",i)
i-=2
20 List any four features of python. 2M
Ans:
1) Easy to use
2) Expressive language
3) Interpreted language
4) Cross-platform language
5) Free and opensource
6) Variety of usage/Application
21. Draw the flowchart for the following algorithm. 2M
Step 1: Start
Step 2: Let N=1 and Sum=0
Step 3: Sum=Sum+N
Step 4: N=N+1
Step 5: if (N<=100) then go to step 3
Step 6: display Sum
Step 7: Stop

Page 4 of 11
22. Predict the output of following python code. 2M

fruit_list1 = ['Apple','Berry','Cherry','Papaya']
fruit_list2 = fruit_list1
fruit_list3 = fruit_list1[:]
fruit_list2[0] = 'Guava'
fruit_list3[1] = 'Kiwi'
sum =0
for ls in (fruit_list1,fruit_list2,fruit_list3):
if ls[0]=='Guava':
sum +=1
if ls[1]=='Kiwi':
sum +=20
print(sum)

Ans: 22
23. Match the following: 2M
a) Refers to methods used for interpretation of computer i) Digital
media for digital evidence. footprint
b) Network security system, that controls incoming and ii) Pharming
outgoing network traffic based on a set of rules.
c) Hacker attempts to redirect a website’s traffic to another, iii) Computer
bogus website. forensic

d) Records and traces individuals leave behind as they use iv) Firewall
Internet.

ANS: a)-iii b)- iv c)-ii d)-i

24. Rewrite the following code in python after removing all syntax error(s). Underline each 2M
correction done in the code.

int(input( "Enter an integer:" ))=n


Page 5 of 11
IF n > 0 :
for a in range(1, n + n )
print (a / (n/2))
else :
print "Now quiting"
Ans:
n=int(input( "Enter an integer:" ))
if n > 0 :
for a in range(1, n + n ):
print (a / (n/2))
else :
print ("Now quiting")
25 Write the output of the following code. 2M

t1=(1,(2,"a",(3,"b","c",(7,"d","e","f"))))
print(t1[1][0])
print(7 in t1[1])
print(t1.index(1))
print(t1[t1[0]])
Ans:
2
False
0
(2, 'a', (3, 'b', 'c', (7, 'd', 'e', 'f')))
Section C
Each question carries 3 marks
26. Write a program to read two lists num and denum which contain the numerators and 3M
denominators of same fractions at the respective indexes. Then display the smallest fraction
along with its index.

Ans:
num = eval(input("Enter numerators list :-"))
denum = eval(input("Enter denominators list :-"))
lst = [ ]
for i in range(len(num)) :
fraction = num[ i ] / denum[ i ]
lst.append( fraction )

print(lst)
lst.sort()
print("sorted list= ", lst)
print("Smallest fraction = ",lst[ 0 ])

27. a) Write the output of the following: 2+1


M

Page 6 of 11
Str= “String Slicing in Python”
print(Str[-17:-1:1])
print(Str[0:9:3])
print(Str[19:29])
print(Str[-2:-4:-2])
b) Explain string partition() method with an example.
Ans:
a) Slicing in Pytho
Si
ython
o
b) It splits the string at the first occurrence of separator, and returns a tuple
containing three items.
Str= “I love python”
X=Str.partition(“lo”)
print(X)
output: ('I ', 'lo', 've python')
28. test1 = {"cat" : 12, "dog" : 6, "elephant" :23, "bear":20} 3M
test2={"cat" : 19, "dog" : 16, "Lion":5}

consider the above dictionary and write the python code for the following.
a) To display only the values of the dictionary test1.
b) To display maximum value of dictionary test2.
c) Merge test2 dictionary in test1.

Ans:
a) print(test1.values())
b) print(max(test2.values()))
c) test1.update(test2)

29. Predict the output of the following. 3M


Val=[17,24,15,30]
Val.append([44,55])
print(Val)
Val.extend([44,55])
print(Val)
Val.insert(2,[44,55])
print(Val)

Ans:
[17, 24, 15, 30, [44, 55]]
[17, 24, 15, 30, [44, 55], 44, 55]
[17, 24, [44, 55], 15, 30, [44, 55], 44, 55]
Page 7 of 11
30 Write a program to take N (N > 20) as an input from the user. Print numbers from 11 to N 3M
but while printing if the number is a multiple of 3, print "Tipsy", if it is a multiple of 7, print
"Topsy". When it is a multiple of both, print "TipsyTopsy".
For example
if N=22
then output is
11
Tipsy
13
Topsy
Tipsy
16
17
Tipsy
19
20
TipsyTopsy
22

Ans:
n = int(input("Enter a number greater than 20: "))
if n <= 20 :
print("Invalid Input")
else :
for i in range(11, n + 1) :

if i % 3 == 0 and i % 7 == 0 :
print("TipsyTopsy")

elif i % 3 == 0 :
print("Tipsy")

elif i % 7 == 0 :
print("Topsy")

else:
print(i)

Section D
Each question carries 4 marks
31 Write a menu driven program to input your friends’ name and their phone numbers and 4M
store them in the dictionary as the key-value pair and perform the following operations on
the dictionary.
a) Display all the elements as a sequence of (key,value) tuples.
b) Modify the phone number of an existing friend.
c) Check if a particular friend is present in the dictionary or not.
d) Display the dictionary in sorted order of names.

Ans:
dic = {}
while True:

Page 8 of 11
print("1. Add a contact ")
print("2. Display all the elements as a sequence of (key,value) tuples")
print("3. Modify Phone Number of Contact")
print("4. Check if a friend is present or not")
print("5. Display in sorted order of names")
print("6. Exit")
inp = int(input("Enter your choice(1-6): "))

#Adding a contact
if(inp == 1):
name = input("Enter your friend name: ")
phonenumber = input("Enter your friend's contact number: ")
dic[name] = phonenumber
print("Contact Added \n\n")
#Display all the elements as a sequence of (key,value) tuples
elif(inp == 2):
seq=dic.items()
for a in seq:
print(a)
#Modifying a contact if the entered name is present in the dictionary
elif(inp == 3):
name = input("Enter the name of friend whose number is to be modified: ")
if(name in dic):
phonenumber = input("Enter the new contact number: ")
dic[name] = phonenumber
print("Contact Modified\n\n")
else:
print("This friend's name is not present in the contact list")
#Searching a friend name in the dictionary
elif(inp == 4):
name = input("Enter the name of friend to search: ")
if(name in dic):
print("The friend",name,"is present in the list\n\n")
else:
print("The friend",name,"is not present in the list\n\n")
#Displaying the dictionary in the sorted order of the names
elif(inp == 5):
print("Name\t\t\tContact Number")
for i in sorted(dic.keys()):
print(i,"\t\t\t",dic[i])
print("\n\n")
#Exit the while loop if user enters 7
elif(inp == 6):
break
#Displaying the invalid choice when any other values are entered
else:
print("Invalid Choice. Please try again\n")
32 Write a python program that reads a line and prints its statistics like : 4M
a) Number of uppercase letters :
b) Number of lowercase letters :
c) Number of alphabets :
d) Number of digits :

Page 9 of 11
Ans:
line=input("Enter a line:")
lowercount=uppercount=0
digitcount=alphacount=0
for a in line:
if a.islower():
lowercount+=1
elif a.isupper():
uppercount+=1
elif a.isdigit():
digitcount+=1
if a.isalpha():
alphacount+=1
print("Number of uppercase letters:", uppercount)
print("Number of lowercase letters:", lowercount)
print("Number of alphabets:", alphacount)
print("Number of digits:", digitcount)

Section E
Each question carries 5 marks
33 It is an era of Internet and we as a netizen spend most of our time in the cyber world.
Saumya, a class XI student, is new to the cyber world. Help her in the following:

i) Suggest any two netiquettes, which she should follow in order to become a good 1M
netizen.
Ans:
a) protect your identity
b) Don’t pick fights online.
ii) As the last day was approaching, so one of her friends has just submitted the science 1M
project by copying and pasting from the internet, without even acknowledging the
original source. Is this the right act or wrong? Name the term which is being used for
this act.

Ans: No its not the right act. This act is called plagiarism

iii) Suggest her any two precautions to be taken while using E-commerce. 1M
Ans: Use updated antivirus software
Always ensure to check https in the web address
Never click on any links that you have recie3ved in your mail.
iv) Cyber world is growing exponentially and so is the risk involved in it. Mention any 1M
two common cyber crimes in order to make Saumya aware about it.
Ans:
a) Cyber bullying
b) Cyber Stalking
c) Online frauds
d) Phishing
e) scams
v) Tell her any 2 benefits of e-Waste management. 1M
Ans:
Page 10 of 11
1. Protects public health and water quality
2. Creates Jobs
3. Saves landfill space
4. Allows for recovery of valuable precious metals

34. a) Write one difference and one similarity between List and Tuples. 2+1
b) Write a statement in python to concatenate the given two tuples. +2M
T1=(1,2,3) and T2=(5,6,7)
c) Consider the following tuple and write the code for the following:
t1=(12,3,45, “Hockey”, “Anil”,(“a”,”b”))
i) Display the last element of tuple t1
ii) Display “b” from the tuple t1
iii) Display the tuple t1 in the reverse order.
iv) Display the total number of elements in the tuple t1

Ans: a) similarity: both list and tuple can contain any type of elements and they are
ordered.
Difference: List is mutable but tuples are immutable.
b ) print(T1+T2)
c) i)print(t1[-1])
ii)print(t1[5][1])
iii)print(t1[::-1])
iv) print(len(t1))

35. a) Draw the truth table of exclusive NOR gate for 3 inputs. 2+2
b) Convert (100.25)10 to (?)8 and (?)16 +1
c) Simplify the following Boolean expression.
AB(BC + AC)

Ans: a)
b) (144.2)8 and (64.4)16

c)

*************************

Page 11 of 11

You might also like