The ones who are crazy enough to think they can change the world are the ones who do.- Steve Jobs
In most of the MNC interview questions such as in ZOHO interview question, IVTL Infoview interview questions, Amazon interview questions, GOOGLE interview questions, Infosys interview questions and even in Voonik interview questions, We come across several Tricky C Questions about which 2:5 of the questions are from data types in c. Solving that kind of tricky C questions is not an easy task for all C programmers. We need more practices to solve it with ease. So we provide 25+ interesting C questions in data types to make your MNC interview very easy.
16. What will be the output of the C program ?
#include<stdio.h> int main() { char num = 127; num = num + 1; printf("%d", num); return 0; }
Option: D
Though a char is of ranging from -128 to 127. Whatever a integer number we are adding, it will loop through out its range. Thus after 127 the number is -128.
17. What will be the output of the C program ?
#include<stdio.h> int main() { extern int num; printf("%d", num); return 0; } int num = 10;
Option: A
extern is a keyword which can link to the variable declared even out of the program.
18. What will be the output of the C program?
#include<stdio.h> int main() { int size = sizeof(volatile) + sizeof(const); printf("%d",++size); return 0; }
Option: D
Volatile and const are C Keywords and their individual size is 4 bytes
19. What will be the output of the C program?
#include<stdio.h> int main() { static int num = 6; printf("%d ",num--); if(num) main(); return 0; }
Option: B
Simply, function is looping again and again till num becomes 0 to exit the if condition.
20. What will be the output of the C program ?
#include<stdio.h> int main() { if (sizeof(char) > -12) printf("yes"); else printf("No"); return 0; }
Option: C
By default, all integer literals such as
-12
-56
23
are assigned as unsigned integer by C compiler. So if negative integers are given it will loop through its range 0 to 65,535. i.e) -12 is equal to 65524.
We may make mistakes(spelling, program bug, typing mistake and etc.), So we have this container to collect mistakes. We highly respect your findings.
© Copyright 2019