Question 96Asked in BEL PE Computer Science, 20 Dec 2025 (5:00 PM)

Which of the following algorithms correctly traverses all elements of a one-dimensional array A from index lower_bound to upper_bound?

  1. AStep 1: SET I = upper_bound Step 2: Repeat Steps 3 to 4 while I >= lower_bound Step 3: Apply process to A[I+1] Step 4: SET I = I - 1 Step 5: EXIT
  2. BStep 1: SET I = lower_bound Step 2: Repeat Steps 3 to 4 while I <= upper_bound Step 3: Apply process to A[I] Step 4: SET I = I + 1 Step 5: EXIT
  3. CStep 1: SET I = lower_bound Step 2: Repeat Steps 3 to 4 while I < upper_bound Step 3: Apply process to A[I] Step 4: SET I = I + 1 Step 5: EXIT
  4. DStep 1: SET I = lower_bound + 1 Step 2: Repeat Steps 3 to 4 while I <= upper_bound Step 3: Apply process to A[I] Step 4: SET I = I + 1 Step 5: EXIT
Show answerHide answer

Correct answer: (B) Step 1: SET I = lower_bound Step 2: Repeat Steps 3 to 4 while I <= upper_bound Step 3: Apply process to A[I] Step 4: SET I = I + 1 Step 5: EXIT

From BEL PE Computer Science PYQ, 20 Dec 2025 (5:00 PM)

This is question 96 of BEL PE Computer Science PYQ, 20 Dec 2025 (5:00 PM). See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.