C - Input and Output


Question 1     

Assuming, integer is 2 byte, What will be the output of the program?

#include
int main()
{
      printf("%x\n", -1>>1);
      return 0;
}





Question 2     

What will be the output of the program ?

#include
int main()
{
        int i=3, *j, k;
        j = &i;
       printf("%d\n", i**j*i+*j);
       return 0;
}





Question 3     

What will be the output of the program?

#include
int main()
{
          int i=0;
          for(; i<=5; i++);
          printf("%d", i);
         return 0;
}





Question 4     

What will be the output of the following program

void main( ){
int a=10;
printf("%d",a);
{
int a=20;
printf("%d",a);
}
printf("%d",a);
}





Question 5     

what is the output of following program?

void main(){
printf("%d%d",47%5,47%-5);
printf("%d%d%d",-47%5,-47%-5,5%7);
}





Question 6     

How many times the while loop will get executed?main ( )
{
int a = 1 ;
while ( a <= 100) ;
{
 printf ( â??%dâ??, a++ ) ;
 }
}

main ( )
{
int a = 1 ;
while ( a <= 100) ;
{
 printf ( â??%dâ??, a++ ) ;
 }
}





Question 7     

What is the output of following program?

void f1(){
static int s=5;
++s;
printf("%d",s);
}
main(){
f1();
f1();
printf("%d",s);
}





Question 8     

The following code fragment

#include<stdio.h>
int main(){
int a,x,y,z=3;
x = (z*=2) + ( y = a = z);
printf(“%d”,x);
return 0;
}





Question 9     

Find the fragment to the following code

#include<stdio.h>
int main(){
	int p=-3;
	printf(“%d”,0<!!p);
	return 0;
}





Question 10     

Find the output of the following code

#include<stdio.h>
int main(){
	int p=107,k=10;
	printf((k>15)? “%d” : “%c”),p);
	return 0;
}





Sign Up Page

Oops!!

To view the solution need to Login



Score : 0 / 0
L
o
a
d
i
n
g
.
.
.