C Technical Test – 7 | C Language Online Test

This “C Technical Test” page providing a set of technical and objective type questions used to test your C programming and logical skills.


1. What is output of following program?
#include<stdio.h>
void main()
{
int a=10,c=20;
long f;
c = sizeof(a+f);
printf(“%d”,c);
}

 
 
 
 

2. What is the Output of following Code?
#include<stdio.h>
int main()
{
int x ;
x = (10,20,30), 40;
printf(“%d”,x);
return 0;
}

 
 
 
 

3. What is the Output of following Code?
#include<stdio.h>
main()
{
int x;
x = 4%5 + 6%5;
printf (“x = %d”,x);
}

 
 
 
 

4. What will be the output of following code?
#include<stdio.h>
main()
{
int i=6;
switch(i)
{
default : i+=2;
case 0 : i=2;
case 1 : i++;
case 2 : i+3;
case 3 : ++i;
break;
}
printf(“i : %d\n”,i);
}

 
 
 
 

5. Find the output of following program
#include<stdio.h>
void fun(int, int);
void main()
{
int i=3;
fun(–i , i++);
fun(++i , i–);
printf(“%d\n”,i++);
}
void fun(int i, int j)
{
printf(“%d\n”,i++);
printf(“%d\n”,j–);
}

 
 
 
 

6. Why array instead of a primitive variable?

 
 
 
 
 

7. What is the output of following C program?
#include<stdio.h>
int main()
{
short num[3][2]={3,6,9,12,15,18};
printf(“%d %d”,*(num+1)[1],**(num+2));
return 0;
}

 
 
 
 

8. What is the Output of following Code?
#include<stdio.h>
union un
{
short s;
char c[2];
};
void main()
{
union un var ;
var.c[0]=2;
var.c[1]=3;
printf(“s val : %d\n”, var.s);
}

 
 
 
 

9. What is the output of this C code?
#include <stdio.h>
void main()
{
char *s= “hello”;
char *p = s;
printf(“%c\t%c”, *(p + 3), s[1]);
}

 
 
 
 

10. What is the functionality to rewind() function?

 
 
 
 

Question 1 of 10

 

 

Share this