

MCQOPTIONS
Saved Bookmarks
This section includes 391 Mcqs, each offering curated multiple-choice questions to sharpen your C Programming knowledge and support exam preparation. Choose a topic below to get started.
351. |
What will be the output for the given code printf('\n The number is %07d',1212); |
A. | The number is 0001212 |
B. | The number is 1212 |
C. | The number is 1212 |
D. | The number is 1212000 |
Answer» B. The number is 1212 | |
352. |
What will be the output of the program ?
#include
|
A. | agpur |
B. | gpur |
C. | Nagp |
D. | agpu |
Answer» E. | |
353. |
What will be the output of the program ?
#include
|
A. | Print the contents of file "myfile.c" |
B. | Print the contents of file "myfile.c" upto NULL character |
C. | Infinite loop |
D. | Error in program |
Answer» D. Error in program | |
354. |
What will be the output of the program if value 25 given to scanf()?
#include
|
A. | 25 |
B. | 2 |
C. | 1 |
D. | 5 |
Answer» D. 5 | |
355. |
What will be the output of the program ?
#include
|
A. | %%%%% |
B. | %% |
C. | No output |
D. | Error |
Answer» C. No output | |
356. |
What will be the output of the program ?
#include
|
A. | This is IndiaBIX |
B. | This is |
C. | Infinite loop |
D. | Error |
Answer» D. Error | |
357. |
What will be the output of the program ?
#include
|
A. | 21 |
B. | 23 |
C. | Error |
D. | No output |
Answer» C. Error | |
358. |
We should not read after a write to a file without an intervening call to fflush(), fseek() or rewind() |
A. | 1 |
B. | |
Answer» B. | |
359. |
Point out the error in the program?
#include
|
A. | Error: suspicious char to in conversion in scanf() |
B. | Error: we may not get input for second scanf() statement |
C. | No error |
D. | None of above |
Answer» C. No error | |
360. |
In a call to printf() function the format specifier %b can be used to print binary equivalent of an integer. |
A. | 1 |
B. | |
Answer» C. | |
361. |
If the file 'source.txt' contains a line "Be my friend" which of the following will be the output of below program?
#include
|
A. | friend |
B. | frien |
C. | end |
D. | Error in fseek(); |
Answer» D. Error in fseek(); | |
362. |
Point out the error in the program?
#include
|
A. | No error, No output. |
B. | Program crashes at run time. |
C. | Output: Unable to open file. |
D. | None of above |
Answer» D. None of above | |
363. |
Point out the error in the program?
#include
|
A. | Error: unrecognised Keyword SEEK_SET |
B. | Error: fseek() long offset value |
C. | No error |
D. | None of above |
Answer» C. No error | |
364. |
A file written in text mode can be read back in binary mode. |
A. | Yes |
B. | No |
Answer» C. | |
365. |
What will be the output of the program ?
#include
|
A. | 1250 |
B. | 2 |
C. | 50 |
D. | 250 |
Answer» E. | |
366. |
Consider the following program and what will be content of t?
#include
|
A. | size of "DUMMY.C" file |
B. | The handle associated with "DUMMY.C" file |
C. | Garbage value |
D. | Error in fileno() |
Answer» C. Garbage value | |
367. |
Which of the following statement is correct about the program?
#include
|
A. | The code writes a text to a file |
B. | The code reads a text files and display its content in reverse order |
C. | The code writes a text to a file in reverse order |
D. | None of above |
Answer» C. The code writes a text to a file in reverse order | |
368. |
Out of fgets() and gets() which function is safe to use? |
A. | gets() |
B. | fgets() |
Answer» C. | |
369. |
To scan a and b given below, which of the following scanf() statement will you use?
#include
|
A. | scanf("%f %f", &a, &b); |
B. | scanf("%Lf %Lf", &a, &b); |
C. | scanf("%f %Lf", &a, &b); |
D. | scanf("%f %lf", &a, &b); |
Answer» E. | |
370. |
What will be the output of the program ?
#include
|
A. | A |
B. | B |
C. | C |
D. | D |
Answer» C. C | |
371. |
Offset used in fseek() function call can be a negative number. |
A. | 1 |
B. | |
Answer» B. | |
372. |
On executing the below program what will be the contents of 'target.txt' file if the source file contains a line "To err is human"?
#include
|
A. | r n |
B. | Trh |
C. | err |
D. | None of above |
Answer» C. err | |
373. |
Can we specify a variable filed width in a scanf() format string? |
A. | Yes |
B. | No |
Answer» C. | |
374. |
What will be the output of the program ?
#include
|
A. | k == 1 is TRUE |
B. | 1 == 1 is TRUE |
C. | 1 == 1 is FALSE |
D. | K == 1 is FALSE |
Answer» C. 1 == 1 is FALSE | |
375. |
What will be the output of the program ?
#include
|
A. | char *str = "char *str = %c%s%c; main(){ printf(str, 34, str, 34);}"; main(){ printf(str, 34, str, 34);} |
B. | char *str = %c%s%c; main(){ printf(str, 34, str, 34);} |
C. | No output |
D. | Error in program |
Answer» B. char *str = %c%s%c; main(){ printf(str, 34, str, 34);} | |
376. |
What will be the output of the program ?
#include
|
A. | 3 |
B. | 3.15 |
C. | 3.2 |
D. | 3 |
Answer» D. 3 | |
377. |
A text stream is an ordered sequence of characters composed into lines, each line consisting of zero or more characters plus a terminating new-line character. |
A. | 1 |
B. | |
Answer» B. | |
378. |
Point out the correct statements about the program?
#include
|
A. | The code copies the content of one file to another |
B. | The code writes strings that are read from the keyboard into a file. |
C. | The code reads a file |
D. | None of above |
Answer» C. The code reads a file | |
379. |
Point out the error/warning in the program?
#include
|
A. | Error: in unsigned char declaration |
B. | Error: while statement |
C. | No error |
D. | It prints all characters in file "trial" |
Answer» B. Error: while statement | |
380. |
Will the following program work?
#include
|
A. | Yes |
B. | No |
Answer» B. No | |
381. |
stderr, stdin, stdout are FILE pointers |
A. | Yes |
B. | No |
C. | Yes |
D. | No |
Answer» B. No | |
382. |
Which of the following operations can be performed on the file "NOTES.TXT" using the below code? FILE *fp; fp = fopen("NOTES.TXT", "r+"); |
A. | Reading |
B. | Writing |
C. | Appending |
D. | Read and Write |
Answer» E. | |
383. |
Point out the error in the program?
#include
|
A. | Error: in unsigned char statement |
B. | Error: unknown file pointer |
C. | No error |
D. | None of above |
Answer» D. None of above | |
384. |
What is the purpose of "rb" in fopen() function used below in the code? FILE *fp; fp = fopen("source.txt", "rb"); |
A. | open "source.txt" in binary mode for reading |
B. | open "source.txt" in binary mode for reading and writing |
C. | Create a new file "source.txt" for reading and writing |
D. | None of above |
Answer» B. open "source.txt" in binary mode for reading and writing | |
385. |
While calling the fprintf() function in the format string conversion specifier %s can be used to write a character string in capital letters. |
A. | 1 |
B. | |
C. | 1 |
D. | |
Answer» C. 1 | |
386. |
What does fp point to in the program ?
#include
|
A. | The first character in the file |
B. | A structure which contains a char pointer which points to the first character of a file. |
C. | The name of the file. |
D. | The last character in the file. |
Answer» C. The name of the file. | |
387. |
What will be the content of 'file.c' after executing the following program?
#include
|
A. | B |
B. | AB |
C. | BB |
D. | Error in opening file 'file1.c' |
Answer» B. AB | |
388. |
Which of the following statement is correct about the program?
#include
|
A. | The code counts number of characters in the file |
B. | The code counts number of words in the file |
C. | The code counts number of blank lines in the file |
D. | The code counts number of lines in the file |
Answer» E. | |
389. |
Which files will get closed through the fclose() in the following program?
#include
|
A. | "A.C" "B.C" "C.C" |
B. | "B.C" "C.C" |
C. | "A.C" |
D. | Error in fclose() |
Answer» E. | |
390. |
To print out a and b given below, which of the following printf() statement will you use?
#include
|
A. | printf("%f %lf", a, b); |
B. | printf("%Lf %f", a, b); |
C. | printf("%Lf %Lf", a, b); |
D. | printf("%f %Lf", a, b); |
Answer» B. printf("%Lf %f", a, b); | |
391. |
In a file contains the line "I am a boy\r\n" then on reading this line into the array str using fgets(). What will str contain? |
A. | "I am a boy\r\n\0" |
B. | "I am a boy\r\0" |
C. | "I am a boy\n\0" |
D. | "I am a boy" |
Answer» D. "I am a boy" | |