0% found this document useful (0 votes)
1K views

XI - CH-3, Conditional and Looping Construct (Assign)

This document contains a multiple choice quiz about conditional and looping constructs in Python. There are 42 multiple choice questions testing knowledge of topics like algorithms, flowcharts, if/else statements, for and while loops, break, continue, and other conditional and looping concepts in Python. The questions cover syntax, logic, and evaluating the output of sample code snippets involving these programming constructs.

Uploaded by

Arun Sharma
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)
1K views

XI - CH-3, Conditional and Looping Construct (Assign)

This document contains a multiple choice quiz about conditional and looping constructs in Python. There are 42 multiple choice questions testing knowledge of topics like algorithms, flowcharts, if/else statements, for and while loops, break, continue, and other conditional and looping concepts in Python. The questions cover syntax, logic, and evaluating the output of sample code snippets involving these programming constructs.

Uploaded by

Arun Sharma
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

VIDYA MANDIR PUBLIC SCHOOL, SEC-15A, FARIDABAD, HRY

CLASS: XI SUBJECT: COMPUTER SCIENCE


Chapter-3 CONDITIONAL AND LOOPING CONSTRUCTS
ASSIGNMENT
MCQ
1) _____ is a graphical representation of steps an algorithm to solve a given problem.
a) Algorithm b) Flowchart c) Program d) Process

2) is a step-by-step procedure to solve a given problem.


a) Algorithm b) Flowchart c) Program d) Process

3) A _________ show a start point or end point in the flow chart.


a) Oval b) Rectangle c) Parallelogram d) Diamond

4) The flow of program are


a) Sequence b) Selection Conditional c) Looping d) All of these

5) The statement allows us to execute a statement or group of statements multiple times.


a) Algorithm b) Flowchart c) Program d) Loop

6) Which of the following is not used as loop in Python?


a) for b) while c) do while d) None

7) Which one of the following is a invalid Python if statement :


a) if a>=22 : b) if (a >= 22) c) if (a => 22) : d) None

8) What keyword would you use to add an alternative condition to an if statement?


a) else if b) elseif c) elif d) None of the above

9) Which statement will check if a is equal to b?


a) if a = b: b) if a == b: c) if a == c: d) if a == b

10) How many times will the loop run?


i=2
while(i>0):
i=i-1
a) 2 b) 3 c) 1 d) 0

11) What is the output of the following code?


x=0
if (x<100):
x=x+2
print(x)

a) 100 b) 102 c) 2 d) None

12) for i in [11,22,33,44]: , How many times a loop will run?


a) 0 b) 1 c) 2 d) 3

13) What is the output of the following if statement


n=3
if n==4 :
print("welcome")
elif n==5:
print("thank you")
else:
print("bye bye")

a) Welcome b) Thank you c) bye bye


14) What is the output of the following if statement

n,x=3,4
if n+x==4 :
print("welcome")
elif n+x==7:
print("thank you")
else :
print("bye bye")

a) welcome b) thank you c) bye bye

15) What is the output of the following code


for x in range (30, 35):
if (x==33) :
continue
print(x)

a) 30 31 32 33 34 35 c) 30 31 32 33 34
b) 30 31 32 33 d) 30 31 32 34

16) The output of given code :


for x in range (30, 35):
if (x==34) :
pass
print(x)

a) 30 31 32 33 34 35 c) 30 31 32 33 34
b) 30 31 32 33 d) 30 31 32 34

17) What is the output of the following code


k=20
while k> 1:
print(k )
k=k-5

a) 20 15 10 c) 20 10 5
b) 20 15 10 5 d) None

18) What is the output of the following code


for x in range (10, 15):
if (x==12) :
break
print(x)

a) 10 11 12 c) 10 11 12 13
b) 10 d) 10 11

19) The logical expression to represent the condition:


Marks is greater than or equal to 50 but less than 10
a) Mark >= 50 and Mark< 10 c) Mark => 50 and Mark < 10
b) Mark => 50 or Mark <10 d) None of these

20) The logical expression to represent the condition:


