0% found this document useful (0 votes)
13 views8 pages

Delhi Public School, Gandhinagar Half Yearly Examination (2023-24) Computer Science (Set-2: Answer Key)

Uploaded by

duh.compwork
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)
13 views8 pages

Delhi Public School, Gandhinagar Half Yearly Examination (2023-24) Computer Science (Set-2: Answer Key)

Uploaded by

duh.compwork
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/ 8

Delhi Public School, Gandhinagar

Half Yearly Examination (2023-24)


Class: XI Computer Science Date: 20.09.2023
Time: 3 Hours (Set-2: Answer Key) M. Marks: 70

Name: _______________________________ Sec: _________ Roll No.: ________

SECTION – A
1. c) 13 1
(1 mark for the correct answer)
2. b) 1
<class 'float'>
<class 'str'>
<class 'int'>
(1 mark for the correct answer)
3. d) IndexError 1
(1 mark for the correct answer)
4. d) {kendriya} 1
(1 mark for the correct answer)
5. b) Cross Platform 1
(1 mark for the correct answer)
6. a) 4 6 8 1
(1 mark for the correct answer)
7. d) math.sin(x)/math.cos(y)+math.exp(2*x)+math.pow(x+y,1/3) 1
(1 mark for the correct answer)
8. c) 1
1
5
(1 mark for the correct answer)
9. b) Total4 1
(1 mark for the correct answer)
10. b) Cold Cream 1
(1 mark for the correct answer)
11. c) ['My ', ' is ', ' for you'] 1
(1 mark for the correct answer)
Page 1 of 8
12. c) CD 1
(1 mark for the correct answer)
13. c) "PYTHON" + 10 1
(1 mark for the correct answer)
14. c) 1
for J in range(10,-1,-2):
print("X")
(1 mark for the correct answer)
15. d) [10, 8, 6, 4, 2] 1
(1 mark for the correct answer)
16. d) 1
['have', 'fun', 'with']
True
going
(1 mark for the correct answer)
Q17 and 18 are ASSERTION AND REASONING 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
17. d) 1
(1 mark for the correct answer)
18. b) 1
(1 mark for the correct answer)
SECTION – B
19. i) There are two membership operators in Python in and not in. 2
in: Evaluates to true if it finds an object in the specified sequence and false otherwise
not in: Evaluates to true if it does not find an object in the specified sequence and false
otherwise.
ii) title(): It returns a copy of the string with the first character of each word capitalized.
Example
str = "this is string example....wow!!!"
print(str.title())
result: This Is String Example....wow!!!

20. Weather='Raining' 2

Page 2 of 8
if Weather=='Sunny':
print("Wear sunblock')
elif Weather=='Snow':
print('Going Skiing')
else:
print('None of above')
( ½ mark for each correct identification of error)

21. Text=input("Enter a line of text : ") 2


dcnt=0
acnt=0
for i in Text:
if i.isdigit():
dcnt+=1
if i.isalpha():
acnt+=1
print('The no. of digits in the line:',dcnt)
print('The no. of alphabets in line: ' ,acnt)
(½ mark for correct for statement
½ mark for correct initialization of variables
½ mark for each correct if statement
1 mark for correct i/p and o/p statements
OR
Num = int(input("Enter a number:"))
N1=Num%100
Int1=Num//100
N2=Int1%100
Int2=Int1//100
N3=Int2%100
print("Three 2 digit numbers are:",N1,N2,N3)
( 1 mark for i/p and o/p
1 mark for proper use of // and % operator)
22. [16, 15, 14, 1] 2
(1 mark for any two correct values
(2 marks for all four correct values)
23. i) 'computer science' 2
ii) 3
iii) -1

Page 3 of 8
iv) False
( ½ mark for each correct output)
24. ALGORITHM: 2
STEP 1: START
STEP 2: Input sides of triangle, A, B, and C
STEP 3: Find the largest of three sides and store it in LargestSide. Take Side1 and Side2
as the remaining sides
STEP 4: Compute R=(Side12 +Side22)
STEP 5: If LargestSidexLargestSide= R GOTO STEP 6 ELSE STEP 7
STEP 6: Print “Right Angled Triangle” GOTO STEP 7
STEP 7: Print “Not a Right Angled Triangle.” GOTO STEP 8
STEP 8: END
( 1 mark for any four correct steps, 2 marks for all correct steps)
25. Model 2
Experiment
2021
XI
CS
Science
( 1 mark for any three correct lines of output,
2 marks for all correct lines of output)
SECTION – C
26. i) [1, 7, 2, 2, 6, 4, 9] 3
(1 mark for the correct output)
ii) apple
cherry
litchi
orange
(1 mark for the correct output)
iii) False
(1 mark for the correct output)
27. i) 'madam'.rfind('m') 3
ii) 'hello'.replace('o', '*')
iii) 'hectic'.lstrip('h')
iv) 'Revolution'.partition('t')
v) "ScHoOl".swapcase()
vi) 'S' in 'Schedule'
( ½ mark for each correct expression)
28. n=int(input("Enter a positive number:")) 3
Page 4 of 8
num=n+2
for i in range(2,num//2+1):
if num%i==0:
print("Composite")
break
else:
print("Prime")
(1 mark for i/p and o/p
1 mark for loop
1 mark for condition and use of break)
OR
n=int(input("Enter number of Terms:"))
x=int(input("Enter value of x:"))
sum=0
for i in range (1,n+1):
num=x**i
term=x/i
if i%2==1:
sum+=term
else:
sum-=term
print("Sum of series:",round(sum,2))
( ½ mark for input/output,
½ mark for loop,
1 mark for evaluating the term and adding it to sum)
29. i) Mutable types means those data types whose values can be changed at the time of 3
execution. Lists, Dictionaries, and Sets are mutable types in Python.
(1 mark for the correct answer)
ii) Python offers two jump statements to be used within loops to jump out of loop iterations
or to transfer the program control. e.g. break and continue statements.
(1 mark for the correct answer with an example)
iii) ord() returns the ASCII value of a given character.
ord('A') returns 65
(1 mark for the correct explanation)
30. qtf=int(input("Enter Quarterly Tuition Fee:")) 3
atc=int(input("Enter Annual Transport Charges:"))
amc=int(input("Enter Annual Mess Charges:"))
charges=qtf*4+105/100+atc*107.5/100+amc*110.25/100
print("Charges Payable for the entire year:",int(charges))

