Question: 3. What is the output for 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;bits/stdc++.h&gt; </span> using namespace std<span class="sy0">;</span> <span class="kw4">void</span> convert<span class="br0">(</span><span class="kw4">int</span> a<span class="br0">[</span><span class="br0">]</span><span class="sy0">,</span> <span class="kw4">int</span> n<span class="br0">)</span> <span class="br0">{</span> vector <span class="sy0">&lt;</span>pair<span class="sy0">&lt;</span><span class="kw4">int</span><span class="sy0">,</span> int<span class="sy0">&gt;</span> <span class="sy0">&gt;</span> vec<span class="sy0">;</span> <span class="kw1">for</span> <span class="br0">(</span><span class="kw4">int</span> i <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span> i <span class="sy0">&lt;</span> n<span class="sy0">;</span> i<span class="sy0">++</span><span class="br0">)</span> vec.<span class="me1">push_back</span><span class="br0">(</span>make_pair<span class="br0">(</span>a<span class="br0">[</span>i<span class="br0">]</span><span class="sy0">,</span> i<span class="br0">)</span><span class="br0">)</span><span class="sy0">;</span> sort<span class="br0">(</span>vec.<span class="me1">begin</span><span class="br0">(</span><span class="br0">)</span><span class="sy0">,</span> vec.<span class="me1">end</span><span class="br0">(</span><span class="br0">)</span><span class="br0">)</span><span class="sy0">;</span> <span class="kw1">for</span> <span class="br0">(</span><span class="kw4">int</span> i<span class="sy0">=</span><span class="nu0">0</span><span class="sy0">;</span> i<span class="sy0">&lt;</span>n<span class="sy0">;</span> i<span class="sy0">++</span><span class="br0">)</span> a<span class="br0">[</span>vec<span class="br0">[</span>i<span class="br0">]</span>.<span class="me1">second</span><span class="br0">]</span> <span class="sy0">=</span> i<span class="sy0">;</span> <span class="br0">}</span> <span class="kw4">void</span> printArr<span class="br0">(</span><span class="kw4">int</span> a<span class="br0">[</span><span class="br0">]</span><span class="sy0">,</span> <span class="kw4">int</span> n<span class="br0">)</span> <span class="br0">{</span> <span class="kw1">for</span> <span class="br0">(</span><span class="kw4">int</span> i<span class="sy0">=</span><span class="nu0">0</span><span class="sy0">;</span> i<span class="sy0">&lt;</span>n<span class="sy0">;</span> i<span class="sy0">++</span><span class="br0">)</span> cout <span class="sy0">&lt;&lt;</span> a<span class="br0">[</span>i<span class="br0">]</span> <span class="sy0">&lt;&lt;</span> <span class="st0">" "</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="br0">]</span> <span class="sy0">=</span> <span class="br0">{</span><span class="nu0">10</span><span class="sy0">,</span><span class="nu0">8</span><span class="sy0">,</span><span class="nu0">2</span><span class="sy0">,</span><span class="nu0">5</span><span class="sy0">,</span><span class="nu0">7</span><span class="br0">}</span><span class="sy0">;</span> <span class="kw4">int</span> n <span class="sy0">=</span> <span class="kw4">sizeof</span><span class="br0">(</span>arr<span class="br0">)</span><span class="sy0">/</span><span class="kw4">sizeof</span><span class="br0">(</span>arr<span class="br0">[</span><span class="nu0">0</span><span class="br0">]</span><span class="br0">)</span><span class="sy0">;</span> convert<span class="br0">(</span>arr <span class="sy0">,</span> n<span class="br0">)</span><span class="sy0">;</span> printArr<span class="br0">(</span>arr<span class="sy0">,</span> n<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:
4 3 0 1 2
1 2 3 4 5
5 4 1 2 3
0 1 2 3 4
Answer: A