1. What will be the output of the following program? #include int main() { int i=0; for(; i<=5; i++); printf("%d", i); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option D
Explanation:
Available Soon.
|
2. What will be the output of the following program? #include int main() { char str[]="C-program"; int a = 5; printf(a >10?"Ps":"%s", str); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option A
Explanation:
Available Soon.
|
3. What will be the output of the following program? #include int main() { int a = 500, b = 100, c; if(!a >= 400) b = 300; c = 200; printf("b = %d c = %d", b, c); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option D
Explanation:
Available Soon.
|
4. What will be the output of the following program? #include int main() { unsigned int i = 65535; /* Assume 2 byte integer*/ while(i++ != 0) printf("%d",++i); printf(""); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option A
Explanation:
Available Soon.
|
5. What will be the output of the following program? #include int main() { int x = 3; float y = 3.0; if(x == y) printf("x and y are equal"); else printf("x and y are not equal"); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option A
Explanation:
Available Soon.
|
6. What will be the output of the following program? #include int main() { int k, num = 30; k = (num < 10) ? 100 : 200; printf("%d", num); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option B
Explanation:
Available Soon.
|
7. What will be the output of the following program? #include int main() { int a = 300, b, c; if(a >= 400) b = 300; c = 200; printf("%d, %d, %d", a, b, c); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option C
Explanation:
Available Soon.
|
8. What will be the output of the following program? #include int main() { int x = 10, y = 20; if(!(!x) && x) printf("x = %d", x); else printf("y = %d", y); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option C
Explanation:
Available Soon.
|
9. What will be the output of the following program? #include int main() { char j=1; while(j < 5) { printf("%d, ", j); j = j+1; } printf(""); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option D
Explanation:
Available Soon.
|
10. What will be the output of the following program? #include int main() { int x, y, z; x=y=z=1; z = ++x || ++y && ++z; printf("x=%d, y=%d, z=%d", x, y, z); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option A
Explanation:
Available Soon.
|
11. What will be the output of the following program? #include int main() { int a[5] = {5, 1, 15, 20, 25}; int i, j, m; i = ++a[1]; j = a[1]++; m = a[i++]; printf("%d, %d, %d", i, j, m); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option C
Explanation:
Available Soon.
|
12. What will be the output of the program if the array begins at 65472 and each integer occupies 2 bytes? #include int main() { int a[3][4] = {1, 2, 3, 4, 4, 3, 2, 1, 7, 8, 9, 0}; printf("%u, %u", a+1, &a+1); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option B
Explanation:
Available Soon.
|
13. What will be the output of the program in Turb C (under DOS)? #include int main() { int arr[5], i=0; while(i<5) arr[i]=++i; for(i=0; i<5; i++) printf("%d, ", arr[i]); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option B
Explanation:
Available Soon.
|
14. What will be the output of the following program? #include int main() { int arr[1]={10}; printf("%d", 0[arr]); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option B
Explanation:
Available Soon.
|
15. What will be the output of the program if the array begins at address 65486? #include int main() { int arr[] = {12, 14, 15, 23, 45}; printf("%u, %u", arr, &arr); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option B
Explanation:
Available Soon.
|
16. What will be the output of the program if the array begins 1200 in memory? #include int main() { int arr[]={2, 3, 4, 1, 6}; printf("%u, %u, %u", arr, &arr[0], &arr); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option B
Explanation:
Available Soon.
|
17. Which of the following statements are correct about the program below? #include int main() { int size, i; scanf("%d", &size); int arr[size]; for(i=1; i<=size; i++) { scanf("%d", arr[i]); printf("%d", arr[i]); } return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option C
Explanation:
Available Soon.
|
18. In a file contains the line "I am a boy\\r\\n" then on reading this line into the array str using fgets(). What will str contain? | ||||||||
Free MCQs www.sharemcq.com
Answer: Option C
Explanation:
Available Soon.
|
19. What is the purpose of "rb" in fopen() function used below in the code? FILE *fp; fp = fopen("source.txt", "rb"); |
||||||||
Free MCQs www.sharemcq.com
Answer: Option A
Explanation:
Available Soon.
|
20. What does fp point to in the program? #include int main() { FILE *fp; fp=fopen("trial", "r"); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option B
Explanation:
Available Soon.
|
21. Which of the following operations can be performed on the file "NOTES.TXT" using the below code? FILE *fp; fp = fopen("NOTES.TXT", "r+"); |
||||||||
Free MCQs www.sharemcq.com
Answer: Option D
Explanation:
Available Soon.
|
22. To print out a and b given below, which of the following printf() statement will you use? #include float a=3.14; double b=3.14; |
||||||||
Free MCQs www.sharemcq.com
Answer: Option A
Explanation:
Available Soon.
|
23. Which files will get closed through the fclose() in the following program? #include int main() { FILE *fs, *ft, *fp; fp = fopen("A.C", "r"); fs = fopen("B.C", "r"); ft = fopen("C.C", "r"); fclose(fp, fs, ft); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option D
Explanation:
Available Soon.
|
24. Consider the following program and what will be content of t? #include int main() { FILE *fp; int t; fp = fopen("DUMMY.C", "w"); t = fileno(fp); printf("%d", t); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option B
Explanation:
Available Soon.
|
25. What will be the output of the following program? #include int main() { int k=1; printf("%d == 1 is" "%s", k, k==1?"TRUE":"FALSE"); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option B
Explanation:
Available Soon.
|
26. What will be the output of the following program? #include int main() { float a=3.15529; printf("%2.1f", a); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option C
Explanation:
Available Soon.
|
27. What will be the output of the following program? #include int main() { printf("%c", ~('C'*-1)); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option B
Explanation:
Available Soon.
|
28. What will be the output of the following program? #include int main() { char *p; p="%d"; p++; p++; printf(p-2, 23); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option B
Explanation:
Available Soon.
|
29. What will be the output of the following program? #include int main() { FILE *ptr; char i; ptr = fopen("myfile.c", "r"); while((i=fgetc(ptr))!=NULL) printf("%c", i); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option C
Explanation:
Available Soon.
|
30. What will be the output of the following program? #include int main() { printf("%%%%"); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option B
Explanation:
Available Soon.
|
31. What will be the output of the following program? #include int main() { int a=250; printf("%1d", a); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option D
Explanation:
Available Soon.
|
32. What will be the output of the following program? #include int main() { FILE *fp; char ch, str[7]; fp=fopen("try.c", "r"); /* file 'try.c' contains "This is Nagpur" */ fseek(fp, 9L, SEEK_CUR); fgets(str, 5, fp); puts(str); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option D
Explanation:
Available Soon.
|
33. What will be the output of the program if value 25 given to scanf()? #include int main() { int i; printf("%d", scanf("%d", &i)); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option C
Explanation:
Available Soon.
|
34. Point out the error in the program given below? #include int main() { char ch; int i; scanf("%c", &i); scanf("%d", &ch); printf("%c %d", ch, i); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option B
Explanation:
Available Soon.
|
35. Point out the error in the program given below? #include int main() { FILE *fp; fp=fopen("trial", "r"); fseek(fp, "20", SEEK_SET); fclose(fp); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option B
Explanation:
Available Soon.
|
36. Point out the error in the program given below? #include /* Assume there is a file called 'file.c' in c:\\tc directory. */ int main() { FILE *fp; fp=fopen("c:\\tc\\file.c", "r"); if(!fp) printf("Unable to open file."); fclose(fp); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option C
Explanation:
Available Soon.
|
37. Point out the error/warning in the program? #include int main() { unsigned char ch; FILE *fp; fp=fopen("trial", "r"); while((ch = getc(fp))!=EOF) printf("%c", ch); fclose(fp); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option A
Explanation:
Available Soon.
|
38. Which of the following statement is correct about the program? #include int main() { FILE *fp; char ch; int i=1; fp = fopen("myfile.c", "r"); while((ch=getc(fp))!=EOF) { if(ch == '\\n') i++; } fclose(fp); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option D
Explanation:
Available Soon.
|
39. In the following code, the P2 is Integer Pointer or Integer? typedef int *ptr; ptr p1, p2; |
||||||||
Free MCQs www.sharemcq.com
Answer: Option B
Explanation:
Available Soon.
|
40. In the following code what is 'P'? typedef char *charp; const charp P; |
||||||||
Free MCQs www.sharemcq.com
Answer: Option A
Explanation:
Available Soon.
|
41. What is x in the following program? #include int main() { typedef char (*(*arrfptr[3])())[10]; arrfptr x; return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option C
Explanation:
Available Soon.
|
42. What will be the output of the following program? #include int main() { enum color{red, green, blue}; typedef enum color mycolor; mycolor m = red; printf("%d", m); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option B
Explanation:
Available Soon.
|
43. What will be the output of the following program? #include int main() { typedef int arr[5]; arr iarr = {1, 2, 3, 4, 5}; int i; for(i=0; i<4; i++) printf("%d,", iarr[i]); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option A
Explanation:
Available Soon.
|
44. What will be the output of the following program? #include int main() { typedef int LONG; LONG a=4; LONG b=68; float c=0; c=b; b+=a; printf("%d,", b); printf("%f", c); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option A
Explanation:
Available Soon.
|
45. What will be the output of the following program? #include int main() { typedef float f; static f *fptr; float fval = 90; fptr = &fval; printf("%f", *fptr); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option C
Explanation:
Available Soon.
|
46. What will be the output of the following program? #include typedef struct error {int warning, err, exception;} ERROR; int main() { ERROR e; e.err=1; printf("%d", e.err); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option B
Explanation:
Available Soon.
|
47. Point out the error in the following code? typedef struct { int data; NODEPTR link; }*NODEPTR; |
||||||||
Free MCQs www.sharemcq.com
Answer: Option B
Explanation:
Available Soon.
|
48. What will be the output of the following program? #include int main() { int i=-3, j=2, k=0, m; m = ++i && ++j && ++k; printf("%d, %d, %d, %d", i, j, k, m); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option A
Explanation:
Available Soon.
|
No comments:
Post a Comment
Your Feedback is hearty Requested to make the MCQs Collection better.