MCQOPTIONS
Saved Bookmarks
This section includes 564 Mcqs, each offering curated multiple-choice questions to sharpen your Engineering knowledge and support exam preparation. Choose a topic below to get started.
| 201. |
What will be the output of the program (Turbo C in 16 bit platform DOS) ? #include<stdio.h> #include<string.h> int main() { char *str1 = "India"; char *str2 = "BIX"; char *str3; str3 = strcat(str1, str2); printf("%s %s n", str3, str1); return 0; } |
| A. | IndiaBIX India |
| B. | IndiaBIX IndiaBIX |
| C. | India India |
| D. | Error |
| Answer» C. India India | |
| 202. |
What will be the output of the program ? #include<stdio.h> int main() { float arr[] = {12.4, 2.3, 4.5, 6.7}; printf("%d n", sizeof(arr)/sizeof(arr[0])); return 0; } |
| A. | 5 |
| B. | 4 |
| C. | 6 |
| D. | 7 |
| Answer» C. 6 | |
| 203. |
What will be the output of the program ? #include<stdio.h> int main() { printf(5+"IndiaBIX n"); return 0; } |
| A. | Error |
| B. | IndiaBIX |
| C. | BIX |
| D. | None of above |
| Answer» D. None of above | |
| 204. |
What will be the output of the program ? #include<stdio.h> int main() { enum status {pass, fail, absent}; enum status stud1, stud2, stud3; stud1 = pass; stud2 = absent; stud3 = fail; printf("%d %d %d n", stud1, stud2, stud3); return 0; } |
| A. | 0, 1, 2 |
| B. | 1, 2, 3 |
| C. | 0, 2, 1 |
| D. | 1, 3, 2 |
| Answer» D. 1, 3, 2 | |
| 205. |
Point out the error in the program? struct emp { int ecode; struct emp e; }; |
| A. | Error: in structure declaration |
| B. | Linker Error |
| C. | No Error |
| D. | None of above |
| Answer» B. Linker Error | |
| 206. |
Maximum number of arguments that a function can take is 12 |
| A. | Yes |
| B. | No |
| Answer» C. | |
| 207. |
Which of the following sentences are correct about a switch loop in a C program? 1: switch is useful when we wish to check the value of variable against a particular set of values. 2: switch is useful when we wish to check whether a value falls in different ranges. 3: Compiler implements a jump table for cases used in switch. 4: It is not necessary to use a break in every switch statement. |
| A. | 1,2 |
| B. | 1,3,4 |
| C. | 2,4 |
| D. | 2 |
| Answer» C. 2,4 | |
| 208. |
Functions cannot return a floating point number |
| A. | Yes |
| B. | No |
| Answer» C. | |
| 209. |
Every function must return a value |
| A. | Yes |
| B. | No |
| Answer» C. | |
| 210. |
Will the following functions work? int f1(int a, int b) { return ( f2(20) ); } int f2(int a) { return (a*a); } |
| A. | Yes |
| B. | No |
| Answer» B. No | |
| 211. |
A function cannot be defined inside another function |
| A. | True |
| B. | False |
| Answer» B. False | |
| 212. |
Functions cannot return more than one value at a time |
| A. | True |
| B. | False |
| Answer» B. False | |
| 213. |
If return type for a function is not specified, it defaults to int |
| A. | True |
| B. | False |
| Answer» B. False | |
| 214. |
In C all functions except main() can be called recursively. |
| A. | True |
| B. | False |
| Answer» C. | |
| 215. |
Functions can be called either by value or reference |
| A. | True |
| B. | False |
| Answer» B. False | |
| 216. |
Point out the error in the program #include<stdio.h> int main() { int a=10; void f(); a = f(); printf("%d n", a); return 0; } void f() { printf("Hi"); } |
| A. | Error: Not allowed assignment |
| B. | Error: Doesn't print anything |
| C. | No error |
| D. | None of above |
| Answer» B. Error: Doesn't print anything | |
| 217. |
Are the expressions arr and &arr same for an array of 10 integers? |
| A. | Yes |
| B. | No |
| Answer» C. | |
| 218. |
Which of the following statements mentioning the name of the array begins DOES NOT yield the base address? 1: When array name is used with the sizeof operator. 2: When array name is operand of the & operator. 3: When array name is passed to scanf() function. 4: When array name is passed to printf() function. |
| A. | A |
| B. | A, B |
| C. | B |
| D. | B, D |
| Answer» C. B | |
| 219. |
Point out the error in the program #include<stdio.h> int f(int a) { a > 20? return(10): return(20); } int main() { int f(int); int b; b = f(20); printf("%d n", b); return 0; } |
| A. | Error: Prototype declaration |
| B. | No error |
| C. | Error: return statement cannot be used with conditional operators |
| D. | None of above |
| Answer» D. None of above | |
| 220. |
Does this mentioning array name gives the base address in all the contexts? |
| A. | Yes |
| B. | No |
| Answer» C. | |
| 221. |
A pointer to a block of memory is effectively same as an array |
| A. | True |
| B. | False |
| Answer» B. False | |
| 222. |
What will be the output of the program? #include<stdio.h> int main() { int x=55; printf("%d, %d, %d n", x<=55, x=40, x>=10); return 0; } |
| A. | 1, 40, 1 |
| B. | 1, 55, 1 |
| C. | 1, 55, 0 |
| D. | 1, 1, 1 |
| Answer» B. 1, 55, 1 | |
| 223. |
Which of the following statements are correct about an array? 1: The array int num[26]; can store 26 elements. 2: The expression num[1] designates the very first element in the array. 3: It is necessary to initialize the array at the time of declaration. 4: The declaration num[SIZE] is allowed if SIZE is a macro. |
| A. | 1 |
| B. | 1,4 |
| C. | 2,3 |
| D. | 2,4 |
| Answer» C. 2,3 | |
| 224. |
What will be the output of the program ? #include<stdio.h> 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; } |
| A. | 2, 1, 15 |
| B. | 1, 2, 5 |
| C. | 3, 2, 15 |
| D. | 2, 3, 20 |
| Answer» D. 2, 3, 20 | |
| 225. |
Which of the following statements are correct about 6 used in the program? int num[6];num[6]=21; |
| A. | In the first statement 6 specifies a particular element, whereas in the second statement it specifies a type. |
| B. | In the first statement 6 specifies a array size, whereas in the second statement it specifies a particular element of array. |
| C. | In the first statement 6 specifies a particular element, whereas in the second statement it specifies a array size. |
| D. | In both the statement 6 specifies array size. |
| Answer» C. In the first statement 6 specifies a particular element, whereas in the second statement it specifies a array size. | |
| 226. |
What will be the output of the program if the array begins at address 65486? #include<stdio.h> int main() { int arr[] = {12, 14, 15, 23, 45}; printf("%u, %u n", arr, &arr); return 0; } |
| A. | 65486, 65488 |
| B. | 65486, 65486 |
| C. | 65486, 65490 |
| D. | 65486, 65487 |
| Answer» C. 65486, 65490 | |
| 227. |
What will be the output of the program in Turb C (under DOS)? #include<stdio.h> 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; } |
| A. | 1, 2, 3, 4, 5, |
| B. | Garbage value, 1, 2, 3, 4, |
| C. | 0, 1, 2, 3, 4, |
| D. | 2, 3, 4, 5, 6, |
| Answer» C. 0, 1, 2, 3, 4, | |
| 228. |
What will be the output of the program ? #include<stdio.h> int main() { int arr[1]={10}; printf("%d n", 0[arr]); return 0; } |
| A. | 1 |
| B. | 10 |
| C. | 0 |
| D. | 6 |
| Answer» C. 0 | |
| 229. |
What will be the output of the program? #include<stdio.h> int main() { int k, num=30; k = (num>5 ? (num <=10 ? 100 : 200): 500); printf("%d n", num); return 0; } |
| A. | 200 |
| B. | 30 |
| C. | 100 |
| D. | 500 |
| Answer» C. 100 | |
| 230. |
What will be the output of the program? #include<stdio.h> int main() { int i=3; i = i++; printf("%d n", i); return 0; } |
| A. | 3 |
| B. | 4 |
| C. | 5 |
| D. | 6 |
| Answer» C. 5 | |
| 231. |
What will be the output of the program? #include<stdio.h> int main() { int i=-3, j=2, k=0, m; m = ++i && ++j || ++k; printf("%d, %d, %d, %d n", i, j, k, m); return 0; } |
| A. | 1, 2, 0, 1 |
| B. | -3, 2, 0, 1 |
| C. | -2, 3, 0, 1 |
| D. | 2, 3, 1, 1 |
| Answer» D. 2, 3, 1, 1 | |
| 232. |
What will be the output of the program? #include<stdio.h> int main() { int x=4, y, z; y = --x; z = x--; printf("%d, %d, %d n", x, y, z); return 0; } |
| A. | 4, 3, 3 |
| B. | 4, 3, 2 |
| C. | 3, 3, 2 |
| D. | 2, 3, 3 |
| Answer» E. | |
| 233. |
What will be the output of the program? #include<stdio.h> int main() { int i=2; printf("%d, %d n", ++i, ++i); return 0; } |
| A. | 3, 4 |
| B. | 4, 3 |
| C. | 4, 4 |
| D. | Output may vary from compiler to compiler |
| Answer» E. | |
| 234. |
What will be the output of the program? #include<stdio.h> int main() { int i=2; int j = i + (1, 2, 3, 4, 5); printf("%d n", j); return 0; } |
| A. | 4 |
| B. | 7 |
| C. | 6 |
| D. | 5 |
| Answer» C. 6 | |
| 235. |
What will be the output of the program? #include<stdio.h> int main() { int a=100, b=200, c; c = (a == 100 || b > 200); printf("c=%d n", c); return 0; } |
| A. | c=100 |
| B. | c=200 |
| C. | c=1 |
| D. | c=300 |
| Answer» D. c=300 | |
| 236. |
What will be the output of the program? #include<stdio.h> int addmult(int ii, int jj) { int kk, ll; kk = ii + jj; ll = ii * jj; return (kk, ll); } int main() { int i=3, j=4, k, l; k = addmult(i, j); l = addmult(i, j); printf("%d %d n", k, l); return 0; } |
| A. | 12 12 |
| B. | No error, No output |
| C. | Error: Compile error |
| D. | None of above |
| Answer» B. No error, No output | |
| 237. |
What will be the output of the program ? #include<stdio.h> int main() { void fun(int, int[]); int arr[] = {1, 2, 3, 4}; int i; fun(4, arr); for(i=0; i<4; i++) printf("%d,", arr[i]); return 0; } void fun(int n, int arr[]) { int *p=0; int i=0; while(i++ < n) p = &arr[i]; *p=0; } |
| A. | 2, 3, 4, 5 |
| B. | 1, 2, 3, 4 |
| C. | 0, 1, 2, 3 |
| D. | 3, 2, 1 0 |
| Answer» C. 0, 1, 2, 3 | |
| 238. |
What will be the output of the program ? #include<stdio.h> void fun(int **p); int main() { int a[3][4] = {1, 2, 3, 4, 4, 3, 2, 8, 7, 8, 9, 0}; int *ptr; ptr = &a[0][0]; fun(&ptr); return 0; } void fun(int **p) { printf("%d n", **p); } |
| A. | 1 |
| B. | 2 |
| C. | 3 |
| D. | 4 |
| Answer» B. 2 | |
| 239. |
What will be the output of the program? #include<stdio.h> int fun(int(*)()); int main() { fun(main); printf("Hi n"); return 0; } int fun(int (*p)()) { printf("Hello "); return 0; } |
| A. | Infinite loop |
| B. | Hi |
| C. | Hello Hi |
| D. | Error |
| Answer» D. Error | |
| 240. |
What will be the output of the program? #include<stdio.h> int fun(int i) { i++; return i; } int main() { int fun(int); int i=3; fun(i=fun(fun(i))); printf("%d n", i); return 0; } |
| A. | 5 |
| B. | 4 |
| C. | Error |
| D. | Garbage value |
| Answer» B. 4 | |
| 241. |
What will be the output of the program? #include<stdio.h> int fun(int); int main() { float k=3; fun(k=fun(fun(k))); printf("%f n", k); return 0; } int fun(int i) { i++; return i; } |
| A. | 5.000000 |
| B. | 3.000000 |
| C. | Garbage value |
| D. | 4.000000 |
| Answer» B. 3.000000 | |
| 242. |
What will be the output of the program? #include<stdio.h> int main() { float a=0.7; if(a < 0.7f) printf("C n"); else printf("C++ n"); return 0; } |
| A. | C |
| B. | C++ |
| C. | Compiler error |
| D. | Non of above |
| Answer» C. Compiler error | |
| 243. |
What will be the output of the program? #include<stdio.h> int i; int fun1(int); int fun2(int); int main() { extern int j; int i=3; fun1(i); printf("%d,", i); fun2(i); printf("%d", i); return 0; } int fun1(int j) { printf("%d,", ++j); return 0; } int fun2(int i) { printf("%d,", ++i); return 0; } int j=1; |
| A. | 3, 4, 4, 3 |
| B. | 4, 3, 4, 3 |
| C. | 3, 3, 4, 4 |
| D. | 3, 4, 3, 4 |
| Answer» C. 3, 3, 4, 4 | |
| 244. |
What will be the output of the program? #include<stdio.h> int func1(int); int main() { int k=35; k = func1(k=func1(k=func1(k))); printf("k=%d n", k); return 0; } int func1(int k) { k++; return k; } |
| A. | k=35 |
| B. | k=36 |
| C. | k=37 |
| D. | k=38 |
| Answer» E. | |
| 245. |
What will be the output of the program? #include<stdio.h> int check (int, int); int main() { int c; c = check(10, 20); printf("c=%d n", c); return 0; } int check(int i, int j) { int *p, *q; p=&i; q=&j; i>=45 ? return(*p): return(*q); } |
| A. | Print 10 |
| B. | Print 20 |
| C. | Print 1 |
| D. | Compile error |
| Answer» E. | |
| 246. |
What will be the output of the program? #include<stdio.h> int addmult(int ii, int jj) { int kk, ll; kk = ii + jj; ll = ii * jj; return (kk, ll); } int main() { int i=3, j=4, k, l; k = addmult(i, j); l = addmult(i, j); printf("%d, %d n", k, l); return 0; } |
| A. | 12, 12 |
| B. | 7, 7 |
| C. | 7, 12 |
| D. | 12, 7 |
| Answer» B. 7, 7 | |
| 247. |
What will be the output of the program? #include<stdio.h> int fun(int, int); typedef int (*pf) (int, int); int proc(pf, int, int); int main() { printf("%d n", proc(fun, 6, 6)); return 0; } int fun(int a, int b) { return (a==b); } int proc(pf p, int a, int b) { return ((*p)(a, b)); } |
| A. | 6 |
| B. | 1 |
| C. | 0 |
| D. | -1 |
| Answer» C. 0 | |
| 248. |
What will be the output of the program? #include<stdio.h> int main() { int fun(int); int i = fun(10); printf("%d n", --i); return 0; } int fun(int i) { return (i++); } |
| A. | 9 |
| B. | 10 |
| C. | 11 |
| D. | 8 |
| Answer» B. 10 | |
| 249. |
What will be the output of the program? #include<stdio.h> int check(int); int main() { int i=45, c; c = check(i); printf("%d n", c); return 0; } int check(int ch) { if(ch >= 45) return 100; else return 10; } |
| A. | 100 |
| B. | 10 |
| C. | 1 |
| D. | 0 |
| Answer» B. 10 | |
| 250. |
If int is 2 bytes wide.What will be the output of the program? #include <stdio.h> void fun(char**); int main() { char *argv[] = {"ab", "cd", "ef", "gh"}; fun(argv); return 0; } void fun(char **p) { char *t; t = (p+= sizeof(int))[-1]; printf("%s n", t); } |
| A. | ab |
| B. | cd |
| C. | ef |
| D. | gh |
| Answer» C. ef | |