Page 5 of 8
(1 ½ mark for i/p and o/p
1 ½ mark for calculation of charges)
SECTION – D

31. i) Max value for Lower: 3 2


Max value for Upper: 4
Correct option: b)

ii) a) [14, 'four numbers'] 2


b) 'four'
(1 mark for each correct answer)

32. import math 4


a,b,c=eval(input("Enter coefficients a, b and c: "))
d=b*b-4*a*c;
if(d>0):
x1=(-b+math.sqrt(d))/(2*a)
x2=(-b-math.sqrt(d))/(2*a)
print("Roots are real and different.")
print("x1 = ",x1)
print("x2 = ",x2)
elif (d==0):
print("Roots are real and same.")
x1 = (-b+math.sqrt(d))/(2*a)
print("x1 = x2 =",x)
else:
rp=-b/(2*a)
ip=math.sqrt(-d)/(2*a)
print("Roots are complex and different.")
print("x1 = ",rp," + ",ip,"i")
print("x2 = ",rp," - ",ip,"i")
(1 mark for input/output
½ mark for calculating d,
1 mark for conditions
1 ½ marks for evaluating roots)
SECTION – E
33. i) len(List) 1
ii) List.extend([56,66]) 1
iii) List.clear() 1
iv) List[List.index(19)]=99 1
Or

Page 6 of 8
List[3]=99
v) print(List[::-1]) 1
34. i) The main difference between lists and a string is the fact that lists are mutable whereas 5
strings are immutable. A mutable data type means that a Python object of this type can be
modified.
In consecutive locations, strings store the individual characters while lists store the
references of its elements of different data types
(1 mark each for any two correct points of difference)
ii) val=eval(input("Enter a list:"))
print("Original List:", val)
s=len(val)
if s%2!=0:
s=s-1
for i in range(0,s,2):
val[i],val[i+1]=val[i+1],val[i]
print("List after swapping:",val)
(1 mark for i/p and o/p
1 mark for condition and loop
1 mark for swapping)
OR
mylst=eval(input("Enter a list:"))
high=mylst[0]
low=mylst[0]
cnt=0
s=0
for ele in mylst:
cnt+=1
if ele>high:
high=ele
if ele<low:
low=ele
s=s+ele
print("Highest:",high)
print("Lowest:",low)
print("Average:",s/cnt)
(1 mark for i/p and o/p
1 mark for initialization of variables and loop
1 mark for evaluating highest, lowest and average)

Page 7 of 8
35. i) An Error indicates serious problems that a reasonable application should not try to catch." 1
An Error is a bug or mistake in the code.
An Exception is an unexpected situation that may result in an abnormal termination of a
program. An exception indicates conditions that a reasonable application might want to
catch. Python uses try..catch blocks to handle an exception.
(1 mark for the correct point of difference)
ii) a) [['students','words'],'few'] 1
b) 'words'
( ½ mark for each correct output)
iii) hellohellohello 123 1
hellowworld 10
( ½ mark for each correct output)
iv) Mmin 1
y Py
(½ mark for each correct line of output)
v) Odd Balanced 1
(1 mark for the correct answer)

Page 8 of 8

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy