Neco 2022 Computer Studies Question 34

Practice objective / multiple choice question 34 from the 2022 Neco Computer Studies examination.

Neco 2022 Computer Studies Objective / Multiple Choice Medium Difficulty
Question 34 NECO • 2022 • COMPUTER_STUDIES • objective

Below is a pseudo‑code for a binary search on a sorted array A[1..10] looking for a target value T. ``` low = 1 high = 10 while low <= high mid = (low + high) / 2 if A[mid] = T then print "found" exit else if A[mid] < T then low = mid else high = mid print "not found" ``` Identify the logical error that can cause the loop to run indefinitely when T is absent, and state the corrected statements for updating `low` and `high`.

Answer Options

Correct Answer A. Use low = mid + 1 and high = mid - 1 instead of low = mid and high = mid
B. Use low = mid - 1 and high = mid + 1 instead of low = mid and high = mid
C. Use low = mid + 1 and high = mid instead of low = mid and high = mid
D. Use low = mid and high = mid - 1 instead of low = mid and high = mid
Correct Answer
A
Correct Option:
Use low = mid + 1 and high = mid - 1 instead of low = mid and high = mid

About This Question

This is Neco 2022 Computer Studies Question 34. It is one of the objective questions from the 2022 Neco Computer Studies examination.

Difficulty level: Medium .

Master the Exam!

You've seen a preview, but there are thousands more questions plus AI tutor to break down complex solutions.

Unlock Full Access Available for Android & Windows
Chat with Support