ThePrismSolutions

ThePrismSolutions

Practice(TEST 1)

1. What is the output of the below c code?

#include<stdio.h>	
main() 
{
   int x = 5;
   
   if(x=5)
   {	
      if(x=5) printf("Fast");
   } 
   printf("learning");
}




2. How would you insert pre-written code into a current program ?

#include<stdio.h>	
main() 
{
   int x = 5;
   
   if(x=5)
   {	
      if(x=5) printf("Fast");
   } 
   printf("learning");
}




3. Predict the output or error(s) for the following ?

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

	




4. Predict the output or error(s) for the following ? ?

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]);
}





5. Predict the output or error(s) for the following ?

#include<stdio.h>	
main()
{
	float me = 1.1;
	double you = 1.1;
	if(me==you)
printf("I love U");
else
		printf("I hate U");
}




6. Predict the output or error(s) for the following ?

#include<stdio.h>	
main()
{
	static int var = 5;
	printf("%d ",var--);
	if(var)
		main();
}




7. Predict the output or error(s) for the following ?

#include<stdio.h>	
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;	  }
}

	




8. Predict the output or error(s) for the following ?

#include<stdio.h> 
main()
{
	extern int i;
	i=20;
printf("%d",i);
}





9. Predict the output or error(s) for the following ?

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);
}

	




10. Predict the output or error(s) for the following ?

#include<stdio.h>	
main()
{
	char *p;
	printf("%d %d ",sizeof(*p),sizeof(p));
}