InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 51. |
What will fopen will return, if there is any error while opening a file?(a) Nothing(b) EOF(c) NULL(d) Depends on compilerThis question was addressed to me during an online interview.The doubt is from File Access topic in chapter Input and Output in C of C |
|
Answer» The CORRECT ANSWER is (C) NULL |
|
| 52. |
Which of the following is the right declaration for fgets() inside the library?(a) int *fgets(char *line, int maxline, FILE *fp);(b) char *fgets(char *line, int maxline, FILE *fp);(c) char *fgets(char *line, FILE *fp);(d) int *fgets(char *line, FILE *fp);This question was posed to me during an interview.My question is taken from Line Input & Output in section Input and Output in C of C |
|
Answer» The correct choice is (b) char *FGETS(char *LINE, INT maxline, FILE *fp); |
|
| 53. |
fputs() adds newline character.(a) True(b) False(c) Depends on the standard(d) Undefined behaviourThis question was posed to me in an international level competition.My enquiry is from Line Input & Output in division Input and Output in C of C |
| Answer» | |
| 54. |
The______function reads atmost one less than the number of characters specified by size from the given stream and it is stored in the string str.(a) fget()(b) fgets()(c) fput()(d) fputs()This question was posed to me during an interview for a job.Query is from File Operations in division Input and Output in C of C |
|
Answer» Right option is (b) fgets() |
|
| 55. |
What is the return type of rand() function?(a) short(b) int(c) long(d) doubleI got this question during an internship interview.This intriguing question comes from Random Number Generation in division Input and Output in C of C |
|
Answer» CORRECT CHOICE is (B) int To EXPLAIN: NONE. |
|
| 56. |
Which pre-defined function returns a pointer to the last occurence of a character in a string?(a) strchr(s, c);(b) strrchr(s, c);(c) strlchr(s, c);(d) strfchr(s, c);I have been asked this question in examination.My question is from String Operations topic in section Input and Output in C of C |
|
Answer» The CORRECT CHOICE is (b) strrchr(s, c); |
|
| 57. |
Which of the following statement is true?(a) The symbolic constant EOF is defined in (b) The value is -1(c) The symbolic constant EOF is defined in & value is -1(d) Only value is -1I had been asked this question in unit test.This key question is from Standard Input & Output topic in division Input and Output in C of C |
|
Answer» The correct OPTION is (C) The symbolic constant EOF is defined in |
|
| 58. |
________is used to define the type and the interpretation of the value of the corresponding argument.(a) precision(b) specifiers(c) flags(d) decimalThe question was asked during an interview.This interesting question is from printf topic in division Input and Output in C of C |
|
Answer» Correct option is (b) specifiers |
|
| 59. |
The parameter control string in the printf () is a C String that contains text to be __________(a) taken from a standard output device(b) written on to the standard output device(c) received from the standard output device(d) nothing can be saidI got this question in exam.This key question is from printf in portion Input and Output in C of C |
|
Answer» Correct answer is (B) written on to the STANDARD output device |
|
| 60. |
Which of the following mathematical function requires 2 parameter for successful function call?(a) fmod();(b) div();(c) atan2();(d) all of the mentionedThe question was posed to me in an interview.My question is from Mathematical Functions in chapter Input and Output in C of C |
|
Answer» The CORRECT OPTION is (d) all of the mentioned |
|
| 61. |
log(x) function defined in math.h header file is __________(a) Natural base logarithm(b) Logarithm to the base 2(c) Logarithm to the base 10(d) None of the mentionedThis question was posed to me in homework.My doubt stems from Mathematical Functions in section Input and Output in C of C |
|
Answer» The correct choice is (a) Natural BASE logarithm |
|
| 62. |
gets() function checks overflow run.(a) True(b) False(c) Depends on the standard(d) Undefined behaviourThis question was addressed to me in an interview for job.I'm obligated to ask this question of Line Input & Output topic in portion Input and Output in C of C |
|
Answer» The CORRECT ANSWER is (B) False |
|
| 63. |
Which of the following mode argument is used to truncate?(a) a(b) f(c) w(d) tThis question was addressed to me in an international level competition.Question is from File Access topic in portion Input and Output in C of C |
| Answer» | |
| 64. |
Which of the following doesn’t require an & for the input in scanf()?(a) char name[10];(b) int name[10];(c) float name[10];(d) all of the mentionedI had been asked this question in exam.My doubt is from Formatted Input in division Input and Output in C of C |
|
Answer» Right CHOICE is (a) char name[10]; |
|
| 65. |
setvbuf() and setbuf() function controls buffering for the stream.(a) true(b) falseI have been asked this question during an internship interview.The above asked question is from File Operations in section Input and Output in C of C |
|
Answer» RIGHT option is (a) true Easy explanation - setvbuf() and setbuf() controls BUFFERING for the STREAM. If BUFF is NULL, buffering is turned off for the stream. |
|
| 66. |
EOF is an integer type defined in stdio. hand has a value ____________(a) 1(b) 0(c) NULL(d) – 1I have been asked this question at a job interview.I need to ask this question from File Operations in chapter Input and Output in C of C |
|
Answer» RIGHT CHOICE is (d) – 1 The explanation: EOF is an INTEGER TYPE defined in stdio. hand has a value– 1. |
|
| 67. |
rand() and srand() functions are used _____________(a) To find sqrt(b) For and operations(c) For or operations(d) To generate random numbersThe question was asked in semester exam.My question is from Random Number Generation in portion Input and Output in C of C |
|
Answer» RIGHT CHOICE is (d) To GENERATE random numbers Best explanation: None. |
|
| 68. |
Which character of pushback is guaranteed per file?(a) True(b) False(c) Depends on the compiler(d) Depends on the platformThe question was posed to me by my school teacher while I was bunking the class.My question is taken from Ungetc topic in portion Input and Output in C of C |
|
Answer» The CORRECT OPTION is (a) True |
|
| 69. |
puts() function adds newline character.(a) True(b) False(c) Depends on the standard(d) Undefined behaviourI got this question during an internship interview.This intriguing question originated from Line Input & Output topic in chapter Input and Output in C of C |
|
Answer» RIGHT OPTION is (a) True To EXPLAIN: NONE. |
|
| 70. |
How many characters for pushback is guaranteed per file while using ungetc(c, fp);?(a) Only 1 character(b) Characters within 1 word(c) Characters within 1st new-line(d) All characters upto NULL characterThis question was posed to me during an internship interview.This question is from Ungetc in portion Input and Output in C of C |
|
Answer» CORRECT ANSWER is (a) Only 1 character The EXPLANATION: NONE. |
|
| 71. |
Which of the following library function is not case-sensitive?(a) toupper()(b) tolower()(c) isdigit()(d) all of the mentionedThe question was asked during an interview for a job.The query is from Character Class Testing & Conversions in section Input and Output in C of C |
|
Answer» RIGHT OPTION is (c) isdigit() Best EXPLANATION: NONE. |
|
| 72. |
What is the use of getchar()?(a) The next input character each time it is called(b) EOF when it encounters end of file(c) The next input character each time it is called EOF when it encounters end of file(d) None of the mentionedThe question was asked in an interview for internship.This interesting question is from Standard Input & Output in section Input and Output in C of C |
|
Answer» The correct ANSWER is (c) The next input character each time it is called EOF when it ENCOUNTERS END of file |
|
| 73. |
What is the function of FILE *tmpfile(void)?(a) creates a temporary file of mode “wb+”(b) creates a temporary file of mode “wb”(c) creates a temporary file of mode ” w”(d) creates a temporary file of mode “w+”I had been asked this question in an interview.My question is taken from File Operations topic in portion Input and Output in C of C |
|
Answer» Correct OPTION is (a) creates a temporary file of mode “wb+” |
|
| 74. |
What specifies the minimum number of characters to print after being padded with zeros or blank spaces?(a) flags(b) length(c) width(d) precisionI got this question in exam.The query is from printf in section Input and Output in C of C |
|
Answer» The correct choice is (C) width |
|
| 75. |
The syntax of the scanf() is scanf(“control string “, arg1,arg2,arg3,….,argn); the prototype of control string is ____________(a) [=%[width][modifiers]type=](b) [=%[modifiers][width]type=](c) [=%[width] [modifiers]](d) [width][modifiers]I have been asked this question in an online quiz.Question is taken from scanf topic in division Input and Output in C of C |
|
Answer» The correct OPTION is (a) [=%[WIDTH][modifiers]type=] |
|
| 76. |
When a C program is started, O.S environment is responsible for opening file and providing pointer for that file?(a) Standard input(b) Standard output(c) Standard error(d) All of the mentionedThe question was posed to me in an online quiz.Question is taken from File Access topic in chapter Input and Output in C of C |
|
Answer» RIGHT OPTION is (d) All of the mentioned The BEST EXPLANATION: NONE. |
|
| 77. |
Which of the following data-types are promoted when used as a parameter for an ellipsis?(a) char(b) short(c) int(d) none of the mentionedI had been asked this question in an interview for job.This intriguing question originated from Variable Length Argument in chapter Input and Output in C of C |
|
Answer» CORRECT OPTION is (a) char Explanation: NONE. |
|
| 78. |
Escape sequences are prefixed with ________(a) %(b) /(c) ”(d) None of the mentionedThe question was posed to me in semester exam.My question is based upon Formatted Output in portion Input and Output in C of C |
|
Answer» CORRECT CHOICE is (d) NONE of the mentioned The EXPLANATION is: None. |
|
| 79. |
Choose the correct description for control string %-+7.2f.(a) – means display the sign, + means left justify, 7 specifies the width and 2 specifies the precision(b) – means left justify, + means display the sign, 7 specifies the width and 2 specifies the precision(c) – means display the sign, + means left justify, 7 specifies the precision and 2 specifies the width(d) – means left justify, + means display the sign, 7 specifies the precision and 2 specifies the widthThis question was posed to me during a job interview.My enquiry is from printf topic in division Input and Output in C of C |
|
Answer» Right choice is (b) – means left justify, + means display the sign, 7 specifies the WIDTH and 2 specifies the precision |
|
| 80. |
In function free(p), p is a _______(a) int(b) pointer returned by malloc()(c) pointer returned by calloc()(d) pointer returned by malloc() & calloc()I have been asked this question by my college director while I was bunking the class.The origin of the question is Storage Management in chapter Input and Output in C of C |
|
Answer» The CORRECT choice is (d) pointer returned by MALLOC() & calloc() |
|
| 81. |
What is the default return-type of getchar()?(a) char(b) int(c) char *(d) reading character doesn’t require a return-typeI had been asked this question by my college professor while I was bunking the class.I need to ask this question from Standard Input & Output topic in chapter Input and Output in C of C |
|
Answer» The CORRECT OPTION is (B) int |
|
| 82. |
A fatal error will be generated if the format string is ended with a white space character.(a) true(b) falseThis question was addressed to me by my school teacher while I was bunking the class.Enquiry is from scanf in chapter Input and Output in C of C |
|
Answer» Correct option is (a) true |
|
| 83. |
What error will generate if the read and write parameters are not separated by commas?(a) run-time error(b) compile error(c) logical error(d) no errorThe question was posed to me by my school principal while I was bunking the class.Asked question is from scanf topic in chapter Input and Output in C of C |
|
Answer» The CORRECT option is (b) COMPILE error |
|
| 84. |
A conversion specification %7.4f means ____________(a) print a floating point value of maximum 7 digits where 4 digits are allotted for the digits after the decimal point(b) print a floating point value of maximum 4 digits where 7digits are allotted for the digits after the decimal point(c) print a floating point value of maximum 7 digits(d) print a floating point value of minimum 7 digits where 4 digits are allotted for the digits after the decimal pointI have been asked this question in an internship interview.My question is based upon printf in division Input and Output in C of C |
|
Answer» The CORRECT OPTION is (a) print a floating point VALUE of MAXIMUM 7 digits where 4 digits are allotted for the digits after the decimal point |
|
| 85. |
Which is the best way to generate numbers between 0 to 99?(a) rand()-100(b) rand()%100(c) rand(100)(d) srand(100)I had been asked this question in an international level competition.This interesting question is from Random Number Generation in portion Input and Output in C of C |
|
Answer» The CORRECT OPTION is (b) rand()%100 |
|
| 86. |
In linux, apart from including math header file, the program is successfully executed by which of the following?(a) cc filename.c(b) cc filename.c -lc(c) cc -math filename.c(d) cc -lm filename.cThe question was posed to me in a job interview.My doubt is from Mathematical Functions topic in section Input and Output in C of C |
|
Answer» The CORRECT ANSWER is (d) CC -lm filename.c |
|
| 87. |
ungetc() may be used with ________(a) scanf(b) getc(c) getchar(d) all of the mentionedThe question was posed to me during an online interview.Enquiry is from Ungetc topic in chapter Input and Output in C of C |
|
Answer» The CORRECT OPTION is (d) all of the mentioned |
|
| 88. |
Which of the following cannot be used with ungetc()?(a) scanf(b) getc(c) getchar(d) printfThis question was addressed to me in an interview for internship.I would like to ask this question from Ungetc topic in chapter Input and Output in C of C |
|
Answer» RIGHT CHOICE is (d) printf Explanation: NONE. |
|
| 89. |
In C language, FILE is of which data type?(a) int(b) char *(c) struct(d) None of the mentionedThe question was asked during an internship interview.My doubt stems from File Access in chapter Input and Output in C of C |
| Answer» | |
| 90. |
Which of the following is NOT a delimiter for an input in scanf?(a) Enter(b) Space(c) Tab(d) None of the mentionedThis question was addressed to me in class test.This intriguing question comes from Formatted Input in portion Input and Output in C of C |
|
Answer» RIGHT choice is (d) None of the mentioned To explain I WOULD SAY: None. |
|
| 91. |
The type va_list in an argument list is used ________(a) To declare a variable that will refer to each argument in turn;(b) For cleanup(c) To create a list(d) There is no such typeThe question was asked in final exam.The origin of the question is Variable Length Argument in section Input and Output in C of C |
|
Answer» The CORRECT choice is (a) To declare a VARIABLE that will refer to each ARGUMENT in TURN; |
|
| 92. |
Which header file includes a function for variable number of arguments?(a) stdlib.h(b) stdarg.h(c) ctype.h(d) both stdlib.h and stdarg.hThe question was posed to me in an interview for internship.This question is from Variable Length Argument topic in division Input and Output in C of C |
|
Answer» The CORRECT CHOICE is (B) stdarg.h |
|
| 93. |
What is the value of EOF?(a) -1(b) 0(c) 1(d) 10The question was posed to me by my school teacher while I was bunking the class.My question is taken from Standard Input & Output in section Input and Output in C of C |
|
Answer» RIGHT CHOICE is (a) -1 The BEST I can EXPLAIN: NONE. |
|
| 94. |
Which function will return the current file position for stream?(a) fgetpos()(b) fseek()(c) ftell()(d) fsetpos()I got this question in a national level competition.The above asked question is from File Operations in chapter Input and Output in C of C |
|
Answer» The correct option is (c) ftell() |
|
| 95. |
Choose the right statement for fscanf() andscanf()(a) fscanf() can read from standard input whereas scanf() specifies a stream from which to read(b) fscanf() can specifies a stream from which to read whereas scanf() can read only from standard input(c) fscanf() and scanf() has no difference in their functions(d) fscanf() and scanf() can read from specified streamI had been asked this question in examination.I want to ask this question from File Operations topic in division Input and Output in C of C |
|
Answer» CORRECT option is (b) fscanf() can SPECIFIES a stream from which to read whereas scanf() can read only from standard input Explanation: The fscanf() is similar to the scanf() function, except that the FIRST ARGUMENT of fscanf() specifies a stream from which to read whereas scanf() can read from standard input. |
|
| 96. |
For floating point numbers, the precision flag specifies the number of decimal places to be printed. When no precision modifier is specified, printf() prints _______(a) six decimal positions(b) five decimal positions(c) four decimal positions(d) three decimal positionsThe question was asked in a national level competition.Question is from printf topic in portion Input and Output in C of C |
|
Answer» Correct ANSWER is (a) six decimal positions |
|
| 97. |
What happens when zero flag is used with left justification?(a) data is padded with zeros(b) zero flag is ignored(c) data is padded with blank spaces(d) will give errorThis question was posed to me by my college professor while I was bunking the class.My doubt is from printf in section Input and Output in C of C |
|
Answer» The correct choice is (b) zero flag is ignored |
|
| 98. |
What will cos(x) return?(a) sine of x where x is in radians(b) sine of x where x is in degree(c) cosine of x where x is in radians(d) cosine of x where x is in degreeThis question was posed to me in my homework.Query is from Mathematical Functions topic in portion Input and Output in C of C |
|
Answer» The CORRECT ANSWER is (C) cosine of X where x is in radians |
|
| 99. |
What type of return-type used in String operations?(a) void only(b) void and (char *) only(c) void and int only(d) void, int and (char *) onlyThe question was asked by my school principal while I was bunking the class.This key question is from String Operations topic in chapter Input and Output in C of C |
|
Answer» The CORRECT CHOICE is (d) VOID, INT and (char *) only |
|
| 100. |
Which of the following causes an error?(a) Trying to read a file that doesn’t exist(b) Inability to write data in a file(c) Failure to allocate memory with the help of malloc(d) All of the mentionedI had been asked this question in an online interview.Asked question is from Error Handling topic in section Input and Output in C of C |
|
Answer» The CORRECT ANSWER is (d) All of the mentioned |
|