MCQOPTIONS
Saved Bookmarks
This section includes 9 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. |
Which one of the following is immutable data type? |
| A. | list |
| B. | set |
| C. | int |
| D. | dict |
| E. | |
| Answer» D. dict | |
| 2. |
Which one of the following is mutable data type? |
| A. | set |
| B. | int |
| C. | str |
| D. | tupl |
| Answer» B. int | |
| 3. |
What is the output of the following program : print((1, 2) + (3, 4)) |
| A. | (1, 2), (3, 4) |
| B. | (4, 6) |
| C. | (1, 2, 3, 4) |
| D. | Invalid Syntax |
| Answer» D. Invalid Syntax | |
| 4. |
Can tuple be used as dictionary key in python? |
| A. | True |
| B. | False |
| C. | Tuple is not used in python |
| D. | None of the above |
| Answer» B. False | |
| 5. |
What type of data is: arr = [(1,1),(2,2),(3,3)]? |
| A. | Array of tuples |
| B. | Tuples of lists |
| C. | List of tuples |
| D. | Invalid type |
| Answer» D. Invalid type | |
| 6. |
Suppose a tuple arr contains 10 elements. How can you set the 5th element of the tuple to 'Hello'? |
| A. | arr[4] = 'Hello' |
| B. | arr(4) = 'Hello' |
| C. | arr[5] = 'Hello' |
| D. | Elements of tuple cannot be changed |
| Answer» E. | |
| 7. |
How to copy one list to another in python? |
| A. | l1[] = l2[] |
| B. | l1[] = l2 |
| C. | l1[] = l2[:] |
| D. | l1 = l2 |
| Answer» D. l1 = l2 | |
| 8. |
How to get last element of list in python? Suppose we have list with name arr, contains 5 elements. |
| A. | arr[0] |
| B. | arr[5] |
| C. | arr[last] |
| D. | arr[-1] |
| Answer» E. | |
| 9. |
Suppose a list with name arr, contains 5 elements. You can get the 2nd element from the list using: |
| A. | arr[-2] |
| B. | arr[2] |
| C. | arr[-1] |
| D. | arr[1] |
| Answer» E. | |