google.com, pub-6167773875660516, DIRECT, f08c47fec0942fa0 class 11 computer science chapter 6 mcq questions | class 11 computer science flow of control mcq - 2nd puc computer science

class 11 computer science chapter 6 mcq questions | class 11 computer science flow of control mcq

class 11 computer science chapter 6 mcq questions,class 11 computer science flow of control mcq,flow of control class 11 mcq,flow of control in python class 11 mcq,MCQ on flow of control in Python Class 11,Mcq on flow of control in python class 11 with answers pdf,Mcq on flow of control in python class 11 with answers,Mcq on flow of control in python class 11 pdf,Mcq on flow of control in python class 11 pdf download,Mcq Questions on conditional statements in Python

1. What is the order of execution of statements in a program called?





ANSWER= C) Flow of control

2. Which control structures does Python support for flow of control?





ANSWER= C) Selection and repetition

3. How does Python group statements into a single block of code?





ANSWER= C) Indentation

4. What is used to implement decision-making in Python?





ANSWER= B) if..else statement

5. What does the break statement do in a loop?





ANSWER= C) Exits the loop

6. What is the purpose of the continue statement?





ANSWER= B) Skips the current iteration

7. What is a loop inside another loop called?





ANSWER= B) Nested loop

8. Which of the following is a correct example of a nested loop in Python?





ANSWER= A) `for i in range(3): for j in range(2): print(j)`

9. What happens if indentation is incorrect in a Python program?





ANSWER= C) Syntax error

10. How can a block of code be created in Python?





ANSWER= B) Using indentation

11. What is the output of the following code snippet? Python Code: num1 = 5 num2 = 6 if num1 > num2: print("first number is larger") print("Bye") else: print("second number is larger") print("Bye Bye")





ANSWER= A) Syntax error

12. What will be the output of the following code? Python Code: for i in range(1, 6): if i == 3: continue print(i)





ANSWER= B) 1 2 4 5

13. Which statement is used to skip the rest of the code inside a loop for the current iteration only?





ANSWER= D) continue

14. What type of loop is used in the following code? Python Code: while True: print("Infinite loop")





ANSWER= C) infinite loop

15. Which of the following is the correct syntax for an if..else statement in Python?





ANSWER= A) `if condition: statements else: statements`

16. Which of the following programs will print the sum of all positive numbers entered by the user until a negative number is entered?





ANSWER= A) Python Code: sum = 0 while True: num = int(input("Enter a number: ")) if num < 0: break sum += num print("Sum:", sum)

17. In a nested loop, how many times will the inner loop execute if the outer loop runs 3 times and the inner loop runs 2 times each iteration?





ANSWER= B) 6

18. How is a block of code indicated in Python?





ANSWER= C) By using indentation

19. What type of error will you get if the indentation is not consistent in Python?





ANSWER= B) Syntax error

20. What will be the output of the following code? Python Code: for i in range(5): if i == 2: continue print(i)





ANSWER= C) 0 1 3 4

21. How can the flow of control be altered in a program?





ANSWER= B) Using control structures

22. What does the else part of an if statement represent?





ANSWER= A) Code that runs if the condition is false

23. What does the following code do? Python Code: x = 5 y = 10 if x < y: print("x is less than y") else: print("x is not less than y")





ANSWER= B) Prints "x is less than y"

24. What is the purpose of an infinite loop?





ANSWER= C) To keep running without termination

25. Which of the following is true about the break statement in a loop?





ANSWER= C) It stops the loop entirely

26. What is the output of the following code? Python Code: for i in range(4): print(i) if i == 2: break





ANSWER= B) 0 1 2

27. How does the continue statement affect a loop's execution?





ANSWER= B) Skips the rest of the code inside the loop for the current iteration

28. What is the difference between a for loop and a while loop?





ANSWER= A) For loop is used for definite iteration, while loop is used for indefinite iteration

29. What will be the output of the following code snippet? Python Code: count = 0 while count < 5: count += 1 print(count)





ANSWER= B) 1 2 3 4 5

30. How many times will the loop run in the following code? Python Code: for i in range(3): for j in range(2): print(i, j)





ANSWER= B) 6 times

31. Which statement is used to exit a loop in Python?





ANSWER= B) break

32. What will be the output of the following code? Python Code: i = 0 while i < 4: i += 1 print(i) if i == 2: continue





ANSWER= A) 1 2 3 4

33. What is the purpose of a nested loop?





ANSWER= C) To perform repeated operations on each element of a sequence

34. Which statement correctly describes the functionality of break and continue in Python?





ANSWER= A) break terminates the loop, continue skips the current iteration

35. What is the output of the following code? Python Code: for i in range(3): for j in range(2): if j == 1: break print(i, j)





ANSWER= B) 0 0 1 0 2 0

36. Which of the following is a correct syntax for a while loop in Python?





ANSWER= D) `while (condition): statements`

37. What happens when the break statement is executed inside a nested loop?





ANSWER= B) Exits the inner loop only

38. Which of the following is the correct syntax for a for loop in Python?





ANSWER= B) `for i in range(5): print(i)`

39. How can you create a block of code in Python?





ANSWER= B) Using indentation

40. What is the output of the following code? Python Code: count = 0 while count < 3: print(count) count += 1





ANSWER= C) 0 1 2

41. Which of the following statements will break out of a loop?





ANSWER= D) break

42. What is the purpose of the continue statement in a loop?





ANSWER= B) To skip the rest of the code inside the loop for the current iteration

43. What will be the output of the following code? Python Code: for i in range(3): for j in range(2): if j == 1: break print(i, j) print("Out of nested loop")





ANSWER= C) 0 0 1 0 2 0 Out of nested loop

44. What is the output of the following code? Python Code: for i in range(5): if i == 3: break print(i) else: print("Completed")





ANSWER= B) 0 1 2

45. What is the output of the following code snippet? Python Code: for i in range(2): for j in range(2): print(i, j)





ANSWER= C) 0 0 0 1 1 0 1 1

46. Which of the following is true about the for loop?





ANSWER= B) It is used for definite iteration

47. What will be the output of the following code? Python Code: for i in range(3): if i == 1: break print(i) else: print("Loop completed")





ANSWER= D) 0

48. How do you implement a nested loop in Python?





ANSWER= A) By placing one loop inside another loop

1st puc computer science chapter 6 flow of control mcq
class 11 computer science chapter 6 mcq questions | class 11 computer science flow of control mcq class 11 computer science chapter 6 mcq questions | class 11 computer science flow of control mcq Reviewed by Vision Academy on September 16, 2024 Rating: 5

No comments:

CheckOut

Powered by Blogger.