[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

22 / 54

Which of the following option is correct for the below program?

#include<stdio.h>
void main()
{
int a,b,c;
b=2;
a= 2*(b++);
c = 2*(++b);
}

Aa=4,c=6

Ba=3,c=8

Cb=3, c=6

Da=4, c=8

ENone of these

Answer: Option (Login/Signup)

Show Explanation

b=2;  

a= 2*(b );..........a=2*2=4  Here post increment of b will take place and b value after this line has executed will become 2 1= 3.

c = 2*( b);  Here pre increment will take place and before the excecution of this line b value will become 3 1=4 hence c= 2*4=8



so o/p= a=4 and c=8.

Asked In ::

Post Your Answer Here:     

Reply    
Rate This: +0 -0
    Report


Report Error

Please Login First Click Here

Reply    
Rate This: +0 -0
    Report


Report Error

Please Login First Click Here