Monday, April 29, 2019

C Language - Skill Test - Part 1 - Techgig

C Language Skill Test Questions of Techgig can be seen here:

1) The output of
#include <stdio.h> 
int main(void) {
int a[5] = {51,1,5,20,25};
int x,y,z;
x = ++a[1];
y = a[1]++;
z = a[x++];
printf("%d %d %d\n",x,y,z);
return 0;
}
is 3 2 5
2) The output of
#include <stdio.h>
int main(void) {
int x =1, y=12, z =123;
z *= x *= y;
printf("%d %d %d\n",x,y,z);
return 0;
}
is 12 12 1476
3) The output of
#include <stdio.h>
#include<ctype.h>
int main(void) {
char c ='t';
printf("%c\n",tolower('A'));
return 0;
}
is a
4) The output of
#include <stdio.h>
int main(void) {
int x,m,n;
m = 10;
n= 15;
x= ++m + n++;
printf("%d %d %d\n",x,m,n);
return 0;
}
is 26 11 16
5) The output of
#include <stdio.h>
void printer(int n)
{
if (n==0)
return;
printer(n-1);
printf("%d\n",n);
}
int main(void) {
printer(10);
return 0;
}
is  Prints 1-10
6) The output of
#include <stdio.h>
int main(void) {
static int x;
if(x++<2)
main();
return 0;
}
 is main() is called twice
7) The output of
#include <stdio.h>
int f(int n)
{
if(n = 4)
return n;
return f(--n);
}
int main(void) { 
printf("%d\n",f(7)); 
return 0;
}
is 4
8) The output of
#include <stdio.h>
#include<ctype.h>
int main(void) {
int i= 0;
if(isspace(i))
printf("Space");
else
printf("Not Space");
return 0;
}
is Not Space
9) The output of 
#include <stdio.h>
#include<ctype.h>
int main(void) {
int b[]={0,20,0,40,5};
int i,*k;
k=b;
for(i=0;i<=4;i++) 
{ 
printf("%d ",*k); 
k++;
}
return 0;
}
is 0 20 0 40 5
10) The output of
#include <stdio.h>
#include<ctype.h>
int main(void) {
printf("%X%x%ci%x",11,10,'s',12);
return 0;
}
is Basic

No comments:

Post a Comment