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.
| 351. |
What will be the output of the program? #include<stdio.h> 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; } |
| A. | x and y are equal |
| B. | x and y are not equal |
| C. | Unpredictable |
| D. | No output |
| Answer» B. x and y are not equal | |
| 352. |
What will be the output of the program ? #include<stdio.h> #include<string.h> int main() { static char s[] = "Hello!"; printf("%d n", *(s+strlen(s))); return 0; } |
| A. | 8 |
| B. | 0 |
| C. | 16 |
| D. | Error |
| Answer» C. 16 | |
| 353. |
What will be the output of the program ? #include<stdio.h> int main() { static char s[25] = "The cocaine man"; int i=0; char ch; ch = s[++i]; printf("%c", ch); ch = s[i++]; printf("%c", ch); ch = i++[s]; printf("%c", ch); ch = ++i[s]; printf("%c", ch); return 0; } |
| A. | hhe! |
| B. | he c |
| C. | The c |
| D. | Hhec |
| Answer» B. he c | |
| 354. |
What will be the output of the program in 16-bit platform (Turbo C under DOS) ? #include<stdio.h> int main() { printf("%d, %d, %d", sizeof(3.0f), sizeof('3'), sizeof(3.0)); return 0; } |
| A. | 8, 1, 4 |
| B. | 4, 2, 8 |
| C. | 4, 2, 4 |
| D. | 10, 3, 4 |
| Answer» C. 4, 2, 4 | |
| 355. |
What will be the output of the program ? #include<stdio.h> int main() { int i; char a[] = " 0"; if(printf("%s", a)) printf("The string is empty n"); else printf("The string is not empty n"); return 0; } |
| A. | The string is empty |
| B. | The string is not empty |
| C. | No output |
| D. | 0 |
| Answer» C. No output | |
| 356. |
What will be the output of the program If characters 'a', 'b' and 'c' enter are supplied as input? #include<stdio.h> int main() { void fun(); fun(); printf(" n"); return 0; } void fun() { char c; if((c = getchar())!= ' n') fun(); printf("%c", c); } |
| A. | abc abc |
| B. | bca |
| C. | Infinite loop |
| D. | cba |
| Answer» E. | |
| 357. |
What will be the output of the program ? #include<stdio.h> int main() { printf("India", "BIX n"); return 0; } |
| A. | Error |
| B. | India BIX |
| C. | India |
| D. | BIX |
| Answer» D. BIX | |
| 358. |
What will be the output of the program ? #include<stdio.h> int main() { char *names[] = { "Suresh", "Siva", "Sona", "Baiju", "Ritu"}; int i; char *t; t = names[3]; names[3] = names[4]; names[4] = t; for(i=0; i<=4; i++) printf("%s,", names[i]); return 0; } |
| A. | Suresh, Siva, Sona, Baiju, Ritu |
| B. | Suresh, Siva, Sona, Ritu, Baiju |
| C. | Suresh, Siva, Baiju, Sona, Ritu |
| D. | Suresh, Siva, Ritu, Sona, Baiju |
| Answer» C. Suresh, Siva, Baiju, Sona, Ritu | |
| 359. |
What will be the output of the program ? #include<stdio.h> #include<string.h> int main() { char str[] = "India 0 BIX 0"; printf("%d n", strlen(str)); return 0; } |
| A. | 10 |
| B. | 6 |
| C. | 5 |
| D. | 11 |
| Answer» D. 11 | |
| 360. |
What will be the output of the program ? #include<stdio.h> int main() { char str[7] = "IndiaBIX"; printf("%s n", str); return 0; } |
| A. | Error |
| B. | IndiaBIX |
| C. | Cannot predict |
| D. | None of above |
| Answer» D. None of above | |
| 361. |
Will the expression *p = p be disallowed by the compiler? |
| A. | Yes |
| B. | No |
| Answer» C. | |
| 362. |
Every operator has an Associativity |
| A. | Yes |
| B. | No |
| Answer» B. No | |
| 363. |
The expression of the right hand side of || operators doesn't get evaluated if the left hand side determines the outcome. |
| A. | True |
| B. | False |
| Answer» B. False | |
| 364. |
Two different operators would always have different Associativity. |
| A. | Yes |
| B. | No |
| Answer» C. | |
| 365. |
If char=1, int=4, and float=4 bytes size, What will be the output of the program ? #include<stdio.h> int main() { char ch = 'A'; printf("%d, %d, %d", sizeof(ch), sizeof('A'), sizeof(3.14f)); return 0; } |
| A. | 1, 2, 4 |
| B. | 1, 4, 4 |
| C. | 2, 2, 4 |
| D. | 2, 4, 8 |
| Answer» C. 2, 2, 4 | |
| 366. |
What will be the output of the program ? #include<stdio.h> int main() { char str[] = "India 0BIX 0"; printf("%d n", sizeof(str)); return 0; } |
| A. | 10 |
| B. | 6 |
| C. | 5 |
| D. | 11 |
| Answer» E. | |
| 367. |
What will be the output of the program ? #include<stdio.h> int main() { static char mess[6][30] = {"Don't walk in front of me...", "I may not follow;", "Don't walk behind me...", "Just walk beside me...", "And be my friend." }; printf("%c, %c n", *(mess[2]+9), *(*(mess+2)+9)); return 0; } |
| A. | t, t |
| B. | k, k |
| C. | n, k |
| D. | m, f |
| Answer» C. n, k | |
| 368. |
In the expression a=b=5 the order of Assignment is NOT decided by Associativity of operators |
| A. | True |
| B. | False |
| Answer» C. | |
| 369. |
Associativity of an operator is either Left to Right or Right to Left. |
| A. | True |
| B. | False |
| Answer» B. False | |
| 370. |
Bitwise & can be used to check if a bit in number is set or not. |
| A. | True |
| B. | False |
| Answer» B. False | |
| 371. |
If the following structure is written to a file using fwrite(), can fread() read it back successfully? struct emp { char *n; int age; }; struct emp e={"IndiaBIX", 15}; FILE *fp; fwrite(&e, sizeof(e), 1, fp); |
| A. | Yes |
| B. | No |
| Answer» C. | |
| 372. |
size of union is size of the longest element in the union |
| A. | Yes |
| B. | No |
| Answer» B. No | |
| 373. |
The elements of union are always accessed using & operator |
| A. | Yes |
| B. | No |
| Answer» C. | |
| 374. |
Which of the following statements are correct about the program below? #include<stdio.h> int main() { char str[20], *s; printf("Enter a string n"); scanf("%s", str); s=str; while(*s != ' 0') { if(*s >= 97 && *s &lt= 122) *s = *s-32; s++; } printf("%s",str); return 0; } |
| A. | The code converts a string in to an integer |
| B. | The code converts lower case character to upper case |
| C. | The code converts upper case character to lower case |
| D. | Error in code |
| Answer» C. The code converts upper case character to lower case | |
| 375. |
Which of the following statements are correct about the below declarations? char *p = "Sanjay";char a[] = "Sanjay"; 1: There is no difference in the declarations and both serve the same purpose. 2: p is a non-const pointer pointing to a non-const string, whereas a is a const pointer pointing to a non-const pointer. 3: The pointer p can be modified to point to another string, whereas the individual characters within array a can be changed. 4: In both cases the ' 0' will be added at the end of the string "Sanjay". |
| A. | 1, 2 |
| B. | 2, 3, 4 |
| C. | 3, 4 |
| D. | 2, 3 |
| Answer» C. 3, 4 | |
| 376. |
Which of the following statements are correct ? 1: A string is a collection of characters terminated by ' 0'. 2: The format specifier %s is used to print a string. 3: The length of the string can be obtained by strlen(). 4: The pointer CANNOT work on string. |
| A. | 1, 2 |
| B. | 1, 2, 3 |
| C. | 2, 4 |
| D. | 3, 4 |
| Answer» C. 2, 4 | |
| 377. |
What will be the output of the program ? #include<stdio.h> #include<string.h> int main() { printf("%d n", strlen("123456")); return 0; } |
| A. | 6 |
| B. | 12 |
| C. | 7 |
| D. | 2 |
| Answer» B. 12 | |
| 378. |
Union elements can be of different sizes. |
| A. | True |
| B. | False |
| Answer» B. False | |
| 379. |
A structure can contain similar or dissimilar elements |
| A. | True |
| B. | False |
| Answer» B. False | |
| 380. |
The '->' operator can be used to access structures elements using a pointer to a structure variable only |
| A. | True |
| B. | False |
| Answer» B. False | |
| 381. |
What will be the output of the program ? #include<stdio.h> int main() { printf(5+"Good Morning n"); return 0; } |
| A. | Good Morning |
| B. | Good |
| C. | M |
| D. | Morning |
| Answer» E. | |
| 382. |
Point out the error in the program? #include<stdio.h> int main() { struct bits { float f:2; }bit; printf("%d n", sizeof(bit)); return 0; } |
| A. | 4 |
| B. | 2 |
| C. | Error: cannot set bit field for |
| D. | <i class="C-code">float</i> |
| E. | Error: Invalid member access in structure |
| Answer» D. <i class="C-code">float</i> | |
| 383. |
Point out the error in the program? #include<stdio.h> int main() { struct emp { char name[25]; int age; float bs; }; struct emp e; e.name = "Suresh"; e.age = 25; printf("%s %d n", e.name, e.age); return 0; } |
| A. | Error: Lvalue required/incompatible types in assignment |
| B. | Error: invalid constant expression |
| C. | Error: Rvalue required |
| D. | No error, Output: Suresh 25 |
| Answer» B. Error: invalid constant expression | |
| 384. |
Point out the error in the program in 16-bit platform? #include<stdio.h> int main() { struct bits { int i:40; }bit; printf("%d n", sizeof(bit)); return 0; } |
| A. | 4 |
| B. | 2 |
| C. | Error: Bit field too large |
| D. | Error: Invalid member access in structure |
| Answer» D. Error: Invalid member access in structure | |
| 385. |
What will be the output of the program (sample.c) given below if it is executed from the command line? cmd> sample friday tuesday sunday /* sample.c */ #include<stdio.h> int main(int argc, char *argv[]) { printf("%c", **++argv); return 0; } |
| A. | s |
| B. | f |
| C. | sample |
| D. | friday |
| Answer» C. sample | |
| 386. |
The preprocessor can trap simple errors like missing declarations, nested comments or mismatch of braces. |
| A. | True |
| B. | False |
| Answer» C. | |
| 387. |
What will be the output of the program if it is executed like below? cmd> sample /* sample.c */ #include<stdio.h> int main(int argc, char **argv) { printf("%s n", argv[argc-1]); return 0; } |
| A. | 0 |
| B. | sample |
| C. | samp |
| D. | No output |
| Answer» C. samp | |
| 388. |
What will be the output of the program (sample.c) given below if it is executed from the command line? cmd> sample one two three /* sample.c */ #include<stdio.h> int main(int argc, char *argv[]) { int i=0; i+=strlen(argv[1]); while(i>0) { printf("%c", argv[1][--i]); } return 0; } |
| A. | three two one |
| B. | owt |
| C. | eno |
| D. | eerht |
| Answer» D. eerht | |
| 389. |
What will be the output of the program (sample.c) given below if it is executed from the command line? cmd> sample 1 2 3 cmd> sample 2 2 3 cmd> sample 3 2 3 /* sample.c */ #include<stdio.h> int main(int argc, char *argv[]) { printf("%s n", argv[0]); return 0; } |
| A. | sample 3 2 3 |
| B. | sample 1 2 3 |
| C. | sample |
| D. | Error |
| Answer» D. Error | |
| 390. |
A preprocessor directive is a message from compiler to a linker. |
| A. | True |
| B. | False |
| Answer» C. | |
| 391. |
Once preprocessing is over and the program is sent for the compilation the macros are removed from the expanded source code. |
| A. | True |
| B. | False |
| Answer» B. False | |
| 392. |
What will be the output of the program (myprog.c) given below if it is executed from the command line? cmd> myprog 1 2 3 /* myprog.c */ #include<stdio.h> #include<stdlib.h> int main(int argc, char **argv) { int i, j=0; for(i=0; i<argc; i++) j = j+atoi(argv[i]); printf("%d n", j); return 0; } |
| A. | 123 |
| B. | 6 |
| C. | Error |
| D. | "123" |
| Answer» C. Error | |
| 393. |
What will be the output of the program (sample.c) given below if it is executed from the command line? cmd> sample friday tuesday sunday /* sample.c */ #include<stdio.h> int main(int sizeofargv, char *argv[]) { while(sizeofargv) printf("%s", argv[--sizeofargv]); return 0; } |
| A. | sample friday tuesday sunday |
| B. | sample friday tuesday |
| C. | sunday tuesday friday sample |
| D. | sunday tuesday friday |
| Answer» D. sunday tuesday friday | |
| 394. |
What will be the output of the program (sample.c) given below if it is executed from the command line? cmd> sample friday tuesday sunday /* sample.c */ #include<stdio.h> int main(int argc, char *argv[]) { printf("%c", *++argv[2] ); return 0; } |
| A. | s |
| B. | f |
| C. | u |
| D. | r |
| Answer» D. r | |
| 395. |
What will be the output of the program (myprog.c) given below if it is executed from the command line? cmd> myprog 10 20 30 /* myprog.c */ #include<stdio.h> int main(int argc, char **argv) { int i; for(i=0; i<argc; i++) printf("%s n", argv[i]); return 0; } |
| A. | 10 20 30 |
| B. | myprog 10 20 |
| C. | myprog 10 20 30 |
| D. | 10 20 |
| Answer» D. 10 20 | |
| 396. |
What will be the output of the program (sample.c) given below if it is executed from the command line? cmd> sample "*.c" /* sample.c */ #include<stdio.h> int main(int argc, int *argv) { int i; for(i=1; i<argc; i++) printf("%s n", argv[i]); return 0; } |
| A. | *.c |
| B. | "*.c" |
| C. | sample *.c |
| D. | List of all files and folders in the current directory |
| Answer» B. "*.c" | |
| 397. |
What will be the output of the program (sample.c) given below if it is executed from the command line? cmd> sample monday tuesday wednesday thursday /* sample.c */ #include<stdio.h> int main(int argc, char *argv[]) { while(--argc>0) printf("%s", *++argv); return 0; } |
| A. | sample monday tuesday wednesday thursday |
| B. | monday tuesday wednesday thursday |
| C. | monday tuesday thursday |
| D. | tuesday |
| Answer» C. monday tuesday thursday | |
| 398. |
If the following program (myproc.c) is present in the directory "C: TC" then what will be output of the program if run it from DOS shell? /* myproc.c */ #include<stdio.h> int main(int argc, char *argv[]) { printf("%s", argv[0]); return 0; } |
| A. | SAMPLE.C |
| B. | C: TC MYPROC.EXE |
| C. | C: TC |
| D. | Error |
| Answer» C. C: TC | |
| 399. |
What will be the output of the program in Turbo C? #include<stdio.h> int main(int argc, char *argv, char *env[]) { int i; for(i=1; i<argc; i++) printf("%s n", env[i]); return 0; } |
| A. | List of all environment variables |
| B. | List of all command-line arguments |
| C. | count of command-line arguments |
| D. | Error: cannot have more than two arguments in |
| E. | <i class="C-code">main()</i> |
| Answer» B. List of all command-line arguments | |
| 400. |
What will be the output of the program (myprog.c) given below if it is executed from the command line? cmd> myprog one two three /* myprog.c */ #include<stdio.h> int main(int argc, char *argv[]) { int i; for(i=1; i<argc; i++) printf("%c", argv[i][0]); return 0; } |
| A. | oot |
| B. | ott |
| C. | nwh |
| D. | eoe |
| Answer» C. nwh | |