Name is nita and age is between 10 and 20
a) Name=="nita" and age >=10 and age <=20 c) Name= "nita" or age >=10 and age <=20
b) Name== nita and age between 10 and 20 d) Name=="nita" and age >=10 or age <=20
21) The logical expression to represent the condition:
Either A is greater than B or A is less than C
a) if A> B or A<C :
b) if A> B and A<C :
c) if A < B and A<C :
d) None of these

22) The logical expression to represent the condition:


Place is either "Delhi" or "Goa" but not "Jaipur"
a) Place == "Delhi" or Place== "Goa" and Place != "Jaipur"
b) Place == "Delhi" or Place== "Goa" or Place != "Jaipur"
c) Place == "Delhi" and Place== "Goa" and Place != "Jaipur"
d) None of these

23) What is the output of the following code


for i in range (7, 10, 2 ):
print(i)
a) 7,8,9,10 c) 7,9
b) 7 d) None

24) What is the output of the following code


For for i in range (10, 5, -2 ):
print(i)

a) 10 8 6 c) 10 8
b) 10 9 8 7 d) 10 9 8
25) What is the output of the following code
for i in range (-100, 100, 100 ):
print(i , end=" ")

a) -100 0 b) -100 0 100 c) -100 d) None of these

26) The different types of Jump statement in Python.


a) break b) continue c) both a & b d) none

27) Which loop is called as counting loop.


a) while b) for c) do while d) none

28) Which loop is as called entry-controlled loop.


a) while b) for c) do while d) none

29) Which of the following is consider as a infinite loop


a) while(infinite) c) while True:
b) for(1) d) none of these

30) A loop may contain another loop as a part of its body. This loop inside a loop is
called_______
a) while loop b) for loop c) Nested loop d) Infinite loop

31) To exit out from loop , which keyword we use?


a) break b) continue c) exit d) None

32) while True : how many times a loop run ?


a) 0 b) 1 c) 3 d) Infinite
33) The loop that never ends is called
a) while loop b) for loop c) Nested loop d) Infinite loop

34) The loop is the best when number of iterations is known


a) while loop b) for loop c) Nested loop d) Jump

35) The loop that reptition of a set of statement depending upon a condition test
a) while loop b) for loop c) Nested loop d) Infinite loop

36) Which of the following is not a decision- making statement?


a) if-elif b) for c) if-else d) if

37) Symbol is used to end the if statement .


a) semicolon ; b) colon : c) hypen - d) Underscore _

38) What abandon the current iteration of the loop


a) break b) pass c) stop d) infinite

39) What is the output produced by the following code?


if True :
print(101)
else:
print(202)

a) 101 b) 202 c) 303 d) Error

40) What is the output produced by the following code?


k=5
while k>0:
print(k)
print("Thank you")

a) 5 times b) Once c) Infinite d) Error

41) What is the output produced by the following code?


x=3
if (x>2 or x<5) and x==6:
print("OK")
else:
print("No Output")

a) OK b) No Output c) Output d) Error

42) What is the output produced by the following code?


x=1
if x>3:
print(“Welcome”)
elif x<2:
if (x!=0):
print(“ByeBye”)
print("hello")

ByeBye
hello
Short Answer
1. What is an Algorithm ?
2. What is flowchart ? What are different types of symbols used in flowchart
3. Draw a flowchart to find bigger number among two numbers (selective)
4. Draw a flow chart to find factorial of any number. N=5
5. What is statement ? How many types of statement are there?
6. What is pass statement ? What its significance?
7. What is the difference between expression and a statement ?
8. What is a block in PYTHON? How is indentation related to it?
9. What are iteration statements? Name the two iteration statement provided by the PYTHON.
10. What is the syntax of for loop? Explain with example?
11. Define entry controlled loop in python ? Explain with example?
12. What is the difference between for and while loop?
13. What are jump statements? Name them?
14. Explain break with example?
15. Explain continue with example?
16. Find the value generated
a) for i in range (6)
b) for i in range (3, 7)
c) for i in range (5, 15, 3)
d) for i in range (9, 3, -1)
e) for i in range (10 , 1 ,-2)

