Live Class on Data Type in C Programming MCQ's by Prateek Jain
Live Class for GATE/NET Data Type in C Programming MCQ's by Prateek Jain Your Doubts will be discussed here. Q1: What is the output of this C code (on a 32-bit machine)? 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; } Q2: What is the output of the following C code(on a 64 bit machine)? union Sti { int nu; char m; }; int main() { union Sti s; printf("%d", sizeof(s)); return 0; } Q3: What is the output of this C code? int main() { float x = 'a'; printf("%f", x); return 0; } Q4: For union union temp { char a; int b; float c; }; The size is decided by: Q5: What is the output of this C code? int main() { float a = 5.477777777777; printf("%f", a); } Q6: Which of the following % operation is invalid? A. 4 % 8;B. 4 % 8l;C. 4 % 8f;D. Both (b) and (c) Q7: What is the output of this C code? void main() { int x = 97; char y = x; printf("%c\n", y); } Q8: What is the output of this C code? int main() { unsigned int i = 23; signed char c = -23; if (i c) printf("Yes\n"); else if (i c) printf("No\n"); } Q9: What is the output of this C code? int main() { int i = 23; char c = -23; if (i c) printf("Yes\n"); else printf("No\n"); } Q 10: What is the output of the below code considering size of short int is 2, char is 1 and int is 4 bytes? int main() { short int i = 20; char c = 97; printf("%d, %d, %d\n", sizeof(i), sizeof(c), sizeof(c + i)); return 0; } Q 11: Which type conversion is NOT accepted? A. From char to int B. From float to char pointer C. From negative int to char D. From double to char Q 12: What will be the data type of the result of the following operation? (float)a * (int)b / (long)c * (double)d A. int B. long C. float D. double
Download
0 formatsNo download links available.