int a=0,b=2;
if (a=0)
b=0;
else
b=*10;
What is the value of b ?

Answers were Sorted based on User's Feedback



int a=0,b=2; if (a=0) b=0; else b=*10; What is the value of b ?..

Answer / kc

The code will not compile as statement "b=*10" is invalid"
It should be "b*=10".

If i assume "b*=10" then the output will be 20

Reason:
a=0;
b=2;
if(a=0 means 0) so b=0 will not execute
b=b*10=2=10=20;

Is This Answer Correct ?    37 Yes 6 No

int a=0,b=2; if (a=0) b=0; else b=*10; What is the value of b ?..

Answer / sonukrrock

20

Is This Answer Correct ?    28 Yes 11 No

int a=0,b=2; if (a=0) b=0; else b=*10; What is the value of b ?..

Answer / akash

The value of b will be 20.

Because when a=0 is presented in if condition, it will take it as false condition. So the else block will execute.

Is This Answer Correct ?    3 Yes 0 No

int a=0,b=2; if (a=0) b=0; else b=*10; What is the value of b ?..

Answer / guest

0

Is This Answer Correct ?    8 Yes 7 No

int a=0,b=2; if (a=0) b=0; else b=*10; What is the value of b ?..

Answer / kishore sharma

a=0;
b=2;
but  
condition
if(a=0)(b=0)
so
b=*10;
answer is
b=b*10   (b=0)
b=0*10;
  0

Is This Answer Correct ?    0 Yes 1 No

int a=0,b=2; if (a=0) b=0; else b=*10; What is the value of b ?..

Answer / sandeep kumar

if (a=0)
is a wrong statement.
Since it should be
if (a==0)

so, it will throw an error

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More C Interview Questions

void swap(int a,int b) { a=a+b; b=a-b; a=a-b; } in this code always gives the same result for all case

9 Answers   Accenture, TCS,


What are the header files used in c language?

0 Answers  


how to find a 5th bit is set in c program

4 Answers   IBM,


Which of these functions is safer to use : fgets(), gets()? Why?

0 Answers  


C program to find all possible outcomes of a dice?

0 Answers  






main() {int a=200*200/100; printf("%d",a); }

14 Answers   TCS,


HOW CAN ADD OUR FUNCTION IN LIBRARY.

5 Answers  


write a program to delete an item from a particular location of an linear array?

1 Answers  


In C, What is the #line used for?

2 Answers  


int j =15,i; for (i=1; 1<5; ++i) {printf ("%d%d ",j,i); j = j-3; }

2 Answers  


difference between semaphores and mutex?

1 Answers  


What are pointers really good for, anyway?

0 Answers  


Categories