C- Library Functions MCQ Questions and Answers
Practice ModeShowing 10 of 29 questions
Q21
What does calloc() initialize the allocated memory to?
Answer: Option B
Explanation: calloc() initializes allocated memory to zero.
Q22
Which function is used to write formatted output to string?
Answer: Option C
Explanation: sprintf() writes formatted output to a string.
Q23
What is the return type of sizeof operator?
Answer: Option C
Explanation: sizeof returns size_t which is unsigned integer type.
Q24
Which function searches for a character in a string?
Answer: Option B
Explanation: strchr() searches for first occurrence of character in string.
Q25
What does realloc() function do?
Answer: Option C
Explanation: realloc() changes size of previously allocated memory block.
Q26
Which function is used to close a file in C?
Answer: Option B
Explanation: fclose() is used to close an opened file.
Q27
What does the floor() function return?
Answer: Option B
Explanation: floor() returns largest integer less than or equal to argument.
Q28
Which function is used to concatenate two strings?
Answer: Option C
Explanation: strcat() appends source string to destination string.
Q29
What is the purpose of fflush() function?
Answer: Option B
Explanation: fflush() flushes the output buffer of a stream.