C- Library Functions MCQ Questions and Answers
Practice ModeShowing 10 of 29 questions
Q11
Which function is used to convert a string to uppercase in C?
Answer: Option C
Explanation: strupr() function converts all lowercase letters in a string to uppercase.
Q12
What does the malloc() function do in C?
Answer: Option A
Explanation: malloc() allocates memory dynamically on the heap.
Q13
Which function is used to compare two strings in C?
Answer: Option C
Explanation: strcmp() compares two strings and returns 0 if they are equal.
Q14
Which header file contains mathematical functions like sqrt() and pow()?
Answer: Option B
Explanation: math.h header contains mathematical functions.
Q15
What does the printf() function return?
Answer: Option B
Explanation: printf() returns the number of characters printed.
Q16
Which function is used to open a file in C?
Answer: Option B
Explanation: fopen() is used to open files in C.
Q17
What does the strlen() function return?
Answer: Option B
Explanation: strlen() returns the length of string excluding null character.
Q18
Which function is used to copy one string to another?
Answer: Option B
Explanation: strcpy() copies source string to destination string.
Q19
What is the purpose of free() function?
Answer: Option B
Explanation: free() deallocates memory allocated by malloc/calloc.
Q20
Which function is used to read a character from file?
Answer: Option B
Explanation: fgetc() reads a character from file stream.