Class Xi (Computer Science) Half Yearly Ms Jaipur Region
Class Xi (Computer Science) Half Yearly Ms Jaipur Region
Class Xi (Computer Science) Half Yearly Ms Jaipur Region
(i) valid
(ii) invalid
C What will be output of following statement: 1
(i) >>> 2<3
(ii) >>> True+4
(i)True
(ii) 5
D Python is an interpreted language. Justify 2
Area=l*b
Perimeter=2*(l+b)
FALSE
C What will be output of following code: 2
A,B,C,D=9.2, 2.0, 4, 21
print(A/4)
print(A//4)
print(B**C)
print(A%C)
2.3
2.0
16.0
1.2
D What will be output of following program segment: 3
A,B,C=9,12,3
X=A-B/3+C*2-1
Y=A-B/(3+C)*(2-1)
Z=A-(B/(3+C)*2)-1
print(“X=”,X)
print(“Y=”,Y)
print(“Z=”,Z)
X=10.0
Y=7.0
Z=4.0
E Write a program to find the simple interest of an investment amount. 3
SI=(PTR)/100
P=principal amount, T=Time in years, R=Rate of interest
IF(condition):
Statement
ELSE:
Statement
n1=int(input(“enter number1”))
n2= int(input(“enter number2”))
rem=n1%n2
if rem==0:
print(n1,”is divisible by”,n2)
else:
print(n1,”is not divisible by”,n2)
E Write a program to find the largest among three numbers. 2
X=INT(INPUT(”ENTER NUMBER1”))
Y=INT(INPUT(”ENTER NUMBER1”))
Z=INT(INPUT(”ENTER NUMBER1”))
IF (X>Y AND X>Z):
PRINT(X,”IS LARGE”)
IF (Y>Z AND Y>X):
PRINT(Y,”IS LARGE”)
IF (Z>X AND Z>Y):
PRINT(Z,”IS LARGE”)
F Write program to read two numbers and an arithmetic operator and display 3
the computed result.
X=FLOAT(INPUT(“ENTER NUMBER1”))
Y=FLOAT(INPUT(“ENTER NUMBER2”))
OP=INPUT(“ENTER OPERATOR:+/-/*//”)
RESULT=0
IF OP==’+’:
RESULT=X+Y
ELIF OP=’-‘:
RESULT=X-Y
ELIF OP=’*‘:
RESULT=X*Y
ELIF OP=’/‘:
RESULT=X/Y
ELSE:
PRINT(“ENTER VALID OPERATOR”)
PRINT(X,OP,Y,’=’,RESULT)
B (i)0,1,2,3,4,5 (iii)5,9,13,17 2
(ii)7,8,9 (iv)12,10,8,6,4,2
C The continue statement in Python returns the control to the 3
beginning of the while loop. The continue statement rejects all the
remaining statements in the current iteration of the loop and moves the
control back to the top of the loop
any example of break and continue
(Two marks for definition and One mark for example)
D n=1 3
for a in range(5):
print(n)
n=n*10+1
½ marks for input ½ for output and 2 marks for logic
5 A (i)syntax error 1
(ii)Semantics error
B (i)p =print for variable value (ii) h=for help 1
C for any one correct reason one marks 1
D A run-time error typically generates an exception or otherwise terminates 2
program e.g. dividing by zero. The program is doing something that is
undefined.
Dictionary are group of key value pairs. The elements in a dictionary are
indexed by keys. Keys should be unique. we can access the data from
dictionary by using keys
C Write a statement for following: 1
(i) Sum of all elements in a list([1,2,3,…100])
(ii) sum of all odd numbers in a list ([1,2,3,….100])
num=[10,51,2,18,4,31,13,5,23,64,29]
print(“list element s are:”,end=” “)
for i in num:
print(i,end=” “)
print()
find=int(input(“”enter element to search))
flag=0
for i in num:
if(i===find):
flag=1
break
if flag==1:
print(“element found)
else:
print(“element not found)
(i) Error
(ii) 222
B What will be output of following: 1
word=’AMAZING’
print(word[0:3])
print(word[-5:-1])
AMA
AZIN