C-MCQs

Set-26 C MCQ

C MCQ Set-26 : Multiple Choice Questions in C Set-26

What will be the output of the following C code? #include<stdio.h> struct student{char *name;};struct student s[2];void main(){s[0].name = “alan”;s[1] = s[0];printf(“%s%s”, s[0].name, s[1].name);s[1].name = “turing”;printf(“%s%s”, s[0].name, s[1].name);} a) alan alan alan turingb) alan alan turing turingc) alan turing alan turingd) run time error Answer : A Which of the following will stop the loop at …

C MCQ Set-26 : Multiple Choice Questions in C Set-26 Read More »

Set-26 C MCQ

C MCQ Set-25 : Multiple Choice Questions in C Set-25

What will be the output of the following C code?#include<stdio.h> int main(){int i = 97, *p = &i;foo(&i);printf(“%d “, *p);}void foo(int *p){int j = 2;p = &j;printf(“%d “, *p);} a) 2 97b) 2 2c) Compile time errord) Segmentation fault/code crash Answer : A Which among the following is right? a. sizeof(struct stemp) > sizeof(union utemp) …

C MCQ Set-25 : Multiple Choice Questions in C Set-25 Read More »

Set-26 C MCQ

C MCQ Set-24 : Multiple Choice Questions in C Set-24

1. Assume that size of an integer is 32 bit. What is the output of following program? #include<stdio.h>struct st{int x;static int y;}; int main(){printf(“%d”, sizeof(struct st));return 0;}(A) 4(B) 8(C) Compiler Error(D) Runtime Error Answer: (C) 2. Which of the following structure definitions are correct? I. struct book{int a;struct book b;}; II. struct book{int a;struct book …

C MCQ Set-24 : Multiple Choice Questions in C Set-24 Read More »

Set-26 C MCQ

C MCQ Set-23 : Multiple Choice Questions in C Set-23

1.Which of the following option is correct?P1:int main(){int (ptr)(int ) = fun; (ptr)(3);return 0;} int fun(int n){for(;n > 0; n–)printf(“CQuiz “);return 0;} P2:int main(){void demo();void (fun)(); fun = demo; (fun)();fun();return 0;} void demo(){printf(“CQuiz “);} (A) P1 printed “CQuiz CQuiz” and P2 printed “CsQuiz CQuiz”(B) P1 printed “CQuiz CQuiz” and P2 gives compiler error(C) P1 gives …

C MCQ Set-23 : Multiple Choice Questions in C Set-23 Read More »

Set-26 C MCQ

C MCQ Set-21 : Multiple Choice Questions in C Set-21

What is the output of the following program?int main(){char r=132;printf(“%d\n”, r);} a. -132b. -124c. 132d. None Answer: b Select the most appropriate output for the following C code:main(){printf(“%d %d %d %d”,-6%5,6%5,-6%-5,6%-5);} a. -1 1 -1 1b. 1 -1 1 -1c. 1 -1 -1 1d. Error Answer:a 3. Select the most appropriate output of the following …

C MCQ Set-21 : Multiple Choice Questions in C Set-21 Read More »

Set-26 C MCQ

C MCQ Set-20 : Multiple Choice Questions in C Set-20

1. What is the output of the following code? include<stdio.h>int main(){char ptr; ptr = “A BCD EFGH”; printf(“%c”,&*ptr);return 0;} a. Ab. A BCD EFGHc. Some address will be printedd. Compilation Error Answer : a 2. What is the output of the following code? include<stdio.h>void func(int, int);int main(){int i = 5, j = 2;func (i,j);printf(“%d %d\n”, …

C MCQ Set-20 : Multiple Choice Questions in C Set-20 Read More »

Set-26 C MCQ

C MCQ Set-17 : Multiple Choice Questions in C Set-17

1. Assuming, integer is 2 byte, What will be the output of the program? #include<stdio.h>int main(){printf(“%x\n”, -2<<2);return 0;}A. ffffB. 0C. fff8D. Error Answer : C What will be the output of the program? #include<stdio.h>int main(){int x=12, y=7, z;z = x!=4 || y == 2;printf(“z=%d\n”, z);return 0;} A. z=0B. z=1C. z=4D. z=2 Answer : B What …

C MCQ Set-17 : Multiple Choice Questions in C Set-17 Read More »