Question: 5. What is the output of the following code?<div class="hk1_style-wrap4"><div class="hk1_style-wrap3"><div class="hk1_style-wrap2"><div class="hk1_style-wrap"><div class="hk1_style"><div class="c"><pre class="de1"><span class="co2">#include&lt;stdio.h&gt;</span> <span class="kw4">int</span> recursive_binary_search<span class="br0">(</span><span class="kw4">int</span> <span class="sy0">*</span>arr<span class="sy0">,</span> <span class="kw4">int</span> num<span class="sy0">,</span> <span class="kw4">int</span> lo<span class="sy0">,</span> <span class="kw4">int</span> hi<span class="br0">)</span> <span class="br0">{</span> <span class="kw1">if</span><span class="br0">(</span>lo <span class="sy0">&gt;</span> hi<span class="br0">)</span> <span class="kw1">return</span> <span class="sy0">-</span><span class="nu0">1</span><span class="sy0">;</span> <span class="kw4">int</span> mid <span class="sy0">=</span> <span class="br0">(</span>lo <span class="sy0">+</span> hi<span class="br0">)</span><span class="sy0">/</span><span class="nu0">2</span><span class="sy0">;</span> <span class="kw1">if</span><span class="br0">(</span>arr<span class="br0">[</span>mid<span class="br0">]</span> <span class="sy0">==</span> num<span class="br0">)</span> <span class="kw1">return</span> mid<span class="sy0">;</span> <span class="kw1">else</span> <span class="kw1">if</span><span class="br0">(</span>arr<span class="br0">[</span>mid<span class="br0">]</span> <span class="sy0">&lt;</span> num<span class="br0">)</span> lo <span class="sy0">=</span> mid <span class="sy0">+</span> <span class="nu0">1</span><span class="sy0">;</span> <span class="kw1">else</span> hi <span class="sy0">=</span> mid <span class="sy0">-</span> <span class="nu0">1</span><span class="sy0">;</span> <span class="kw1">return</span> recursive_binary_search<span class="br0">(</span>arr<span class="sy0">,</span> num<span class="sy0">,</span> lo<span class="sy0">,</span> hi<span class="br0">)</span><span class="sy0">;</span> <span class="br0">}</span> <span class="kw4">int</span> main<span class="br0">(</span><span class="br0">)</span> <span class="br0">{</span> <span class="kw4">int</span> arr<span class="br0">[</span><span class="nu0">8</span><span class="br0">]</span> <span class="sy0">=</span> <span class="br0">{</span><span class="nu0">0</span><span class="sy0">,</span><span class="nu0">0</span><span class="sy0">,</span><span class="nu0">0</span><span class="sy0">,</span><span class="nu0">0</span><span class="sy0">,</span><span class="nu0">3</span><span class="sy0">,</span><span class="nu0">5</span><span class="sy0">,</span><span class="nu0">6</span><span class="sy0">,</span><span class="nu0">7</span><span class="br0">}</span><span class="sy0">,</span>num <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">,</span>len <span class="sy0">=</span> <span class="nu0">8</span><span class="sy0">;</span> <span class="kw4">int</span> indx <span class="sy0">=</span> recursive_binary_search<span class="br0">(</span>arr<span class="sy0">,</span>num<span class="sy0">,</span><span class="nu0">0</span><span class="sy0">,</span>len<span class="sy0">-</span><span class="nu0">1</span><span class="br0">)</span><span class="sy0">;</span> <span class="kw3">printf</span><span class="br0">(</span><span class="st0">"Index of %d is %d"</span><span class="sy0">,</span>num<span class="sy0">,</span>indx<span class="br0">)</span><span class="sy0">;</span> <span class="kw1">return</span> <span class="nu0">0</span><span class="sy0">;</span> <span class="br0">}</span></pre></div></div></div></div></div></div>
Options:
Index of 0 is 0
Index of 0 is 1
Index of 0 is 2
Index of 0 is 3
Answer: D