No student devices needed. Know more
5 questions
Which of the following statements is true about searching an array?
Linear search is the only method used to search an array.
The built-in search() function can be used to search an array.
The built-in find() function can be used to search an array.
There are no specific built-in functions to search for an array.
Which loop is used to move through the array elements in a linear search?
"for" loop
"while" loop
"repeat until" loop
"do" loop
To search an element in a given array, linear search will proceed step by step in a ____________ order, starting from the first element in the given array.
In every search iteration, the target value is compared with the current value of the array by using the following operator:
=
==
<>
>=
What is the output of the following piece of code (assume that the code is indented properly):
num = arr.array('i', [1, 3, 5, 7, 9])
for i in range(len(num)):
if num[i] == 5:
print(i)
2
3
5
returns an error
Explore all questions with a free account