1. What will be the output of the program given below? #include int main() { enum status { pass, fail, atkt}; enum status stud1, stud2, stud3; stud1 = pass; stud2 = atkt; stud3 = fail; printf("%d, %d, %d", stud1, stud2, stud3); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option C
Explanation:
Available Soon.
|
2. What will be the output of the program in Turbo C (in DOS 16-bit OS)? #include int main() { char *s1; char far *s2; char huge *s3; printf("%d, %d, %d", sizeof(s1), sizeof(s2), sizeof(s3)); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option C
Explanation:
Available Soon.
|
3. What will be the output of the program? #include int main() { struct emp { char name[20]; int age; float sal; }; struct emp e = {"Tiger"}; printf("%d, %f", e.age, e.sal); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option A
Explanation:
Available Soon.
|
4. What will be the output of the following program? #include int X=40; int main() { int X=20; printf("%d", X); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option A
Explanation:
Available Soon.
|
5. What will be the output of the program? #include int main() { int x = 10, y = 20, z = 5, i; i = x < y < z; printf("%d", i); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option B
Explanation:
Available Soon.
|
6. What will be the output of the following program? #include int main() { int a[5] = {2, 3}; printf("%d, %d, %d", a[2], a[3], a[4]); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option D
Explanation:
Available Soon.
|
7. What will be the output of the following program? #include int main() { union a { int i; char ch[2]; }; union a u; u.ch[0] = 3; u.ch[1] = 2; printf("%d, %d, %d", u.ch[0], u.ch[1], u.i); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option A
Explanation:
Available Soon.
|
8. In the following program how long will the for loop get executed? #include int main() { int i=5; for(;scanf("%s", &i); printf("%d", i)); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option D
Explanation:
Available Soon.
|
9. What will be the output of the following program? #include int main() { int X=40; { int X=20; printf("%d", X); } printf("%d", X); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option B
Explanation:
Available Soon.
|
10. Point out the error in the following program #include int main() { void v = 0; printf("%d", v); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option A
Explanation:
Available Soon.
|
11. Point out the error in the following program #include struct emp { char name[20]; int age; }; int main() { emp int xx; int a; printf("%d", &a); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option B
Explanation:
Available Soon.
|
12. Which of the following is correct about err used in the declaration given below? typedef enum error { warning, test, exception } err; |
||||||||
Free MCQs www.sharemcq.com
Answer: Option A
Explanation:
Available Soon.
|
13. Point out the error in the following program #include int main() { int (*p)() = fun; (*p)(); return 0; } int fun() { printf("Microsoft.com"); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option B
Explanation:
Available Soon.
|
14. Which of the following declaration is correct? | ||||||||
Free MCQs www.sharemcq.com
Answer: Option A
Explanation:
Available Soon.
|
15. Which of the following operations are INCORRECT? | ||||||||
Free MCQs www.sharemcq.com
Answer: Option D
Explanation:
Available Soon.
|
16. Which of the following correctly represents a long double constant? | ||||||||
Free MCQs www.sharemcq.com
Answer: Option B
Explanation:
Available Soon.
|
17. What are the different types of real data type in C Language? | ||||||||
Free MCQs www.sharemcq.com
Answer: Option C
Explanation:
Available Soon.
|
18. What will you do to treat the constant 3.14 as a long double? | ||||||||
Free MCQs www.sharemcq.com
Answer: Option B
Explanation:
Available Soon.
|
19. Which statement will you add in the following program to work it correctly? #include int main() { printf("%f", log(36.0)); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option B
Explanation:
Available Soon.
|
20. What will be the output of the following program? #include int main() { float a=0.7; if(a < 0.7) printf("C"); else printf("C++"); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option A
Explanation:
Available Soon.
|
21. What will be the output of the following program? #include int main() { float fval=7.29; printf("%d", (int)fval); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option D
Explanation:
Available Soon.
|
22. What will be the output of the following program? #include #include int main() { printf("%f", sqrt(36.0)); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option C
Explanation:
Available Soon.
|
23. What will be the output of the following program? #include #include int main() { printf("%d, %d, %d", sizeof(3.14f), sizeof(3.14), sizeof(3.14l)); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option C
Explanation:
Available Soon.
|
24. What will be the output of the following program? #include int main() { float a=0.7; if(a < 0.7f) printf("C"); else printf("C++"); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option B
Explanation:
Available Soon.
|
25. What will be the output of the following program? #include #include int main() { float n=1.54; printf("%f, %f", ceil(n), floor(n)); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option A
Explanation:
Available Soon.
|
26. What will be the output of the following program? #include int main() { static char *s[] = {"black", "white", "pink", "violet"}; char **ptr[] = {s+3, s+2, s+1, s}, ***p; p = ptr; ++p; printf("%s", **p+1); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option A
Explanation:
Available Soon.
|
27. What will be the output of the following program? #include int main() { int i=3, *j, k; j = &i; printf("%d", i**j*i+*j); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option A
Explanation:
Available Soon.
|
28. What will be the output of the following program? #include int main() { int x=30, *y, *z; y=&x; /* Assume address of x is 500 and integer is 4 byte size */ z=y; *y++=*z++; x++; printf("x=%d, y=%d, z=%d", x, y, z); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option D
Explanation:
Available Soon.
|
29. What will be the output of the following program? #include int main() { char str[20] = "Hello"; char *const p=str; *p='M'; printf("%s", str); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option A
Explanation:
Available Soon.
|
30. What will be the output of the following program if the integer is 4 bytes long? #include int main() { int ***r, **q, *p, i=8; p = &i; q = &p; r = &q; printf("%d, %d, %d", *p, **q, ***r); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option A
Explanation:
Available Soon.
|
31. What will be the output of the following program? #include int main() { char *str; str = "%s"; printf(str, "K"); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option C
Explanation:
Available Soon.
|
32. What will be the output of the following program if the size of pointer is 4-bytes? #include int main() { printf("%d, %d", sizeof(NULL), sizeof("")); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option C
Explanation:
Available Soon.
|
33. What will be the output of the following program? #include int main() { int arr[2][2][2] = {10, 2, 3, 4, 5, 6, 7, 8}; int *p, *q; p = &arr[1][1][1]; q = (int*) arr; printf("%d, %d", *p, *q); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option A
Explanation:
Available Soon.
|
34. What will be the output of the following program? #include int main() { int arr[3] = {2, 3, 4}; char *p; p = arr; p = (char*)((int*)(p)); printf("%d, ", *p); p = (int*)(p+1); printf("%d", *p); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option B
Explanation:
Available Soon.
|
35. What will be the output of the following program? #include int main() { char *str; str = "%d"; str++; str++; printf(str-2, 300); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option D
Explanation:
Available Soon.
|
36. What will be the output of the following program? #include int main() { char str[] = "peace"; char *s = str; printf("%s", s++ +3); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option D
Explanation:
Available Soon.
|
37. What will be the output of the following program? #include int main() { char *p; p="hello"; printf("%s", *&*&p); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option B
Explanation:
Available Soon.
|
38. If the size of integer is 4bytes, what will be the output of the following program? #include int main() { int arr[] = {12, 13, 14, 15, 16}; printf("%d, %d, %d", sizeof(arr), sizeof(*arr), sizeof(arr[0])); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option B
Explanation:
Available Soon.
|
39. Point out the compile time error in the program given below. #include int main() { int *x; *x=100; return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option C
Explanation:
Available Soon.
|
40. Point out the error in the program given below. #include int main() { int a[] = {10, 20, 30, 40, 50}; int j; for(j=0; j<5; j++) { printf("%d", a); a++; } return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option C
Explanation:
Available Soon.
|
41. Which of the statements is correct about the program given below? #include int main() { int i=10; int *j=&i; return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option C
Explanation:
Available Soon.
|
42. Which of the statements is correct about the program? #include int main() { int arr[3][3] = {1, 2, 3, 4}; printf("%d", *(*(*(arr)))); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option D
Explanation:
Available Soon.
|
43. How will you free the allocated memory? | ||||||||
Free MCQs www.sharemcq.com
Answer: Option B
Explanation:
Available Soon.
|
44. What is the similarity between a structure, union and enumeration? | ||||||||
Free MCQs www.sharemcq.com
Answer: Option B
Explanation:
Available Soon.
|
45. What will be the output of the following program? #include int main() { enum days {MON=-1, TUE, WED=6, THU, FRI, SAT}; printf("%d, %d, %d, %d, %d, %d", MON, TUE, WED, THU, FRI, SAT); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option D
Explanation:
Available Soon.
|
46. What will be the output of the following program? #include int main() { int i=4, j=8; printf("%d, %d, %d", i|j&j|i, i|j&j|i, i^j); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option A
Explanation:
Available Soon.
|
47. Which of the following statements correct about the below code? maruti.engine.bolts=25; |
||||||||
Free MCQs www.sharemcq.com
Answer: Option B
Explanation:
Available Soon.
|
48. What will be the output of the program (16-bit platform)? #include #include int main() { int *p; p = (int *)malloc(20); printf("%d", sizeof(p)); free(p); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option B
Explanation:
Available Soon.
|
No comments:
Post a Comment
Your Feedback is hearty Requested to make the MCQs Collection better.