Home |
Write |
179 members |
USA


Join with Aptibook
http://www.aptibook.com
C Programming problems and solutions
Note: Objective type question pattern is used here.
Out of four choices, you are requested to select the best possible answer(s).

1. Find the output :


void main()
{
	int  const *p=5;
	printf("%d",++(*p));
}


2. Find the output :

main()
{
	char s[ ]="man";
	int i;
	for(i=0;s[ i ];i++)
	printf("\n%c%c%c%c",s[ i ],*(s+i),*(i+s),i[s]);
}


3. Find the output :

main()
{
	float me = 1.1;
	double you = 1.1;
	if(me==you)
printf("I love U");
else
		printf("I hate U");
}


4. Find the output :

main()
	{
	static int var = 5;
	printf("%d ",var--);
	if(var)
		main();
	}


5. Find the output :

main()
{
	 int c[ ]={2.8,3.4,4,6.7,5};
	 int j,*p=c,*q=c;
	 for(j=0;j<5;j++) {
		printf(" %d ",*c);
	   	++q;	  
		}

	 for(j=0;j<5;j++){
		printf(" %d ",*p);
		++p;	  
		}
}


6. Find the output :

main()
{
	extern int i;
	i=20;
	printf("%d",i);
}


7. Find the output :

main()
{
	int i=-1,j=-1,k=0,l=2,m;
	m=i++&&j++&&k++||l++;
	printf("%d %d %d %d %d",i,j,k,l,m);
}


8. Find the output :

main()
{
	char *p;
	printf("%d %d ",sizeof(*p),sizeof(p));
}


9. Find the output :

main()
{
	int i=3;
	switch(i)
	 {
	    default:printf("zero");
	    case 1: printf("one");
		   break;
	   case 2:printf("two");
		  break;
	  case 3: printf("three");
		  break;
	  }  
}


10. Find the output :

main()
{
	  printf("%x",-1<<4);
}