Explore topic-wise MCQs in C Program.

This section includes 75 Mcqs, each offering curated multiple-choice questions to sharpen your C Program knowledge and support exam preparation. Choose a topic below to get started.

1.

Determine Output:void main(){static char *s[] = {"black", "white", "yellow", "violet"};char **ptr[] = {s+3, s+2, s+1, s}, ***p;p = ptr;++p;printf("%s",*--*++p + 3);}

A. e
B. w
C. t
D. k
Answer» E.
2.

Determine Output:void main(){int a[] = {10,20,30,40,50}, j, *p;for(j=0; j

A. 0 20 30 40 50 10 20 30 40 50
B. 0 20 30 40 50 Garbage Value
C. rror
D. one of These
Answer» D. one of These
3.

Determine Output:void main(){int c[] = {2.8,3.4,4,6.7,5};int j, *p=c, *q=c;for(j=0;j

A. 3 4 6 5 2 3 4 6 5
B. .8 3.4 4 6.7 5 2.8 3.4 4 6.7
C. .8 2.8 2.8 2.8 2.8 2.8 3.4 4
D. 2 2 2 2 2 3 4 6 5
Answer» E.
4.

Determine Output:void main(){char *p;p="%d\n";p++;p++;printf(p-2, 300);}

A. d\n
B. 00
C. rror
D. one of These
Answer» C. rror
5.

Determine Output:#define prod(a,b)a*bvoid main(){int x=3, y=4;printf("%d", prod(x+2, y-1));}

A. 5
B. 0
C. 2
D. 1
Answer» C. 2
6.

Determine Output:void main(){static int i=i++, j=j++,k=k++;printf("%d %d %d", i, j, k);}

A. 1 1
B. 0 0
C. arbage values
D. rror
Answer» B. 0 0
7.

Determine Output:void main(){int i=i++, j=j++, k=k++;printf("%d %d %d", i, j, k);}

A. 1 1
B. 0 0
C. arbage values
D. rror
Answer» D. rror
8.

Determine Output:void main(){int i;char a[]="�";if(printf("%sn", a))printf("Ok here n");elseprintf("Forget itn");}

A. k here
B. orget it
C. rror
D. one of These
Answer» B. orget it
9.

Determine Output:void main(){int i=5, j=6, z;printf("%d", i+++j);}

A. 2
B. 3
C. 1
D. one of These
Answer» D. one of These
10.

Determine Output:#includevoid main(){register i=5;char j[]= "hello";printf("%s %d", j, i);}

A. ello 5
B. ello garbage value
C. rror
D. one of These
Answer» B. ello garbage value
11.

Determine Output:void main(){char *str1 = "abcd";char str2[] = "abcd";printf("%d %d %d", sizeof(str1), sizeof(str2), sizeof("abcd"));}

A. 5 5
B. 5 5
C. 4 5
D. 4 4
Answer» B. 5 5
12.

Determine Output:void main(){int i = -1;+i;printf("i = %d, +i = %d", i, +i);}

A. = -1, +i = 1
B. = 1, +i = 1
C. = -1, +i = -1
D. one of These
Answer» D. one of These
13.

Determine Output:void main(){int i=-1, j=-1, k=0, l=2, m;m = i++ && j++ && k++ || l++;printf("%d %d %d %d %d", i, j, k, l, m);}

A. 0 1 2 0
B. 0 1 3 0
C. 0 1 3 1
D. 0 0 2 1
Answer» D. 0 0 2 1
14.

Determine Output:void main(){static int i=5;if(--i){main();printf("%d ", i);}}

A. 4 3 2 1
B. 0 0 0
C. nfinite Loop
D. one of These
Answer» C. nfinite Loop
15.

Determine Output:void main(){int i=0, j=0;if(i && j++)printf("%d..%d", i++, j);printf("%d..%d", i, j);}

A. ..1
B. ..0
C. ..0
D. ..1
Answer» D. ..1
16.

Determine Output:void main(){struct xx{int x=3;char name[] = "hello";};struct xx *s = malloc(sizeof(struct xx));printf("%d", s->x);printf("%s", s->name);}

A. hello
B. ompiler Error
C. inking error
D. one of these
Answer» C. inking error
17.

Determine Output:void main(){int i=1, j=2;switch(i){case 1: printf("GOOD"); break;case j: printf("BAD"); break;}}

A. OOD BAD
B. OOD
C. ompiler Error
D. one of These
Answer» D. one of These
18.

Determine Output:void main(){int i=1;while(i2)goto here;i++;}}fun(){here:printf("PP");}

A. 2PP
B. 2PP345
C. ompiler Error
D. one of These
Answer» D. one of These
19.

Determine Output:void main(){printf("%p", main);}

A. rror
B. ake an infinite loop
C. ome address will be printed
D. one of These
Answer» D. one of These
20.

Determine Output:void main(){int i=3;switch(i){default: printf("zero");case 1: printf("one"); break;case 2: printf("two"); break;case 3: printf("three"); break;}}

A. ero
B. hree
C. rror
D. one of These
Answer» C. rror
21.

Determine Output:#define int charvoid main(){int i = 65;printf("sizeof(i)=%d", sizeof(i));}

A. izeof(i)=2
B. izeof(i)=1
C. ompiler Error
D. one of These
Answer» C. ompiler Error
22.

Determine the Final Output:void main(){printf("\nab");printf("\bsi");printf("\rha");}

A. bsiha
B. siha
C. aasi
D. ai
Answer» E.
23.

Determine Output:#include#define a 10void main(){#define a 50printf("%d", a);}

A. 0
B. 0
C. ompiler Error
D. one of These
Answer» B. 0
24.

Determine Output:void main(){char *p="hi friends", *p1;p1=p;while(*p!='\0') ++*p++;printf("%s", p1);}

A. i friends
B. j!gsjfoet
C. j grjeodt
D. one of These
Answer» C. j grjeodt
25.

Determine Output:void main(){int i=5;printf("%d%d%d%d%d", i++, i--, ++i, --i, i);}

A. 5545
B. 4544
C. 5445
D. 4554
Answer» B. 4544
26.

Determine Output:void main(){char string[]="Hello World";display(string);}void display(char *string){printf("%s", string);}

A. ill print Hello World
B. ompiler Error
C. an't Say
D. one of These
Answer» C. an't Say
27.

Determine Output:void main(){char *p;printf("%d %d", sizeof(*p), sizeof(p));}

A. 1
B. 2
C. 1
D. 2
Answer» C. 1
28.

Determine Output:void main(){static int var = 5;printf("%d ", var--);if(var)main();}

A. 5 5 5 5
B. 4 3 2 1
C. nfinite Loop
D. one of These
Answer» C. nfinite Loop
29.

Determine Output:void main(){float me = 1.1;double you = 1.1;if(me==you)printf("I hate Examveda");elseprintf("I love Examveda");}

A. hate Examveda
B. love Examveda
C. rror
D. one of These
Answer» C. rror
30.

Determine Output:void main(){char s[]="man";int i;for(i=0; s[i]; i++)printf("%c%c%c%c ", s[i], *(s+i), *(i+s), i[s]);}

A. mm nnn aaa
B. mmm nnnn aaaa
C. ompiler Error
D. one of These
Answer» E.
31.

*/*_Determine Output:void main(){ static char *s[] = {"black", "white", "yellow", "violet"}; char **ptr[] = {s+3, s+2, s+1, s}, ***p; p = ptr; ++p; printf("%s",*--*++p + 3); }?

A. te
B. ow
C. et
D. ck
Answer» E.
32.

*/*_Determine Output:void main(){ char a[]="12345"; int i = strlen(a); printf("%d", ++i);}?

A. 5
B. 6
C. 7
D. None of These
Answer» C. 7
33.

*/*_Determine Output:void main(){ char p[]="%dn"; p[1] = 'c'; printf(p, 65);}?

A. 65
B. c
C. A
D. Error
Answer» D. Error
34.

*/*_Determine output:void main(){ extern int i; i=20; printf("%d", sizeof(i));}?

A. 20
B. 2
C. Compiler Error
D. Linker Error
Answer» E.
35.

*/*_Determine Output:void main(){ char *str1 = "abcd"; char str2[] = "abcd"; printf("%d %d %d", sizeof(str1), sizeof(str2), sizeof("abcd"));}?

A. 2 5 5
B. 5 5 5
C. 2 4 5
D. 2 4 4
Answer» B. 5 5 5
36.

*/*_Determine Output:#include#define a 10void main(){ #define a 50 printf("%d", a);}?

A. 50
B. 10
C. Compiler Error
D. None of These
Answer» B. 10
37.

*/*_Determine Output:void main(){ int i=1; while(i2) goto here; i++; }}fun(){ here: printf("PP");}?

A. 12PP
B. 12PP345
C. Compiler Error
D. None of These
Answer» D. None of These
38.

*/*_Determine Output:void main(){ int i=3; switch(i) { default: printf("zero"); case 1: printf("one"); break; case 2: printf("two"); break; case 3: printf("three"); break; }}?

A. zero
B. three
C. Error
D. None of These
Answer» C. Error
39.

*/*_Determine Output:void main(){ char *p; printf("%d %d", sizeof(*p), sizeof(p));}?

A. 1 1
B. 1 2
C. 2 1
D. 2 2
Answer» C. 2 1
40.

_ Determine Output:#includevoid main(){ char s[]={'a','b','c','n','c','\0'}; char *p, *str, *str1; p=&s[3]; str=p; str1=s; printf("%c", ++*p + ++*str1-32);}$?

A. N
B. P
C. M
D. None of These
Answer» D. None of These
41.

_ Determine Output:void main(){ int i = abc(10); printf("%d", --i);}int abc(int i){ return(i++);}$?

A. 10
B. 9
C. 11
D. None of These
Answer» C. 11
42.

_ Determine Output:#define prod(a,b) a*bvoid main(){ int x=3, y=4; printf("%d", prod(x+2, y-1));}$?

A. 15
B. 10
C. 12
D. 11
Answer» C. 12
43.

_ Determine Output:void main(){ struct xx { int x=3; char name[] = "hello"; }; struct xx *s = malloc(sizeof(struct xx)); printf("%d", s->x); printf("%s", s->name); }$?

A. 3 hello
B. Compiler Error
C. Linking error
D. None of these
Answer» C. Linking error
44.

_ Determine Output:void main(){ int i = -1; +i; printf("i = %d, +i = %d", i, +i);}$?

A. i = -1, +i = 1
B. i = 1, +i = 1
C. i = -1, +i = -1
D. None of These
Answer» D. None of These
45.

_ Determine Output:void main(){ char *p="hi friends", *p1; p1=p; while(*p!='\0') ++*p++; printf("%s", p1);}$?

A. hi friends
B. ij!gsjfoet
C. hj grjeodt
D. None of These
Answer» C. hj grjeodt
46.

_ Determine Output:void main(){ char *p; p="Hello"; printf("%c", *&*p);}$?

A. Hello
B. H
C. Some Address will be printed
D. None of These
Answer» C. Some Address will be printed
47.

_ Determine Output:#define int charvoid main(){ int i = 65; printf("sizeof(i)=%d", sizeof(i));}$?

A. sizeof(i)=2
B. sizeof(i)=1
C. Compiler Error
D. None of These
Answer» C. Compiler Error
48.

_ Determine Output:void main(){ static int var = 5; printf("%d ", var--); if(var) main();}$?

A. 5 5 5 5 5
B. 5 4 3 2 1
C. Infinite Loop
D. None of These
Answer» C. Infinite Loop
49.

_Determine Output:void main(){ int a[] = {10,20,30,40,50}, j, *p; for(j=0; j

A. 10 20 30 40 50 10 20 30 40 50
B. 10 20 30 40 50 Garbage Value
C. Error
D. None of These
Answer» D. None of These
50.

_Determine Output:void main(){ int i=5, j=6, z; printf("%d", i+++j);}$?

A. 12
B. 13
C. 11
D. None of These
Answer» D. None of These