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

Can we change the value of constant variable in c?

0 Answers  


How can I discover how many arguments a function was actually called with?

0 Answers  


Write a program to reverse a given number in c?

0 Answers  


struct node {struct node*temp,*new} prinf("%d",sizeof(struct node));

2 Answers  


Describe advantages and disadvantages of the various stock sorting algorithms

1 Answers   Microsoft,






print the table 5 in loops

3 Answers  


count the numbers between 100 and 300, that star with 2 and ends with 2

5 Answers   Mind Tree,


how many keywords do C compile?

7 Answers   Microsoft, Practical Viva Questions,


write a program to display the array elements in reverse order in c language

16 Answers  


What is variable in c with example?

1 Answers  


what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;

0 Answers   L&T,


What does the c preprocessor do?

0 Answers  


Categories