MCQOPTIONS
Saved Bookmarks
This section includes 6 Mcqs, each offering curated multiple-choice questions to sharpen your Python knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
Which of the following functions cannot be used on heterogeneous sets? |
| A. | pop |
| B. | remove |
| C. | update |
| D. | sum |
| Answer» E. | |
| 2. |
Write a list comprehension for number and its cube for: |
| A. | [x**3 for x in l] |
| B. | [x^3 for x in l] |
| C. | [x**3 in l] |
| D. | [x^3 in l]View Answer |
| Answer» B. [x^3 for x in l] | |
| 3. |
Input order is preserved in sets. |
| A. | True |
| B. | False |
| Answer» C. | |
| 4. |
Which of the following lines of code will result in an error? |
| A. | s={abs} |
| B. | s={4, ‘abc’, (1,2)} |
| C. | s={2, 2.2, 3, ‘xyz’} |
| D. | s={san} |
| Answer» E. | |
| 5. |
Set makes use of __________ Dictionary makes use of ____________ |
| A. | keys, keys |
| B. | key values, keys |
| C. | keys, key values |
| D. | key values, key values |
| Answer» D. key values, key values | |
| 6. |
The following Python code results in an error. |
| A. | True |
| B. | FalseView Answer |
| Answer» B. FalseView Answer | |