Standard Library Functions — Part 1 MCQs with Explanations
Practice high-yield Programming & Software Development MCQs on Standard Library Functions — Part 1 with worked academic solutions for FPSC, PPSC, NTS, NITB, PTS.
Questions
40
Difficulty Level
Exam-Level
Target Exams
FPSC, PPSC, NTS...
Estimated Time
48 mins
Exam-Level FPSC PPSC NTS NITB PTS
Verified for Commission Syllabus • Oct 14, 2026
40
Verified Practice Questions
Interactive test mode with detailed academic worked solutions
Live Progress|0/40 answered
✓0 correct
✗0 wrong
0% score
🎉 Set complete! All 40 questions answered.
Question 1 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which standard library function is used to calculate the length of a string in C?
Correct Answer: Option A — strlen()
Detailed Academic Explanation:
strlen() is the correct answer to “Which standard library function is used to calculate the length of a string in C”. This question is standard in competitive examination syllabi for Standard Library Functions.
💡Key Conceptual Anchor:Standard Library Functions
Question 2 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the 'printf' function in C?
Correct Answer: Option A — To print formatted text to the standard output
Detailed Academic Explanation:
To print formatted text to the standard output is the correct answer to “What is the purpose of the 'printf' function in C”. This question is standard in competitive examination syllabi for Standard Library Functions.
💡Key Conceptual Anchor:Standard Library Functions
Question 3 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which library should be included to use the 'sqrt' function in C?
Correct Answer: Option A — math.h
Detailed Academic Explanation:
math.h is the correct answer to “Which library should be included to use the 'sqrt' function in C”. This question is standard in competitive examination syllabi for Standard Library Functions.
💡Key Conceptual Anchor:Standard Library Functions
Question 4 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What does the 'strcmp' function in C do?
Correct Answer: Option A — Compares two strings and returns an integer indicating their relationship
Detailed Academic Explanation:
Compares two strings and returns an integer indicating their relationship is the correct answer to “What does the 'strcmp' function in C do”. This question is standard in competitive examination syllabi for Standard Library Functions.
💡Key Conceptual Anchor:Standard Library Functions
Question 5 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the return value of the 'rand' function in C?
Correct Answer: Option A — A random integer
Detailed Academic Explanation:
A random integer is the correct answer to “What is the return value of the 'rand' function in C”. This question is standard in competitive examination syllabi for Standard Library Functions.
💡Key Conceptual Anchor:Standard Library Functions
Question 6 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which function is used to generate a random number in C?
Correct Answer: Option A — rand()
Detailed Academic Explanation:
rand() is the correct answer to “Which function is used to generate a random number in C”. This question is standard in competitive examination syllabi for Standard Library Functions.
💡Key Conceptual Anchor:Standard Library Functions
Question 7 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the 'atoi' function in C?
Correct Answer: Option A — Converts a string to an integer
Detailed Academic Explanation:
Converts a string to an integer is the correct answer to “What is the purpose of the 'atoi' function in C”. This question is standard in competitive examination syllabi for Standard Library Functions.
💡Key Conceptual Anchor:Standard Library Functions
Question 8 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which library should be included to use the 'sin' function in C?
Correct Answer: Option A — math.h
Detailed Academic Explanation:
math.h is the correct answer to “Which library should be included to use the 'sin' function in C”. This question is standard in competitive examination syllabi for Standard Library Functions.
💡Key Conceptual Anchor:Standard Library Functions
Question 9 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What does the 'fgets' function in C do?
Correct Answer: Option A — Reads a line of text from a file
Detailed Academic Explanation:
Reads a line of text from a file is the correct answer to “What does the 'fgets' function in C do”. This question is standard in competitive examination syllabi for Standard Library Functions.
💡Key Conceptual Anchor:Standard Library Functions
Question 10 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which function is used to open a file in C?
Correct Answer: Option A — fopen()
Detailed Academic Explanation:
fopen() is the correct answer to “Which function is used to open a file in C”. This question is standard in competitive examination syllabi for Standard Library Functions.
💡Key Conceptual Anchor:Standard Library Functions
Question 11 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the 'abs' function in C?
Correct Answer: Option A — To calculate the absolute value of an integer
Detailed Academic Explanation:
To calculate the absolute value of an integer is the correct answer to “What is the purpose of the 'abs' function in C”. This question is standard in competitive examination syllabi for Standard Library Functions.
💡Key Conceptual Anchor:Standard Library Functions
Question 12 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which standard library function is used to clear the standard input buffer in C?
Correct Answer: Option A — fflush()
Detailed Academic Explanation:
fflush() is the correct answer to “Which standard library function is used to clear the standard input buffer in C”. This question is standard in competitive examination syllabi for Standard Library Functions.
💡Key Conceptual Anchor:Standard Library Functions
Question 13 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What does the 'strcpy' function in C do?
Correct Answer: Option A — Copies one string to another
Detailed Academic Explanation:
Copies one string to another is the correct answer to “What does the 'strcpy' function in C do”. This question is standard in competitive examination syllabi for Standard Library Functions.
💡Key Conceptual Anchor:Standard Library Functions
Question 14 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which function is used to find the smallest integer greater than or equal to a given floating-point number in C?
Correct Answer: Option A — ceil()
Detailed Academic Explanation:
ceil() is the correct answer to “Which function is used to find the smallest integer greater than or equal to a given floating-point number in C”. This question is standard in competitive examination syllabi for Standard Library Functions.
💡Key Conceptual Anchor:Standard Library Functions
Question 15 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the 'strcpy' function in C?
Correct Answer: Option A — Copies one string to another
Detailed Academic Explanation:
Copies one string to another is the correct answer to “What is the purpose of the 'strcpy' function in C”. This question is standard in competitive examination syllabi for Standard Library Functions.
💡Key Conceptual Anchor:Standard Library Functions
Question 16 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which library should be included to use the 'pow' function in C?
Correct Answer: Option A — math.h
Detailed Academic Explanation:
math.h is the correct answer to “Which library should be included to use the 'pow' function in C”. This question is standard in competitive examination syllabi for Standard Library Functions.
💡Key Conceptual Anchor:Standard Library Functions
Question 17 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What does the 'strcat' function in C do?
Correct Answer: Option A — Concatenates two strings
Detailed Academic Explanation:
Concatenates two strings is the correct answer to “What does the 'strcat' function in C do”. This question is standard in competitive examination syllabi for Standard Library Functions.
💡Key Conceptual Anchor:Standard Library Functions
Question 18 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which standard library function is used to find the largest integer less than or equal to a given floating-point number in C?
Correct Answer: Option A — floor()
Detailed Academic Explanation:
floor() is the correct answer to “Which standard library function is used to find the largest integer less than or equal to a given floating-point number in C”. This question is standard in competitive examination syllabi for Standard Library Functions.
💡Key Conceptual Anchor:Standard Library Functions
Question 19 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the 'tolower' function in C?
Correct Answer: Option A — Converts a character to lowercase
Detailed Academic Explanation:
Converts a character to lowercase is the correct answer to “What is the purpose of the 'tolower' function in C”. This question is standard in competitive examination syllabi for Standard Library Functions.
💡Key Conceptual Anchor:Standard Library Functions
Question 20 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the return value of the 'getchar' function in C?
Correct Answer: Option A — The character read from the standard input
Detailed Academic Explanation:
The character read from the standard input is the correct answer to “What is the return value of the 'getchar' function in C”. This question is standard in competitive examination syllabi for Standard Library Functions.
💡Key Conceptual Anchor:Standard Library Functions
Question 21 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What does the 'getch' function in C do?
Correct Answer: Option A — Reads a character from the standard input without echoing
Detailed Academic Explanation:
Reads a character from the standard input without echoing is the correct answer to “What does the 'getch' function in C do”. This question is standard in competitive examination syllabi for Standard Library Functions.
💡Key Conceptual Anchor:Standard Library Functions
Question 22 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which function is used to find the square root of a number in C?
Correct Answer: Option A — sqrt()
Detailed Academic Explanation:
sqrt() is the correct answer to “Which function is used to find the square root of a number in C”. This question is standard in competitive examination syllabi for Standard Library Functions.
💡Key Conceptual Anchor:Standard Library Functions
Question 23 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the 'isalpha' function in C?
Correct Answer: Option A — Checks if a character is alphabetic
Detailed Academic Explanation:
Checks if a character is alphabetic is the correct answer to “What is the purpose of the 'isalpha' function in C”. This question is standard in competitive examination syllabi for Standard Library Functions.
💡Key Conceptual Anchor:Standard Library Functions
Question 24 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which standard library function is used to open a file in C?
Correct Answer: Option A — fopen()
Detailed Academic Explanation:
fopen() is the correct answer to “Which standard library function is used to open a file in C”. This question is standard in competitive examination syllabi for Standard Library Functions.
💡Key Conceptual Anchor:Standard Library Functions
Question 25 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What does the 'abs' function in C do?
Correct Answer: Option A — Calculates the absolute value of an integer
Detailed Academic Explanation:
Calculates the absolute value of an integer is the correct answer to “What does the 'abs' function in C do”. This question is standard in competitive examination syllabi for Standard Library Functions.
💡Key Conceptual Anchor:Standard Library Functions
Question 26 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
The C library macro type . . . . . . . . retrieves the next argument in the parameter list of the function with type.
Correct Answer: Option B — va_arg
Detailed Academic Explanation:
va_arg is the correct answer to “The C library macro type . . . . . . . . retrieves the next argument in the parameter list of the function with type.”. This question is standard in competitive examination syllabi for Standard Library Functions.
💡Key Conceptual Anchor:Standard Library Functions
Question 27 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? char str[20]; strcpy(str, "123456"); res = atoi(str); printf("%s %d\n", str, res);
Correct Answer: Option C — 123456 123456
Detailed Academic Explanation:
123456 123456 is the correct answer to “What will be the output of the following C code? char str[20]; strcpy(str, "123456"); res = atoi(str); printf("%s %d\n", str, res);”. This question is standard in competitive examination syllabi for Standard Library Functions.
💡Key Conceptual Anchor:Standard Library Functions
Question 28 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
MB_CUR_MAX is not defined in stdlib.h.
Correct Answer: Option B — false
Detailed Academic Explanation:
false is the correct answer to “MB_CUR_MAX is not defined in stdlib.h.”. This question is standard in competitive examination syllabi for Standard Library Functions.
💡Key Conceptual Anchor:Standard Library Functions
Question 29 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the type declared by the header file signal.h?
Correct Answer: Option A — sig_atomic_t
Detailed Academic Explanation:
sig_atomic_t is the correct answer to “What is the type declared by the header file signal.h”. This question is standard in competitive examination syllabi for Standard Library Functions.
💡Key Conceptual Anchor:Standard Library Functions
Question 30 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
The source filename and line number come from the preprocessor macros . . . . . . . . and . . . . . . . .
Correct Answer: Option A — _ _FILE_ _ and _ _LINE_ _
Detailed Academic Explanation:
_ _FILE_ _ and _ _LINE_ _ is the correct answer to “The source filename and line number come from the preprocessor macros . . . . . . . . and . . . . . . . .”. This question is standard in competitive examination syllabi for Standard Library Functions.
💡Key Conceptual Anchor:Standard Library Functions
Question 31 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will the given C code do? #include <stdlib.h> _Mbsave_Mbxlen={0}; int (mblen)(const char *s ,size_t n) { return(_Mbtowc(NULL s,n,&_Mbxlen)); }
Correct Answer: Option A — determine length of next multibyte code
Detailed Academic Explanation:
determine length of next multibyte code is the correct answer to “What will the given C code do? #include <stdlib.h> _Mbsave_Mbxlen={0}; int (mblen)(const char *s ,size_t n) { return(_Mbtowc(NULL s,n,&_Mbxlen)); }”. This question is standard in competitive examination syllabi for Standard Library Functions.
💡Key Conceptual Anchor:Standard Library Functions
Question 32 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the given statement is true with respect to the function atexit()?
Correct Answer: Option B — The atexit() function is used to return zero if the registration succeeds, nonzero if it fails
Detailed Academic Explanation:
The atexit() function is used to return zero if the registration succeeds, nonzero if it fails is the correct answer to “Which of the given statement is true with respect to the function atexit()”. This question is standard in competitive examination syllabi for Standard Library Functions.
💡Key Conceptual Anchor:Standard Library Functions
Question 33 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include <assert. h> #include <stdio . h> #include <stdlib.h> void -Assert (char *mesg) { fputs (mesg, stderr); fputs (" -- assertion failed\n" , stderr); abort () ; }
Correct Answer: Option C — prints assertion message and aborts
Detailed Academic Explanation:
prints assertion message and aborts is the correct answer to “What will be the output of the following C code? #include <assert. h> #include <stdio . h> #include <stdlib.h> void -Assert (char *mesg) { fputs (mesg, stderr); fputs (" -- assertion failed\n" , stderr); abort () ; }”. This question is standard in competitive examination syllabi for Standard Library Functions.
💡Key Conceptual Anchor:Standard Library Functions
Question 34 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which is the true statement with respect to the function longjmp()?
Correct Answer: Option A — the function where setjmp() was called has terminated, then the results are undefined
Detailed Academic Explanation:
the function where setjmp() was called has terminated, then the results are undefined is the correct answer to “Which is the true statement with respect to the function longjmp()”. This question is standard in competitive examination syllabi for Standard Library Functions.
💡Key Conceptual Anchor:Standard Library Functions
Question 35 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which among the given header file is used to handle different signals reported during program execution?
Correct Answer: Option C — signal.h
Detailed Academic Explanation:
signal.h is the correct answer to “Which among the given header file is used to handle different signals reported during program execution”. This question is standard in competitive examination syllabi for Standard Library Functions.
💡Key Conceptual Anchor:Standard Library Functions
Question 36 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the given function is used for searching?
Correct Answer: Option B — bsearch()
Detailed Academic Explanation:
bsearch() is the correct answer to “Which of the given function is used for searching”. This question is standard in competitive examination syllabi for Standard Library Functions.
💡Key Conceptual Anchor:Standard Library Functions
Question 37 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
The library function clock() returns the number of . . . . . . . . elapsed since the start of the program.
Correct Answer: Option B — clock ticks
Detailed Academic Explanation:
clock ticks is the correct answer to “The library function clock() returns the number of . . . . . . . . elapsed since the start of the program.”. This question is standard in competitive examination syllabi for Standard Library Functions.
💡Key Conceptual Anchor:Standard Library Functions
Question 38 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the given C function can be used instead of the apparent identity pointed to by y? int x=1; double y= 0.5 * (exp (x) + exp (-x));
Correct Answer: Option B — cosh(x)
Detailed Academic Explanation:
cosh(x) is the correct answer to “Which of the given C function can be used instead of the apparent identity pointed to by y? int x=1; double y= 0.5 * (exp (x) + exp (-x));”. This question is standard in competitive examination syllabi for Standard Library Functions.
💡Key Conceptual Anchor:Standard Library Functions
Question 39 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Select the right statement with reference to malloc() and calloc().
Correct Answer: Option A — malloc() does not set the memory to zero whereas calloc() sets allocated memory to zero
Detailed Academic Explanation:
malloc() does not set the memory to zero whereas calloc() sets allocated memory to zero is the correct answer to “Select the right statement with reference to malloc() and calloc().”. This question is standard in competitive examination syllabi for Standard Library Functions.
💡Key Conceptual Anchor:Standard Library Functions
Question 40 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which is the correct declaration of macro assert?
Correct Answer: Option A — void assert(int expression)
Detailed Academic Explanation:
void assert(int expression) is the correct answer to “Which is the correct declaration of macro assert”. This question is standard in competitive examination syllabi for Standard Library Functions.
💡Key Conceptual Anchor:Standard Library Functions
✓Link copied to clipboard
Continue Your Practice
Advance Html — Part 1
Master the next curriculum module with 40 exam-standard MCQs.
💡Examiner's Advisory for Programming & Software Development
In competitive commission exams (FPSC, PPSC, KPPSC, SPSC, CSS, PMS), questions are frequently phrased with distractor options designed to catch rote learners. Whenever you answer an MCQ, read the Detailed Academic Explanation and Conceptual Anchor to understand why the remaining options are incorrect.