17. Convert for loop in while loop?


for k in range ( 5, 10 , 2 ) :
print (k )

Short Answer
1. What is an Algorithm ?
 An Algorithm is a step –by- step procedure to solve a given problem.

2. What is flowchart ? What are different types of symbols used in flowchart


 A flowchart is a graphical representation of an algorithm to solve a given problem.
 The different symbols used in flowcharts.
Name Symbols Description
The oval symbol indicates Start, Stop and Halt in a program’s
Terminals logic flow. Terminal is the first and last symbols in the flowchart.
A box represents arithmetic instructions. All arithmetic processes
Process box such as adding, subtracting, multiplication and division are
process symbol.
Input / Program instructions that take input from input devices and
Output Box display output on output devices are indicated with
parallelogram in a flowchart.
Decision based operations such as yes/no question or true/false
Decision box are indicated by decision box in flowchart.
Flow lines represent the direction of flow of control and
Flow lines relationship among different symbols of flowchart.
Whenever flowchart spreads over more than one page, it is
Connector useful to use connectors to avoid any confusions. It is
represented by a circle.

3. Draw a flowchart to find bigger number among two numbers (selective)


4. Draw a flow chart to find factorial of any number. N=5

5. What is statement ? How many types of statement are there?


 Statement are the instructions given to the computer to perform any kind of action.
 Python statement are of three types
 Empty Statement pass
 Simple Statement c=a+b , x=input()
 Compound Statement

6. What is pass statement ? What its significance?


 The pass statement of Python is a do nothing statement that is empty statement or null
operation statement.
 Example
if condition:
pass
7. What is the difference between expression and a statement ?
Expression Statement
Legal combination of symbols Programming instruction as per Python syntax
Represents something Does something
E.g. (3 + 4)/5 print (“Hello”)
x=input(”Enter the number”)
A=(3+4)/5

8. What is a block in PYTHON? How is indentation related to it?


 A group of statement are called block/compound statement in Python.
 Indentation in Python is very important when you are using a block statement .

9. What are iteration statements? Name the two iteration statement provided by the PYTHON.
 Repeated execution of a set of statements in a program is called iteration.
 Python provides two types of looping constructs:
 while statement
 for statement

10. What is the syntax of for loop? Explain with example?


 The for loop of Python is a counting loop means the loop that repeats a certain number of times.
 The for loop of Python is designed to process the items of any sequence one by one
 Syntax
for <var> in < list/tuple/string /Dictionary> :
STATEMENTs
for <var> in range(start,stop,step) :
STATEMENTs

11. Define entry controlled loop in python ? Explain with example?


 An entry – controlled loop is a while loop that controls the entry in the loop by testing a
Condition check is at the entry of the loop. Loop is not entered, if the condition is false.
 Syntax is: while condition:
STATEMENTs

12. What is the difference between for and while loop?


for loop while loop
i) A for loop is a counting loop A while loop is a conditional loop.
ii) It repeat to a certain number of times It repeat until a certain condition is true
iii) For loop is auto increment or auto While loop is not auto increment or auto
decrement decrement

13. What are jump statements? Name them?


 Jump statement are used within loops to jump out of loop-iteration.
 The two jump statement are break and continue.

14. Explain break with example?


 A break statement skips the rest of the loop and jumps over to the statement
following the loop
 Syntax : break
15. Explain continue with example?
 The continue statement skips the rest of the loop statements and causes the next
iteration of the loop to take place.
 Syntax : continue

16. Find the value generated


a) for i in range (6) 012345
b) for i in range (3, 7) 3456
c) for i in range (5, 15, 3) 5 8 11 14
d) for i in range (9, 3, -1) 9 8 7 6 5 4
e) for i in range (10 , 1 ,-2) 10 8 6 4 2

17. Convert for loop in while loop?


for k in range ( 5, 10 , 2 ) :
print (k )
k=5
while k<10
print (k )
k=k+2

You might also like