Welcome Guest | Sign in | Register
Preprocessor Directives - Discussion Page For Q.10600 | C Programming Questions and Answers | C Programming Free Online-Tests | LucentBlackBoard | LucentBlackBoard.com

Home > Java Programming > Preprocessor Directives > Questions and Answers

Exercise:

Section 1

Q: What is the output of following C code?

#define FALSE -1
#define TRUE 1
#define NULL 0
main() {
if(NULL)
puts("NULL");
else if(FALSE)
puts("TRUE");
else
puts("FALSE");
}
A. Error B. NULL
C. FALSE D. TRUE

Answer and Explanation

Answer:TRUE

Explanation:
Preprocessor doesn't replace the values given inside the double quotes. The check by if condition is boolean value false so it goes to else. In second if -1 is Boolean value true hence "TRUE" is printed.

Comment on this Question

Name:

Loading...




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