Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
25 views5 pages

C-Data Types Interview Question

The document contains a series of C programming code snippets, each followed by a question about their expected output. It covers various data types, comparisons, and potential issues in C programming, such as type casting and variable shadowing. Additionally, it includes a question about the relationship between char, int, and double data types.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views5 pages

C-Data Types Interview Question

The document contains a series of C programming code snippets, each followed by a question about their expected output. It covers various data types, comparisons, and potential issues in C programming, such as type casting and variable shadowing. Additionally, it includes a question about the relationship between char, int, and double data types.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Data types Interview Question

Program1
#include <stdio.h>
int main() {
// Write C code here
int a[5] = {1, 2, 3, 4, 5};
int i;
for (i = 0; i < 5; i++)
if ((char)a[i] == '5')
printf("%d\n", a[i]);
else
printf("FAIL\n");

return 0;
}
Ouput ?

Program 2
int main() {
// Write C code here
signed char chr;
chr = 128;
printf("%d\n", chr);
return 0;
}

Output ?

Program 3
#include <stdio.h>
int main()
{
float f1 = 0.1;
if (f1 == 0.1)
printf("equal\n");
else
printf("not equal\n");

return 0;
}

Output ?

Program 4
#include <stdio.h>
int main()
{
float f1 = 0.1;
if (f1 == 0.1f)
printf("equal\n");
else
printf("not equal\n");

return 0;
}

Output ?

Program 5
#include <stdio.h>
int main()
{
float f1 = 0.1;
if (f1 == 0.1f)
printf("equal\n");
else
printf("not equal\n");
return 0;
}

Output ?

Program 5
int main()
{
int x = 10000;
double y = 56;
int *p = &x;
double *q = &y;
printf("p and q are %d and %d", sizeof(p), sizeof(q));
return 0;
}
Output ?

Program 6
int main()
{
float x = 'a';
printf("%f", x);
return 0;
}
Output ?

Program 7
#include <stdio.h>
int main()
{
int y = 10000;
int y = 34;
printf("Hello World! %d\n", y);
return 0;
}
Output?

Program 8
#include <stdio.h>
int main()
{
int main = 3;
printf("%d", main);
return 0;
}
Output ?

Program 9
#include <stdio.h>
int main()
{
float x;
int y;
printf("enter two numbers \n");
scanf("%f %f", &x, &y);
printf("%f, %d", x, y);
return 0;
}

Output ?

Program 10
#include <stdio.h>
int main()
{
short int i = 20;
char c = 97;
printf("%d, %d, %d\n", sizeof(i), sizeof(c), sizeof(c + i));
return 0;
}

Output ?

Program 11
#include <stdio.h>
int main()
{
printf(“%10s”, state);

return 0;
}
Output ?

Q12. char < int < double What it denotes?

You might also like