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

Define a structure to store the record of library. The record must consist of at least following fields: Title, Author, Edition, Price, Publisher, and Category. -Define functions authorSearch ( ), TitleSearch ( ) and CategorySearch ( ) to search a book with respect to author, title and category. [There can be more than one book, written by one author, in one category]

2 Answers  


Reverse a string word by word??

9 Answers  


while running a program, i got the msg that press return key to exit.what that mean in C as there are no such options as far i know.

1 Answers   TCS,


pgm to reverse string using arrays i.e god is love becomes love is god) (assumption:only space is used for seperation of words) no addtional memory used.i.e no temporary arrays can used.

4 Answers   Persistent, Valyoo,


What is the use of f in c?

0 Answers  






How will you divide two numbers in a MACRO?

0 Answers   Apps Associates,


Write a program to display all the prime nos from 1 to 1000000, your code should not take time more than a minute to display all the nos.

0 Answers  


What are data types in c language?

0 Answers  


mplementation of stack using any programing language

1 Answers   Marlabs,


What is the significance of an algorithm to C programming?

0 Answers  


Differentiate Source Codes from Object Codes

1 Answers  


What is 02d in c?

0 Answers  


Categories