What is the output of the program? int n=f,m; n==m++; m==++n; printf(n, m);

This question is related to Wipro Interview

Showing Answers 1 - 42 of 42 Answers

devansh

  • Aug 12th, 2005
 

ans(f,f)

  Was this answer useful?  Yes

HAI

  • Aug 28th, 2005
 

M,F+1

  Was this answer useful?  Yes

raj

  • Sep 4th, 2005
 

m,m+1

  Was this answer useful?  Yes

Srinivas

  • Dec 6th, 2005
 

I don't think the compiler would compile this without errors. What is f and what value would m take? that is just random.

And n==m++ is not assignment too. Its just logical comparison.

Please correct me if i am wrong.

Thanks

  Was this answer useful?  Yes

gourav

  • Dec 24th, 2005
 

hi,

    n==m++ is not an assingment,but it is a logical comparision.

    int n=f,m;

   int n==m++; // in this statement m is incremented to m+1//

   int m==++n; //  in this statement n is incremented to f+1//

  print(n,m);

ans: (f+1,m+1)

  Was this answer useful?  Yes

sachin

  • Dec 26th, 2005
 

Hi,

Here f should ' f ' o/w compiler will give error as it will be considered as a variable........ it will assign the ASCII value of 'f ' to n i.e. 102 ......... then the values of m and n will be incremented by 1 so the output should be ................  103  1

  Was this answer useful?  Yes

ANISH

  • Feb 14th, 2006
 

n=m++.......so the ascii value of m will increment and it will become n so now n=nnext step is m=++n. similarly here ascii value of n will increment .soans is m=om=o n=n

  Was this answer useful?  Yes

teju

  • Mar 7th, 2006
 

i guess there are many problems in the question above first that f is not declared b4 and is directly assigned to n

and nxt the printf statement is given as print so we may come acrooss these two prob and hence this may not work

Shyamsundar

  • Jun 7th, 2006
 

the progrm will not run bcoz compilation error occurs @ undefined symbl 'f'.

purani

  • Jun 18th, 2006
 

first of all we cannot assign two value to the same variable as given n=f,m

the error occurs there itself so it results in compilation error

  Was this answer useful?  Yes

urmila

  • Jun 24th, 2006
 

as both n,m are not assigned,i think n would be assigned to the ascii value of f and m to be zero.am i right??

  Was this answer useful?  Yes

ravi kiran

  • Jun 27th, 2006
 

Hi friends i think it rises an error because it does not know the values f, m. so we get error undefined symbols f, m;


Ravi kiran

  Was this answer useful?  Yes

gopi

  • Jul 20th, 2006
 

no o/p, only errors and warnings..

f needs to be declared in order to assign it and parameters do not match with the prototype of printf.. bla bla

  Was this answer useful?  Yes

rajesh

  • Aug 21st, 2006
 

the above question shows an error here f is not declared.(==)code has noeffect to execute.the printfstatement is not displayed.it has no prototype.

  Was this answer useful?  Yes

Benazir

  • Sep 26th, 2006
 

Hello..I feel the answer is that this will not work.
f is undefined.
printf statement should be rectified.
c ya.

  Was this answer useful?  Yes

Nitesh sharma

  • Aug 29th, 2011
 

Error.

  Was this answer useful?  Yes

Dhiraj singh

  • Oct 7th, 2011
 

n=f

n==m++
n==m+1

m==++n
m==1+n
m==1+m+1
m==2+m

output is " m+1 and m+2 "

  Was this answer useful?  Yes

Gopal27

  • Jan 28th, 2012
 

Error bcoz there is no initilization of numeric value.

  Was this answer useful?  Yes

mathankumar

  • Feb 1st, 2012
 

"n=m
m=1+n"

Code
  1. "n=m

  2. m=1+n"

  Was this answer useful?  Yes

K.Ravi kumar

  • May 13th, 2015
 

1,1

  Was this answer useful?  Yes

K.Ravi Kumar

  • May 13th, 2015
 

answer is:(1,1)
bcoz there they r used the relational operator
there they used two conditions if the conditions is true then it print 1 else 0.

  Was this answer useful?  Yes

ASCII value of f is 102 its assign to n,
n==m++ takes m default value/or random value depend on type of m ether its global or local. this instruction only dong comparison between n and m value then update m value, so its only given true or false value.
next instruction m==++n, its increment n value as 103 and compare with m, again its give Boolean value.
last instruction only print statement its print n and m value

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions