Standard Library Functions — Part 2 MCQs with Explanations
Practice high-yield Programming & Software Development MCQs on Standard Library Functions — Part 2 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 line from the given code is the passive form? #undef assert #ifdef NDEBUG #define assert (test) ( (void) 0) #else #define assert (test) #endif
Correct Answer: Option B — #define assert(test) ((void)0)
Detailed Academic Explanation:
#define assert(test) ((void)0) is the correct answer to “Which line from the given code is the passive form? #undef assert #ifdef NDEBUG #define assert (test) ( (void) 0) #else #define assert (test) #endif”. 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
. . . . . . . . defines the minimum value for a short integer.
Correct Answer: Option B — SHRT_MIN
Detailed Academic Explanation:
SHRT_MIN is the correct answer to “. . . . . . . . defines the minimum value for a short integer.”. 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
The . . . . . . . . function converts the initial portion of the string pointed to by, to int representation.
Correct Answer: Option B — atoi()
Detailed Academic Explanation:
atoi() is the correct answer to “The . . . . . . . . function converts the initial portion of the string pointed to by, to int representation.”. 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
The ldexp() function multiplies a floating-point number by an integral power of 2.
Correct Answer: Option A — true
Detailed Academic Explanation:
true is the correct answer to “The ldexp() function multiplies a floating-point number by an integral power of 2.”. 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
setjmp takes a jmp_buf type and different other type variables as input.
Correct Answer: Option B — false
Detailed Academic Explanation:
false is the correct answer to “setjmp takes a jmp_buf type and different other type variables as input.”. 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
What is the name of the function that is used to convert multibyte character to wide character?
Correct Answer: Option B — mbtowc()
Detailed Academic Explanation:
mbtowc() is the correct answer to “What is the name of the function that is used to convert multibyte character to wide character”. 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
The header file assert.h of the C Standard Library defines . . . . . . . . macro.
Correct Answer: Option D — assert
Detailed Academic Explanation:
assert is the correct answer to “The header file assert.h of the C Standard Library defines . . . . . . . . macro.”. 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
The macro offset expands to a constant of type . . . . . . . .
Correct Answer: Option A — size_t
Detailed Academic Explanation:
size_t is the correct answer to “The macro offset expands to a constant of type . . . . . . . .”. 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
LC_COLLATE affects strcoll() and strxfrm() functions.
Correct Answer: Option A — true
Detailed Academic Explanation:
true is the correct answer to “LC_COLLATE affects strcoll() and strxfrm() functions.”. 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
What will be the output of the following C code? double x=1.8; printf("%.2lf",floor(x));
Correct Answer: Option D — 1.00
Detailed Academic Explanation:
1.00 is the correct answer to “What will be the output of the following C code? double x=1.8; printf("%.2lf",floor(x));”. 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
Which of the following is not defined under the header file stddef.h?
Correct Answer: Option C — exp_t
Detailed Academic Explanation:
exp_t is the correct answer to “Which of the following is not defined under the header file stddef.h”. 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 of the following library functions is used to read location dependent information?
Correct Answer: Option B — localeconv()
Detailed Academic Explanation:
localeconv() is the correct answer to “Which of the following library functions is used to read location dependent information”. 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
The function computes the hyperbolic cosine of x.
Correct Answer: Option C — cosh(x)
Detailed Academic Explanation:
cosh(x) is the correct answer to “The function computes the hyperbolic cosine of x.”. 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
What will be the output of the following C code? double log (double -x);
Correct Answer: Option C — domain error
Detailed Academic Explanation:
domain error is the correct answer to “What will be the output of the following C code? double log (double -x);”. 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 will be the output of the following C code? (By date we mean: date, month and year) #include<stdio.h> #include<stdlib.h> #include<time.h> int main() { time_t ct; time(&ct); printf("%s\n",ctime(&ct)); }
Correct Answer: Option C — current date, current time and the day of the week
Detailed Academic Explanation:
current date, current time and the day of the week is the correct answer to “What will be the output of the following C code? (By date we mean: date, month and year) #include<stdio.h> #include<stdlib.h> #include<time.h> int main() { time_t ct; time(&ct); printf("%s\n",ctime(&ct)); }”. 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
What will be the output of the following C code? char str[20]; str= "123546"; res= atof(str); printf("String value = %s, Float value = %f\n", str, res);
Correct Answer: Option B — String value = 123546 , Float value = 123546.000000
Detailed Academic Explanation:
String value = 123546 , Float value = 123546.000000 is the correct answer to “What will be the output of the following C code? char str[20]; str= "123546"; res= atof(str); printf("String value = %s, Float value = %f\n", str, res);”. 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
The C library function . . . . . . . . function converts the wide character to its multibyte representation.
Correct Answer: Option D — wctomb()
Detailed Academic Explanation:
wctomb() is the correct answer to “The C library function . . . . . . . . function converts the wide character to its multibyte representation.”. 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
A domain error occurs if x is negative and y is not an integral value for the function pow(double x, double y).
Correct Answer: Option A — true
Detailed Academic Explanation:
true is the correct answer to “A domain error occurs if x is negative and y is not an integral value for the function pow(double x, double y).”. 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
Which statement is correct work reference to endptr? double strtod(const char *nptr, char **endptr);
Correct Answer: Option B — A pointer to the ?nal string is stored in the object pointed to by endptr, provided that endptr is not a null pointer
Detailed Academic Explanation:
A pointer to the ?nal string is stored in the object pointed to by endptr, provided that endptr is not a null pointer is the correct answer to “Which statement is correct work reference to endptr? double strtod(const char *nptr, char **endptr);”. 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
Which of the following is the correct syntax of the function strtoul()?
Correct Answer: Option A — unsigned long int strtoul(const char *n, char **ptr, int base)
Detailed Academic Explanation:
unsigned long int strtoul(const char *n, char **ptr, int base) is the correct answer to “Which of the following is the correct syntax of the function strtoul()”. 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
A less common use of setjmp.h is to create syntax similar to . . . . . . . .
Correct Answer: Option C — coroutines
Detailed Academic Explanation:
coroutines is the correct answer to “A less common use of setjmp.h is to create syntax similar to . . . . . . . .”. 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
What will be the output of the following C code? double x=1.2 printf("%.1lf", ceil(x));
Correct Answer: Option D — 2.0
Detailed Academic Explanation:
2.0 is the correct answer to “What will be the output of the following C code? double x=1.2 printf("%.1lf", ceil(x));”. 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
Which of the given function differs from the statement'errno is not neccessarily set on conversion error'?
Correct Answer: Option D — strtod()
Detailed Academic Explanation:
strtod() is the correct answer to “Which of the given function differs from the statement'errno is not neccessarily set on conversion error'”. 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
The macro MB_LEN_MAX is used to find . . . . . . . .
Correct Answer: Option A — Maximum number of bytes in a multi-byte character
Detailed Academic Explanation:
Maximum number of bytes in a multi-byte character is the correct answer to “The macro MB_LEN_MAX is used to find . . . . . . . .”. 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
Which function is called by macro assert to terminate the execution?
Correct Answer: Option C — abort()
Detailed Academic Explanation:
abort() is the correct answer to “Which function is called by macro assert to terminate the execution”. 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
What will be the output of the following C code, if the system date is 6/24/2017? #include<stdio.h> #include<stdlib.h> #include<time.h> int main() { time_t ct; time(&ct); printf("%s\n",(&ct)); }
Correct Answer: Option B — Junk value
Detailed Academic Explanation:
Junk value is the correct answer to “What will be the output of the following C code, if the system date is 6/24/2017? #include<stdio.h> #include<stdlib.h> #include<time.h> int main() { time_t ct; time(&ct); printf("%s\n",(&ct)); }”. 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
The macro which is used to find the maximum value of an unsigned integer is . . . . . . . .
Correct Answer: Option C — UINT_MAX
Detailed Academic Explanation:
UINT_MAX is the correct answer to “The macro which is used to find the maximum value of an unsigned integer is . . . . . . . .”. 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
Which of the given statement is not true with respect to void longjmp( jmp-buf env, int val)?
Correct Answer: Option B — env is the object containing information to restore the environment at the jmp_buf's calling point
Detailed Academic Explanation:
env is the object containing information to restore the environment at the jmp_buf's calling point is the correct answer to “Which of the given statement is not true with respect to void longjmp( jmp-buf env, int val)”. 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
void free(void *p) performs which of the following functions?
Correct Answer: Option B — de-allocates space to which p points
Detailed Academic Explanation:
de-allocates space to which p points is the correct answer to “void free(void *p) performs which of the following functions”. 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
atol(const char *str) Converts the string pointed to, by the argument str.
Correct Answer: Option A — to a long integer
Detailed Academic Explanation:
to a long integer is the correct answer to “atol(const char *str) Converts the string pointed to, by the argument str.”. 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
How many macros are defined in the header file stdarg.h?
Correct Answer: Option C — three
Detailed Academic Explanation:
three is the correct answer to “How many macros are defined in the header file stdarg.h”. 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
The pointer used in the mblen() function points to the . . . . . . . .
Correct Answer: Option A — first byte of multibyte character
Detailed Academic Explanation:
first byte of multibyte character is the correct answer to “The pointer used in the mblen() function points to the . . . . . . . .”. 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 is the role of the given C function? void va_end(va_list ap)
Correct Answer: Option A — allows a function with variable arguments which used the va_start macro to return
Detailed Academic Explanation:
allows a function with variable arguments which used the va_start macro to return is the correct answer to “What is the role of the given C function? void va_end(va_list ap)”. 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
The . . . . . . . . macro shall be invoked before any access to the unnamed arguments.
Correct Answer: Option D — va_start
Detailed Academic Explanation:
va_start is the correct answer to “The . . . . . . . . macro shall be invoked before any access to the unnamed arguments.”. 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
Correct code to turn assertions OFF at various places throughout a source file is . . . . . . . .
Correct Answer: Option B — #define NDEBUG #include
Detailed Academic Explanation:
#define NDEBUG #include is the correct answer to “Correct code to turn assertions OFF at various places throughout a source file is . . . . . . . .”. 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 among the given function does not return a value?
Correct Answer: Option D — srand()
Detailed Academic Explanation:
srand() is the correct answer to “Which among the given function does not return a value”. 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
What will the code display on compiling? void funccall() { printf("this is funccall\n"); } void main () { atexit(funccall); printf("program starts\n"); printf("program ends\n"); }
Correct Answer: Option C — program starts program ends this is funccall
Detailed Academic Explanation:
program starts program ends this is funccall is the correct answer to “What will the code display on compiling? void funccall() { printf("this is funccall\n"); } void main () { atexit(funccall); printf("program starts\n"); printf("program ends\n"); }”. 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
What will be the output of the following C code if the system time is 1:52 PM (Sunday)? #include<stdio.h> #include<time.h> int main() { struct tm *ptr; time_t t; char str[100]; t = time(NULL); ptr = localtime(&t); strftime(str,100,"%I",ptr); puts(str); return 0; }
Correct Answer: Option B — 01
Detailed Academic Explanation:
01 is the correct answer to “What will be the output of the following C code if the system time is 1:52 PM (Sunday)? #include<stdio.h> #include<time.h> int main() { struct tm *ptr; time_t t; char str[100]; t = time(NULL); ptr = localtime(&t); strftime(str,100,"%I",ptr); puts(str); return 0; }”. 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
The macro definition of INT_MIN is . . . . . . . .
Correct Answer: Option A — -INT_MAX - 1
Detailed Academic Explanation:
-INT_MAX - 1 is the correct answer to “The macro definition of INT_MIN is . . . . . . . .”. 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 of the following is defined under the header file time.h?
Correct Answer: Option D — null
Detailed Academic Explanation:
null is the correct answer to “Which of the following is defined under the header file time.h”. 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.