Python/MCQ on Flow of Control in Python Set 1 Sample Test,Sample questions

Question:
 A statement inside ‘if’ has an indentation of _________ space

1.2

2.4

3.6

4.8


Question:
A graphical representation that shows step by step solution to solve a given problem is __

1.Algorithm

2.Flow Chart

3.Line Chart

4.Pie Chart


Question:
An ‘if’ condition inside another ‘if’ is called ___
a. 

1.Second

2.nested

3.another if

4.All of the above


Question:
Correct syntax of writing ‘simple if’ statement is _____

1. if condition statements

2.if (condition) statements

3.if condition : statements

4.if condition -- statements


Question:
Execution of statements in _________________ construct depend on a condition test.

1.Selection

2.Sequence

3.Iteration

4.Repetition


Question:
if-elif statement is used in situation which involves ____________

1.multiple condition

2.exactly one condition

3.Both of the above

4.None of the above


Question:
In programming, the concept of decision making or selection is implemented with the help of ___________ statement

1.while loop

2.for loop

3. if..else

4.None of the above


Question:
Leading whitespace (spaces and tabs) at the beginning of a statement is called _______

1.indentation

2.orientation

3.Iteration

4.None of the above


Question:
Number of elif in a program is dependent on the _____

1.number of conditions to be checked

2.number of variables in a program

3.number of loops in a program

4.None of the above


Question:
Number of elif in if-elif ladder depends on _

1.number of conditions to be checked in program.

2.number of variables in program.

3.Both of the above

4.None of the above


Question:
Python executes one statement after another from beginning to the end of the program. This is a __

1.Selection Construct

2.Sequential Construct

3.Iteration Construct

4.None of the above


Question:
Python supports _____________ types of control structures

1.1

2.2

3.3

4.4


Question:
Ram wants to create a program to check whether an year is leap year or not. For this he should have a good understanding of __________

1.Conditional Statement

2.. for loop

3.while loop

4.All the above


Question:
Ravi wants to display “Hello”, if the condition is True, otherwise, “Pass” if the condition is False. Which of the following help to implement the same?

1.if statement

2.if .. else statement

3.if .. elif statement

4. for loop


Question:
The order of execution of the statements in a program is known as ___

1.flow of control

2.central flow

3.selection

4.iteration


Question:
What is the purpose of ‘else’ statement in if-elif ladder?

1.else statement in if-elif will execute, if none of the condition is True

2.else statement in if-elif will execute, if all the condition is True.

3.else statement in if-elif will execute, if the condition just above else statement is True

4.None of the above


Question:
Which of the following are control structure in python?

1.Selection

2.Iteration

3.Both of the above

4.Sequential


Question:
Which of the following is not a keyword in Python?

1.True

2.False

3.if

4.For


Question:
Which of the following is variant of conditional statement in Python?

1.simple if without else

2. if .. else

3. if .. elif

4.All the above


Question:
Which of the following statement is not assigning a numerical value 8 to variable X, if original value of X is 0? ?

1.X = 8

2.X + = 8

3.X *= 8

4.None of the above


Question:
Write the output of the following :
x = 10
if x > 7:
 print("Hello")
print("Bye")

1.Bye

2.Hello

3.Bye Hello

4.Hello Bye


Question:
Write the output of the following code :
if True:
 print("Hello")
else:
 print("Bye")

1.Bye

2.Hello

3.Bye Hello

4.Hello Bye


Question:
Write the output of the following code :
y=2
if 2!=y:
 print("H")
else :
 print("K")

1.H

2.K

3.Error

4.Nothing will be printed


Question:
__ is an empty statement in Python.

1.Jump

2.Fail

3.Empty

4.Pass


Question:
_____ statements can be written in if block.

1.2

2.4

3.8

4.any number of


More MCQS

  1. Python MCQS - Function
  2. Python MCQS - GUI in python
  3. Python MCQS - Operators
  4. Python MCQS - Data type in python
  5. Python MCQS - loops in python
  6. Python MCQS - Numpy
  7. Python MCQS - sqlite3
  8. Python MCQS - Library
  9. Python MCQS - Pandas
  10. Python MCQs
  11. Dictionary Python MCQ set 1
  12. Dictionary Python MCQ set 2
  13. MCQ For Python Fundamentals
  14. MCQ Introduction to Python Section 1
  15. MCQ Introduction to Python Section 2
  16. MCQ Introduction to Python Section 3
  17. MCQ on Flow of Control in Python Set 1
  18. MCQ on Flow of Control in Python Set 2
  19. MCQ on Python String Set 1
  20. File Handling in Python section 1
  21. File Handling in Python section 2
  22. Python Functions MCQS Set 1
  23. Python Functions MCQS Set 2
  24. MCQ on List in Python
  25. Pandas MCQ Questions Set 1
  26. Pandas MCQ Questions Set 2
  27. Tuple MCQ in Python
  28. Python dataframe MCQ
  29. Python Mcq Set 1
  30. Python Mcq Set 2
  31. Python Mcq Set 3
  32. Python Mcq Set 4
  33. Python Mcq Set 5
  34. Python Mcq Set 6
  35. Python Mcq Set 7
  36. Python Mcq Set 8
  37. Python Mcq Set 9
  38. Python Mcq Set 10
  39. Python Mcq Set 11
  40. Python Mcq Set 12
  41. Python Mcq Set 13
  42. Python Mcq Set 14
  43. Python Mcq Set 15
  44. Python Mcq Set 16
  45. Python Mcq Set 17
  46. Python Mcq Set 18
  47. Python Mcq Set 19
  48. Python Mcq Set 20
  49. Python Mcq Set 21
  50. Python MCQ
  51. Python MCQ Questions with Answer
  52. Test
  53. python mcq question and answer
Search
Olete Team
Online Exam TestTop Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on Online Exam Testwebsite is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!