CBSE Class 12

Computer Science

06 Searching

30
Total
0
Attempted
0
Correct
0
Wrong
00:00:00
Q-1
Consider the following Python code implementing linear search. What will be printed?
Medium Linear Search
Reference Code
```python
arr=[5,8,2,9]
key=2
for i in range(len(arr)):
    if arr[i]==key:
        print(i)
        break
A 2
B 3
C 1
D -1
Answer: 2
Explanation: Element 2 occurs at index position 2.