0% found this document useful (0 votes)
6 views

Question Paper Pt3

Uploaded by

Kshitij Kandge
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)
6 views

Question Paper Pt3

Uploaded by

Kshitij Kandge
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/ 15

Mount Litera Zee School Goa

UNIT-2
COMPUTATIONAL THINKING AND
PROGRAMMING

Grade XI
Archana Bandekar
Computer Science

Revision PT3 exam


1) Mark True/False:
(i) While statements gets executed at least once
(ii) The break statement allows us to come out of a loop
(iii) The continue and break statement have same effect
(iv) We can nest loops
(v) We cannot write a loop that can execute forever.
(vi) Checking condition in python can be done by using the
if-else statement
Rewrite the following code in python after removing all syntax error(s). Underline each correction
done in the code.

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

State which of the following statement are true .


1.If,elif ,else are not compound statement.
2.Else if can be used in python.
3.Indentation while working with blocks is not necessary in python.
4.A pass statement is a null operation;it does nothing.

a.1 b.2 ,3 c.3 d.4


a) upper( )
Which of the following functions will return the string in all caps?
a) upper( )
b) toupper( ) The term immutable means
a) changeable
c) isupper( ) b) unchangeable
c) changeable in place
d)to-upper( ) d) unchangeable in place d) unchangeable in place
This error occurs when statements are not meaningful b
a) Syntax error
b) Semantics error
c) Name error
d) Runtime error
c
Guess the correct output of the following string operations
str1="exam"
print(str1*2)
a) exam
b) exam exam b
c) examexam
d) Error

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

range(3) in Python is equivalent to:


a. range(0,3,1)
b. range(1,4,1)
c. range(1,3)
d. range(1,3,0)
Find output generated by the following code:
line = "What will have so will"
L = line.split('a')
for i in L:
print(i, end=' ') Wh t will h ve so will

Find output generated by the following code:


p=5/2
q=p*4
r=p+q
p+=p+q+r
27.5 -142.5 12.5
q-=p+q*r
print(p,q,r)
a=(2 + 3) ** 3 - (6 / 2)
b=(2 + 3) * 5// 4 + (4 + 6) / 2 122.0 11.0 10.0 9
c=12 + ( 3 * (4 - 6 )) / 3
d=12 % 5 * 3 + (2 * 6) // 4
print(a, b, c, d)
Rewrite the following code using for loop.
i=100
while(i>0):
print(i)
i-=3

for i in range(100, 0, -3) :


print (i)
TEST 1 QUESTION
Write a program to calculate BMI of a person after inputting its weight in kgs and
height in meters and then print the Nutritional Status as per the following table:

Nutritional Status WHO criteria BMI cut off


Underweight Less than 18.5
Normal 18.5-24.9
Overweight 25 – 29.9
Obese More than equal to 30

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"))

height=float(input("Enter height in meters"))

bmi=weight/(height*height)

print("BMI is ", bmi)

if bmi <18.5:

print("Underweight")

elif bmi >18.5 and bmi< 24.9:

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()

2. The input( ) returns the value as _______ type :

a) Integer b) list c) floating d) none of the above

You might also like