1. What will be the output of the following program? #include int main() { int i=4, j=-1, k=0, w, x, y, z; w = i || j || k; x = i && j && k; y = i || j &&k; z = i && j || k; printf("%d, %d, %d, %d", w, x, y, z); 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() { 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 C
Explanation:
Available Soon.
|
3. What will be the output of the following program? #include int main() { int x=4, y, z; y = --x; z = x--; printf("%d, %d, %d", x, y, z); 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() { int i=3; i = i++; printf("%d", i); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option B
Explanation:
Available Soon.
|
5. What will be the output of the following program? #include int main() { int a=100, b=200, c; c = (a == 100 || b > 200); printf("c=%d", c); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option C
Explanation:
Available Soon.
|
6. What will be the output of the following program? #include int main() { int x=55; printf("%d, %d, %d", x<=55, x=40, x>=10); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option A
Explanation:
Available Soon.
|
7. What will be the output of the following program? #include int main() { int i=2; printf("%d, %d", ++i, ++i); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option D
Explanation:
Available Soon.
|
8. What will be the output of the following program? #include int main() { int k, num=30; k = (num>5 ? (num <=10 ? 100 : 200): 500); printf("%d", num); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option B
Explanation:
Available Soon.
|
9. What will be the output of the following program? #include int main() { int i=2; int j = i + (1, 2, 3, 4, 5); printf("%d", j); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option B
Explanation:
Available Soon.
|
10. Which of the following is the correct order if calling functions in the below code? a = f1(23, 14) * f2(12/4) + f3(); |
||||||||
Free MCQs www.sharemcq.com
Answer: Option C
Explanation:
Available Soon.
|
11. What will be the output of the following program? #include int main() { char ch; ch = 'A'; printf("The letter is"); printf("%c", ch >= 'A' && ch <= 'Z' ? ch + 'a' - 'A':ch); printf("Now the letter is"); printf("%c", ch >= 'A' && ch <= 'Z' ? ch : ch + 'a' - 'A'); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option A
Explanation:
Available Soon.
|
12. What will be the output of the following program? #include #define MAN(x, y) ((x)>(y)) ? (x):(y); int main() { int i=10, j=5, k=0; k = MAN(++i, j++); printf("%d, %d, %d", i, j, k); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option A
Explanation:
Available Soon.
|
13. What will be the output of the following program? #include #define SQR(x)(x*x) int main() { int a, b=3; a = SQR(b+2); printf("%d", a); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option B
Explanation:
Available Soon.
|
14. What will be the output of the following program? #include #define CUBE(x) (x*x*x) int main() { int a, b=3; a = CUBE(b++); printf("%d, %d", a, b); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option C
Explanation:
Available Soon.
|
15. What will be the output of the following program? #include #define PRINT(int) printf("int=%d, ", int); int main() { int x=2, y=3, z=4; PRINT(x); PRINT(y); PRINT(z); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option A
Explanation:
Available Soon.
|
16. What will be the output of the following program? #include #define SWAP(a, b) int t; t=a, a=b, b=t; int main() { int a=10, b=12; SWAP(a, b); printf("a = %d, b = %d", a, b); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option B
Explanation:
Available Soon.
|
17. What will be the output of the following program? #include #define FUN(i, j) i##j int main() { int va1=10; int va12=20; printf("%d", FUN(va1, 2)); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option B
Explanation:
Available Soon.
|
18. What will be the output of the following program? #include #define MAX(a, b) (a > b ? a : b) int main() { int x; x = MAX(3+2, 2+7); printf("%d", x); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option B
Explanation:
Available Soon.
|
19. What will be the output of the following program? #include #define MIN(x, y) (x { int x=3, y=4, z; z = MIN(x+y/2, y-1); if(z > 0) printf("%d", z); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option A
Explanation:
Available Soon.
|
20. What will be the output of the following program? #include #define MAX(a, b, c) (a>b ? a>c ? a : c: b>c ? b : c) int main() { int x; x = MAX(3+2, 2+7, 3+7); printf("%d", x); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option C
Explanation:
Available Soon.
|
21. Point out the error in the program #include int main() { int i; #if A printf("Enter any number:"); scanf("%d", &i); #elif B printf("The number is odd"); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option A
Explanation:
Available Soon.
|
22. What will be the output of the following program? #include #include int main() { char str1[20] = "Hello", str2[20] = " World"; printf("%s", strcpy(str2, strcat(str1, str2))); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option C
Explanation:
Available Soon.
|
23. What will be the output of the following program? #include int main() { char p[] = "%d"; p[1] = 'c'; printf(p, 65); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option A
Explanation:
Available Soon.
|
24. What will be the output of the following program? #include #include int main() { printf("%d", strlen("123456")); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option A
Explanation:
Available Soon.
|
25. What will be the output of the following program? #include int main() { printf(5+"Good Morning"); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option D
Explanation:
Available Soon.
|
26. What will be the output of the following program? #include #include int main() { static char str1[] = "dills"; static char str2[20]; static char str3[] = "Daffo"; int i; i = strcmp(strcat(str3, strcpy(str2, str1)), "Daffodills"); printf("%d", i); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option A
Explanation:
Available Soon.
|
27. What will be the output of the following program? #include #include int main() { static char s[] = "Hello!"; printf("%d", *(s+strlen(s))); 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() { int i; char a[] = "\\0"; if(printf("%s", a)) printf("The string is empty"); else printf("The string is not empty"); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option B
Explanation:
Available Soon.
|
29. If char=1, int=4, and float=4 bytes size, What will be the output of the program? #include int main() { char ch = 'A'; printf("%d, %d, %d", sizeof(ch), sizeof('A'), sizeof(3.14f)); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option B
Explanation:
Available Soon.
|
30. What will be the output of the following program? #include int main() { char str1[] = "Hello"; char str2[10]; char *t, *s; s = str1; t = str2; while(*t=*s) *t++ = *s++; printf("%s", str2); 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[] = "Nagpur"; str[0]='K'; printf("%s, ", str); str = "Kanpur"; printf("%s", str+1); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option D
Explanation:
Available Soon.
|
32. What will be the output of the following program? #include #include int main() { char sentence[80]; int i; printf("Enter a line of text"); gets(sentence); for(i=strlen(sentence)-1; i >=0; i--) putchar(sentence[i]); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option B
Explanation:
Available Soon.
|
33. If the size of pointer is 4 bytes then what will be the output of the program? #include int main() { char *str[] = {"Frogs", "Do", "Not", "Die", "They", "Croak!"}; printf("%d, %d", sizeof(str), strlen(str[0])); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option C
Explanation:
Available Soon.
|
34. What will be the output of the following program? #include int main() { int i; char a[] = "\\0"; if(printf("%s", a)) printf("The string is not empty"); else printf("The string is empty"); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option B
Explanation:
Available Soon.
|
35. What will be the output of the following program? #include #include int main() { char str1[5], str2[5]; int i; gets(str1); gets(str2); i = strcmp(str1, str2); printf("%d", i); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option A
Explanation:
Available Soon.
|
36. What will be the output of the following program? #include int main() { char str1[] = "Hello"; char str2[] = "Hello"; if(str1 == str2) printf("Equal"); else printf("Unequal"); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option B
Explanation:
Available Soon.
|
37. What will be the output of the following program? #include #include int main() { printf("%c", "abcdefgh"[4]); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option C
Explanation:
Available Soon.
|
38. Which of the following statement is correct? | ||||||||
Free MCQs www.sharemcq.com
Answer: Option C
Explanation:
Available Soon.
|
39. What will be the output of the program (sample.c) given below if it is executed from the command line? cmd> sample Good Morning /* sample.c */ #include int main(int argc, char *argv[]) { printf("%d %s", argc, argv[1]); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option A
Explanation:
Available Soon.
|
40. What will be the output of the following program? #include int main() { int y=128; const int x=y; printf("%d", x); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option A
Explanation:
Available Soon.
|
41. What will be the output of the following program? #include int main() { const int x=5; const int *ptrx; ptrx = &x; *ptrx = 10; printf("%d", 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() { const char *s = ""; char str[] = "Hello"; s = str; while(*s) printf("%c", *s++); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option C
Explanation:
Available Soon.
|
43. What will be the output of the following program? #include int main() { const int i=0; printf("%d", i++); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option D
Explanation:
Available Soon.
|
44. What will be the output of the following program? #include int main() { const c = -11; const int d = 34; printf("%d, %d", c, d); return 0; } |
||||||||
Free MCQs www.sharemcq.com
Answer: Option B
Explanation:
Available Soon.
|
45. What do the following declaration signify? int *ptr[30]; |
||||||||
Free MCQs www.sharemcq.com
Answer: Option B
Explanation:
Available Soon.
|
46. Declare the following statement? A pointer to an array of three chars. |
||||||||
Free MCQs www.sharemcq.com
Answer: Option D
Explanation:
Available Soon.
|
47. What do the following declaration signify? char *arr[10]; |
||||||||
Free MCQs www.sharemcq.com
Answer: Option A
Explanation:
Available Soon.
|
48. What do the following declaration signify? int (*pf)(); |
||||||||
Free MCQs www.sharemcq.com
Answer: Option C
Explanation:
Available Soon.
|
No comments:
Post a Comment
Your Feedback is hearty Requested to make the MCQs Collection better.