Welcome Guest | Sign in | Register
Defining Variables - Discussion Page For Q.10595 | C Programming Questions and Answers | C Programming Free Online-Tests | LucentBlackBoard | LucentBlackBoard.com

Home > Java Programming > Defining Variables > Questions and Answers

Q: What will be the output of the following C code?
main()
{
int x,y=2,z,a;
if(x=y%2) z=2;
a=2;
printf("%d %d ",z,x);
}
A. 2 B. Garbage-value 0
C. 0 D. 1

Answer and Explanation

Answer:Garbage-value 0

Explanation:
The value of y%2 is 0. This value is assigned to x. The condition reduces to if (x) or in other words if(0) and so z goes uninitialized.

Comment on this Question

Name:

Loading...




Partner Sites
LucentBlackBoard.com                  SoftLucent.com                  LucentJobs.com
All rights reserved © 2012-2015 SoftLucent.