[Updated] Goldman Sachs Aptitude Test Questions and Answers
Practice List of TCS Digital Coding Questions !!!
Take 50+ FREE!! Online Data Interpretation Mock test to crack any Exams.

C Programming :: Declarations and Initializations - Discussion

Home > C Programming > Declarations and Initializations > MCQs Questions Discussion

30 / 54

What will be output of the following "c" code?

#include<stdio.h> 
void main ( )
{
 int a=500, b=100,c;
if( !(a>=400))
b=200;
c=200;
printf( "%d %d", b,c);
}

A200 100

B100 200

C200 200

DCompilation Error

Answer: Option (Login/Signup)

Show Explanation

In the next line, we have an if condition, let's try to analyze it-

a>=400, which is true as 500>400, so the result is 1, but !1 results to 0. So, the 'if' part now becomes something like if(0), which is false. So, the 'if' part is not executed, which means b is not updated to 200. b remains 100 as it was.

c gets initialzed to 200.

So, the output will be 100 200.

Asked In ::

Post Your Answer Here:     

Reply    
Rate This: +1 -0 +
    Report


Report Error

Please Login First Click Here