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

difference between c and c++?

2 Answers  


What are the back slash character constants or escape sequence charactersavailable in c?

0 Answers  


Explain a file operation in C with an example.

0 Answers   Amdocs,


WAP that prints the number from 1 to 100. but for multiplies of three print "XXX" instead of the number and for the multiplies of five print "YYY" . for number which are multiplies of both three and five print "ZZZ"

3 Answers  


What is the maximum no. of arguments that can be given in a command line in C.?

0 Answers   HCL,






how to swap four numbers without using fifth variable?

2 Answers  


How to add two numbers without using semicolon at runtime

2 Answers  


Explain argument and its types.

0 Answers  


What is 2c dna?

0 Answers  


int i[2], j; int *pi;i[0] = 1; i[1] = 5; pi = i; j = *pi + 1 + *(pi + 1)Value of j after execution of the above statements will be a) 7 b) 6 c) 4 d) pointer

0 Answers  


a.One Cannot Take the address of a Bit Field b.bit fields cannot be arrayed c.Bit-Fields are machine Dependant d.Bit-fields cannot be declared as static Which of the Following Statements are true w.r.t Bit-Fields A)a,b&c B)Only a & b C)Only c D)All

3 Answers   Accenture, Digg.com,


What is function what are the types of function?

0 Answers  


Categories