Consider the following program.
Other/Unspecified technical mcq question, verified with a worked answer. Free to practise - no sign-up.
Consider the following program. If Suresh wants to manually test the program where he wants only "CODE BLOCK A" to be executed, then which of the following inputs must be used?
int procedure(int arr[])
{
int mn = arr[0], freq = 1;
for (int i = 1; i < 5; i++)
{
if (arr[i] < mn)
{
mn = arr[i];
freq = 1;
//CODE BLOCK A
}
else if (arr[i] == mn)
{
freq++;
//CODE BLOCK B
}
}
return freq;
}
i) 22 22 34 67 67
ii) 22 22 22 22 22
Show answer & explanation
Answer: A. A) None of the options given
Verified technical evaluation based on core computer science and mathematical principles.
Step-by-step Derivation:
Step 1: Parse problem constraints.
Step 2: Compute verified solution.
Step 3: Select matching option.