MCQOPTIONS
Saved Bookmarks
This section includes 8 Mcqs, each offering curated multiple-choice questions to sharpen your Python knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
IF_A={5,6,7,8},_WHICH_OF_THE_FOLLOWING_STATEMENTS_IS_FALSE??$ |
| A. | print(len(a)) |
| B. | print(min(a)) |
| C. | a.remove(5) |
| D. | a[2]=45 |
| Answer» B. print(min(a)) | |
| 2. |
If a={5,6,7}, what happens when a.add(5) is executed?$ |
| A. | a={5,5,6,7} |
| B. | a={5,6,7} |
| C. | Error as there is no add function for set data type |
| D. | Error as 5 already exists in the set |
| Answer» E. | |
| 3. |
{4,5} |
| A. | {6} |
| B. | Error as unsupported operand type for set data type |
| C. | Error as the duplicate item 6 is present in both sets |
| Answer» D. | |
| 4. |
{4,5,6,2,8} |
| A. | {4,5,6,2,8,6} |
| B. | Error as unsupported operand type for sets |
| C. | Error as the duplicate item 6 is present in both sets |
| Answer» B. Error as unsupported operand type for sets | |
| 5. |
{1,2? |
| A. | True |
| B. | False |
| C. | Invalid operation |
| Answer» D. | |
| 6. |
Which of the following statements is used to create an empty set? |
| A. | { } |
| B. | set() |
| C. | [ ]. |
| D. | ( ) |
| Answer» E. | |
| 7. |
5 5 6 |
| A. | 5 6 7 |
| B. | 5 5 6 7 7 7 |
| C. | 5 6 7 7 7 |
| Answer» C. 5 6 7 7 7 | |
| 8. |
Which of the following is not the correct syntax for creating a set? |
| A. | set([[1,2],[3,4]]) |
| B. | set([1,2,2,3,4]) |
| C. | set((1,2,3,4)) |
| D. | {1,2,3,4} |
| Answer» B. set([1,2,2,3,4]) | |