Quiz-4
One Subscription, For Everything
The new cool way of learning and upskilling -
One Subscription access everything
Get Access to PrepInsta Prime
from FAANG/IITs/TOP MNC's
PrepInstaPrime
Get over 200+ course One Subscription
Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others.
Comments
Login/Signup to comment
Sir,there is a mistake in output of question 7,8, and 10 . Please correct them as soon as possible.
Yeah thanks Vishal, we got the mistake in Question 7, but could you please elaborate what is the mistake that you are finding in Question 8 and Question 10 ??
Sir, question 8 explanation is correct ,answer is infinte loop but on my screen it shows wrong .
There may be some glitch, please hard-refresh the particular page
Sir, in question 10 output should be “49 3 3” because b=50 and a=2.
At first while (b>9) –>true because 50>9
{ a= b%2 + a => 50%2 + 2=> 0+2=2;
if(a%2!=0) –> false and move to else part
else { print b-1 => 50-1=49}
b= b/2 => b=25 }
At second while (b>9) –>true
{ a= b%2 + a => 25%2 + 2=> 1+2=3;
if(a%2!=0) –> true{ print a => print 3}
b= b/2 => b=12 }
At third while (b>9) –>true
{ a= b%2 + a => 12%2+ 3=> 0+3=3;
if(a%2!=0) –> true{ print a => print 3}
b= b/2 => b=6 }
now b>9 =>false
so output will be 49 3 3
Hey Vishal, sorry for the silly mistake, we’ll fix it up