64. Predict the output or error(s) of the following c code

Monday, September 5th, 2011  »  Posted By  »  Total 1 Comment
1
2
3
4
5
6
7
8
9
10
11
#define FALSE -1
#define TRUE   1
#define NULL   0
main() {
	if(NULL)
	puts("NULL");
	else if(FALSE)
		puts("TRUE");
	else
		puts("FALSE");
}

63. Predict the output or error(s) of the following c code

Monday, September 5th, 2011  »  Posted By  »  Total 0 Comment
1
2
3
4
5
6
 main()
{
	char not;
	not=!2;
	printf("%d",not);
}

62. Predict the output or error(s) of the following c code

Monday, September 5th, 2011  »  Posted By  »  Total 0 Comment
1
2
3
4
5
6
 main()
{
	char *str1="abcd";
	char str2[]="abcd";
	printf("%d %d %d",sizeof(str1),sizeof(str2),sizeof("abcd"));
}

61. Predict the output or error(s) of the following c code

Monday, September 5th, 2011  »  Posted By  »  Total 1 Comment
1
2
3
4
5
6
7
8
 main()
{
	char *cptr,c;
	void *vptr,v;
	c=10;  v=0;
	cptr=&c; vptr=&v;
	printf("%c%v",c,v);
}

60. Predict the output or error(s) of the following c code

Monday, September 5th, 2011  »  Posted By  »  Total 0 Comment
1
2
3
4
 main()
{
	main();
}

59. What is the problem with the following code segment?

Monday, September 5th, 2011  »  Posted By  »  Total 0 Comment
1
while ((fgets(receiving array,50,file_ptr)) != EOF);

58. How scanf will execute?

Monday, September 5th, 2011  »  Posted By  »  Total 0 Comment
1
2
3
4
5
 main()
{
	char name[10],s[12];
	scanf(" \"%[^\"]\"",s);
}

55. Predict the output or error(s) of the following c code

Monday, September 5th, 2011  »  Posted By  »  Total 0 Comment
1
2
3
4
5
6
 main()
{
	int i=-1;
	+i;
	printf("i = %d, +i = %d \n",i,+i);
}

54. Predict the output or error(s) of the following c code

Monday, September 5th, 2011  »  Posted By  »  Total 0 Comment
1
2
3
4
5
6
	int i,j;
	for(i=0;i<=10;i++)
	{
		j+=5;
		assert(i<5);
	}

53. Predict the output or error(s) of the following c code

Monday, September 5th, 2011  »  Posted By  »  Total 0 Comment
1
2
3
4
5
6
7
8
9
10
11
12
 main()
{
	int  i, n;
	char *x = “girl”;
	n = strlen(x);
	*x = x[n];
	for(i=0; i<n; ++i)
	{
		printf(%s\n”,x);
		x++;
	}
}
Question and Answer
C/C++ Unix & Linux Wordpress
Source codes
C C++ Java

Free email signup

Email: