Mathematical-Reasoning

December 12, 2024

Relational-Algebra

December 13, 2024

Mathematical-Reasoning

December 12, 2024

Relational-Algebra

December 13, 2024

HCU PHD CS MAY 2016

Question 13
What is the output of the following program ?

#include

int main()

{

if(printf (“ABC”)) printf (“True”) ;

else printf(“False”);

return 0;

}

A
Compilation error
B
ABC
C
ABCTrue
D
ABCFalse
Question 13 Explanation: 
Inside the condition of if printf(“ABC”) will return 3 and we know that in if condition anything other than 0 is considered true so it will enter the if loop and will print Tue.Also before that ABC will get printed due to printf(“ABC”). So in total ABCTrue will get printed
Correct Answer: C
Question 13 Explanation: 
Inside the condition of if printf(“ABC”) will return 3 and we know that in if condition anything other than 0 is considered true so it will enter the if loop and will print Tue.Also before that ABC will get printed due to printf(“ABC”). So in total ABCTrue will get printed

Leave a Reply

Your email address will not be published. Required fields are marked *