Question: 7. What will be the output of the following C++ 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="cpp"><ol><li class="li1"><pre class="de1"> <span class="co2">#include &lt;iostream&gt;</span></pre></li><li class="li1"><pre class="de1"> <span class="co2">#include &lt;algorithm&gt;</span></pre></li><li class="li1"><pre class="de1"> <span class="co2">#include &lt;vector&gt;</span></pre></li><li class="li1"><pre class="de1"> <span class="kw2">using</span> <span class="kw2">namespace</span> std<span class="sy4">;</span></pre></li><li class="li1"><pre class="de1"> <span class="kw4">bool</span> myfunction <span class="br0">(</span><span class="kw4">int</span> i, <span class="kw4">int</span> j<span class="br0">)</span> </pre></li><li class="li1"><pre class="de1"> <span class="br0">{</span></pre></li><li class="li1"><pre class="de1"> <span class="kw1">return</span> <span class="br0">(</span>i<span class="sy1">==</span>j<span class="br0">)</span><span class="sy4">;</span></pre></li><li class="li1"><pre class="de1"> <span class="br0">}</span></pre></li><li class="li1"><pre class="de1"> <span class="kw4">int</span> main <span class="br0">(</span><span class="br0">)</span> </pre></li><li class="li1"><pre class="de1"> <span class="br0">{</span></pre></li><li class="li1"><pre class="de1"> <span class="kw4">int</span> myints<span class="br0">[</span><span class="br0">]</span> <span class="sy1">=</span> <span class="br0">{</span><span class="nu0">10</span>, <span class="nu0">20</span>, <span class="nu0">20</span>, <span class="nu0">20</span>, <span class="nu0">30</span>, <span class="nu0">30</span>, <span class="nu0">20</span>, <span class="nu0">20</span>, <span class="nu0">10</span><span class="br0">}</span><span class="sy4">;</span></pre></li><li class="li1"><pre class="de1"> vector<span class="sy1">&lt;</span><span class="kw4">int</span><span class="sy1">&gt;</span> myvector <span class="br0">(</span>myints, myints <span class="sy2">+</span> <span class="nu0">9</span><span class="br0">)</span><span class="sy4">;</span></pre></li><li class="li1"><pre class="de1"> vector<span class="sy1">&lt;</span><span class="kw4">int</span><span class="sy1">&gt;</span> <span class="sy4">::</span> <span class="me2">iterator</span> it<span class="sy4">;</span></pre></li><li class="li1"><pre class="de1"> it <span class="sy1">=</span> unique <span class="br0">(</span>myvector.<span class="me1">begin</span><span class="br0">(</span><span class="br0">)</span>, myvector.<span class="me1">end</span><span class="br0">(</span><span class="br0">)</span><span class="br0">)</span><span class="sy4">;</span> </pre></li><li class="li1"><pre class="de1"> myvector.<span class="me1">resize</span><span class="br0">(</span> distance<span class="br0">(</span>myvector.<span class="me1">begin</span><span class="br0">(</span><span class="br0">)</span>, it<span class="br0">)</span> <span class="br0">)</span><span class="sy4">;</span></pre></li><li class="li1"><pre class="de1"> unique <span class="br0">(</span>myvector.<span class="me1">begin</span><span class="br0">(</span><span class="br0">)</span>, myvector.<span class="me1">end</span><span class="br0">(</span><span class="br0">)</span>, myfunction<span class="br0">)</span><span class="sy4">;</span></pre></li><li class="li1"><pre class="de1"> <span class="kw1">for</span> <span class="br0">(</span>it <span class="sy1">=</span> myvector.<span class="me1">begin</span><span class="br0">(</span><span class="br0">)</span><span class="sy4">;</span> it <span class="sy3">!</span><span class="sy1">=</span> myvector.<span class="me1">end</span><span class="br0">(</span><span class="br0">)</span><span class="sy4">;</span> <span class="sy2">++</span>it<span class="br0">)</span></pre></li><li class="li1"><pre class="de1"> <span class="kw3">cout</span> <span class="sy1">&lt;&lt;</span> <span class="st0">' '</span> <span class="sy1">&lt;&lt;</span> <span class="sy2">*</span>it<span class="sy4">;</span></pre></li><li class="li1"><pre class="de1"> <span class="kw1">return</span> <span class="nu0">0</span><span class="sy4">;</span></pre></li><li class="li1"><pre class="de1"> <span class="br0">}</span></pre></li></ol></div></div></div></div></div></div>
Options:
10 20 30 20 10
10 20 30
30 20 10
40 20 30
Answer: D