Which of the following is the correct way to create an array in Python using the array module?
arr = array.array('i', [1, 2, 3])
arr = array('i', [1, 2, 3])
What is the output of the following code?
Python
from array import array
arr = array('i', [1, 2, 3, 4, 5])
print(arr[0])
Which of the following methods is used to add an element to the end of an array?
What will be the output of the following code?
Python
from array import array
arr = array('i', [1, 2, 3])
arr.insert(1, 4)
print(arr)
What does the index method do in an array?
Returns the last occurrence of a specified value
Inserts a value at a specified position
Returns the index of the first occurrence of a specified value
Removes an element at a specified position
How to create an empty array of integers in Python using the array module?
arr = array.array('i', [])
What does the following code print?
Python
from array import array
arr = array('i', [1, 2, 3])
arr[1] = 5
print(arr)
What is the result of the following code?
Python
from array import array
arr1 = array('i', [1, 2, 3])
arr2 = array('i', [4, 5])
arr1 += arr2
print(arr1)
array('i', [1, 2, 3, 4, 5])
array('i', [4, 5, 1, 2, 3])
array('i', [1, 2, 3, 9, 10])
What is the time complexity of accessing an element in an array by index?
Which of the following operations is not allowed on a Python array?
Accessing an element by index
Adding elements of different types
Iterating through elements
There are 10 questions to complete.
Take a part in the ongoing discussion
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4