Question Paper Pt3
Question Paper Pt3
UNIT-2
COMPUTATIONAL THINKING AND
PROGRAMMING
Grade XI
Archana Bandekar
Computer Science
30=To
for K in range(0,To)
IF k%4==0:
print (K*4)
Else:
print (K+3)
To=30
for K in range(0,To):
if K%4==0:
print(K*4)
else:
print(K+3)
What is the logical expression for the following Either A is greater than B or A is
less than C
a. A>B or A<C b. A>B and A<C c . A>Band C d. A>B or C
A ___________ loop is the one whose terminating condition is missing or not reachable
a) nested
b) infinite
c)multiple
d) repeated
Find the output of the following program segments:
for i in range(20,30,2):
print(i)
a. 20 22 24 26 28
b. 20
22
24
26
28
c. 20 22 24 26 28 30
d. 20
22
24
26
28
30
Find the output of the following program
segments:
i=0
sum = 0
while i < 9:
if i % 4 == 0:
sum = sum + i
i=i+2
print (sum)
a. Infinite Loop
b. 12
c. 14
d. 10
i) Write difference between split() and partition() function. (Two points each)
ii) What will be the result of the following expression?
i) "string are fun".[5]
ii) "pineapple"<"peach"
weight=float(input("Enter weight in kg"))
bmi=weight/(height*height)
if bmi <18.5:
print("Underweight")
print("Normal")
b)
elif bmi >25 and bmi< 29.9:
i) SyntaxError: invalid syntax
print("Overweight")
ii) False
else:
print("obese")
split() partition()
It will split the function in any It will split the string at the first
occurrence of the given argument. occurrence of the given argument.
It will return a list type containing the It will return tuple type containing the
list substring. split substrings.
The length of the the list is equal to the It will return tuple len 3, with the given
number of words, if split on white separator as the middle value of the
spaces.. tuple.
TEST 2 QUESTION
1. Which method removes all the leading whitespaces from the left of the string.
a) split() b) remove() c) lstrip() d) rstrip()