MCQOPTIONS
Saved Bookmarks
This section includes 15 Mcqs, each offering curated multiple-choice questions to sharpen your Technical MCQs knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
The continue statement can be used in? |
| A. | while loop |
| B. | for loop |
| C. | do-while |
| D. | Both A and B |
| E. | |
| Answer» E. | |
| 2. |
The ________ statement is a null operation. |
| A. | break |
| B. | exit |
| C. | return |
| D. | pass |
| Answer» E. | |
| 3. |
Python programming language allows to use one loop inside another loop known as? |
| A. | switch |
| B. | foreach |
| C. | nested |
| D. | forall |
| Answer» D. forall | |
| 4. |
If the else statement is used with a while loop, the else statement is executed when the condition becomes _______. |
| A. | TRUE |
| B. | FALSE |
| C. | Infinite |
| D. | Null |
| Answer» C. Infinite | |
| 5. |
A loop becomes infinite loop if a condition never becomes ________. |
| A. | TRUE |
| B. | FALSE |
| C. | Null |
| D. | Both A and C |
| Answer» C. Null | |
| 6. |
Does python have switch case statement? |
| A. | True |
| B. | False |
| C. | Python has switch statement but we can not use it. |
| D. | None of the above |
| Answer» C. Python has switch statement but we can not use it. | |
| 7. |
'p' + 'q' if '12'.isdigit() else 'r' + 's'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 |
| Answer» C. if a === c: | |
| 8. |
What will be output of this expression: |
| A. | pq |
| B. | rs |
| C. | pqrs |
| D. | pq12 |
| Answer» B. rs | |
| 9. |
In a Python program, a control structure: |
| A. | Defines program-specific data structures |
| B. | Directs the order of execution of the statements in the program |
| C. | Dictates what happens before the program starts and after it terminates |
| D. | None of the above |
| Answer» C. Dictates what happens before the program starts and after it terminates | |
| 10. |
Can we write if/else into one line in python? |
| A. | Yes |
| B. | No |
| C. | if/else not used in python |
| D. | None of the above |
| Answer» B. No | |
| 11. |
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 |
| Answer» D. None of the above | |
| 12. |
Which one of the following is a valid Python if statement : |
| A. | if a>=2 : |
| B. | if (a >= 2) |
| C. | if (a => 22) |
| D. | if a >= 22 |
| Answer» B. if (a >= 2) | |
| 13. |
Which of the following is True regarding loops in Python? |
| A. | Loops should be ended with keyword "end". |
| B. | No loop can be used to iterate through the elements of strings. |
| C. | Keyword "break" can be used to bring control out of the current loop. |
| D. | Keyword "continue" is used to continue with the remaining statements inside the loop. |
| Answer» D. Keyword "continue" is used to continue with the remaining statements inside the loop. | |
| 14. |
Which of the following is False regarding loops in Python? |
| A. | Loops are used to perform certain tasks repeatedly. |
| B. | While loop is used when multiple statements are to executed repeatedly until the given condition becomes False |
| C. | While loop is used when multiple statements are to executed repeatedly until the given condition becomes True. |
| D. | for loop can be used to iterate through the elements of lists. |
| Answer» C. While loop is used when multiple statements are to executed repeatedly until the given condition becomes True. | |
| 15. |
Which of the following is not used as loop in Python? |
| A. | for loop |
| B. | while loop |
| C. | do-while loop |
| D. | None of the above |
| Answer» D. None of the above | |