#include<conio.h>

main()

{

int x,y=2,z,a;

if(x=y%2) z=2;

a=2;

printf("%d %d ",z,x);

}



#include<conio.h> main() { int x,y=2,z,a; if(x=y%2) z=2; a=2; printf(&qu..

Answer / susie

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.

Thumb Rule: Check all control paths to write bug free
code.

Is This Answer Correct ?    5 Yes 1 No

Post New Answer

More C Code Interview Questions

char *someFun() { char *temp = “string constant"; return temp; } int main() { puts(someFun()); }

1 Answers  


plz send me all data structure related programs

2 Answers  


WAP to display 1,2,3,4,5........N

2 Answers  


Write a C program to print ‘Campus Force training’ without using even a single semicolon in the program.

3 Answers   Wipro,


Set up procedure for generating a wire frame display of a polyhedron with the hidden edges of the object drawn with dashed lines

0 Answers   IBM,






main(){ char a[100]; a[0]='a';a[1]]='b';a[2]='c';a[4]='d'; abc(a); } abc(char a[]){ a++; printf("%c",*a); a++; printf("%c",*a); }

2 Answers  


Which one is taking more time and why ? :/home/amaresh/Testing# cat time.c //#include <stdio.h> #define EOF -1 int main() { register int c; while ((c = getchar()) != EOF) { putchar(c); } return 0; } ------------------- WIth stdio.h:- :/home/amaresh/Testing# time ./time_header hi hi hru? hru? real 0 m4.202s user 0 m0.000s sys 0 m0.004s ------------------ Witout stdio.h and with #define EOF -1 =================== /home/amaresh/Testing# time ./time_EOF hi hi hru? hru? real 0 m4.805s user 0 m0.004s sys 0 m0.004s -- From above two case , why 2nd case is taking more time ?

0 Answers  


can u give me the c codings for converting a string into the hexa decimal form......

1 Answers  


write a c-program to display the time using FOR loop

3 Answers   HCL,


print a semicolon using Cprogram without using a semicolon any where in the C code in ur program!!

35 Answers   Tata Elxsi, TCS, VI eTrans,


#include<conio.h> main() { int x,y=2,z,a; if(x=y%2) z=2; a=2; printf("%d %d ",z,x); }

1 Answers  


Write out a function that prints out all the permutations of a string. For example, abc would give you abc, acb, bac, bca, cab, cba. You can assume that all the characters will be unique.

5 Answers   IITR, Microsoft, Nike,


Categories