Explore topic-wise MCQs in Library Functions.

This section includes 88 Mcqs, each offering curated multiple-choice questions to sharpen your Library Functions knowledge and support exam preparation. Choose a topic below to get started.

1.

Select the macro that affects the information provided by localeconv function.

A. LC_ALL
B. LC_COLLATE
C. LC_NUMERIC
D. LC_CTYPE
Answer» D. LC_CTYPE
2.

What error occurs if an input argument is outside the domain over which the mathematical function is de ned?

A. domain error
B. range error
C. no error
D. domain and range error
Answer» B. range error
3.

Which of the following library functions returns the time in UTC (Greenwich mean time) format?

A. localtime()
B. gettime()
C. gmtime()
D. settime()
Answer» D. settime()
4.

The _______ macro shall be invoked before any access to the unnamed arguments.

A. va_arg
B. va_end
C. va_list
D. va_start
Answer» E.
5.

How many macros are defined in the header file stdarg.h?

A. one
B. two
C. three
D. four
Answer» D. four
6.

In the c library function void (*signal(int sig, void (*func)(int)))(int), which statement is true with respect to func?

A. func is a pointer to the function
B. func is pointer to sig
C. func is a static variable
D. func is a pointer that points to all type of data
Answer» B. func is pointer to sig
7.

Which function returns a pseudo-random integer?

A. srand()
B. rand()
C. malloc()
D. alloc()
Answer» C. malloc()
8.

Choose the right declaration of longjmp() function.

A. void longjmp(jmp_buf environment, int value)
B. void longjmp(setjmp environment, int value)
C. void longjmp(int value, jmp_buf environment)
D. void longjmp(int value, setjmp environment)
Answer» B. void longjmp(setjmp environment, int value)
9.

The _______ function sorts an array of objects

A. bsort()
B. hsort()
C. ssort()
D. qsort()
Answer» E.
10.

The macros defined under the header file limits.h are not defined under any other header file.

A. False
B. True
Answer» C.
11.

What does raise functions declared in signal.h do?

A. reports a synchronous signal
B. let's you specify handling of signals
C. reports a asynchronous signal
D. doesn't let you specify handling of signals
Answer» B. let's you specify handling of signals
12.

Which function will return the quotient and remainder on division of numerator with denominator?

A. div()
B. div_t()
C. ldiv_t()
D. labs()
Answer» B. div_t()
13.

Which macro is used in the setlocale() function?

A. LC_SET
B. FLT_RADIX 2
C. LC_MESSAGES
D. SHRT_MAX
Answer» D. SHRT_MAX
14.

The macro MB_LEN_MAX is used to find _________

A. Maximum number of bytes in a multi-byte character
B. Whether the given function is valid or not
C. The maximum time taken for the execution of a particular function
D. Maximum number of bits in a multi-byte character
Answer» B. Whether the given function is valid or not
15.

A type whose alignment requirement is at least as large as that of every data type:

A.
B. B.
C. C.
D. D.
Answer» E.
16.

The macro definition of INT_MIN is ____________

A. -INT_MAX 1
B. INT_MAX 1
C. -INT_MAX + 1
D. INT_MAX + 1
Answer» B. INT_MAX 1
17.

Which of the following functions returns a pointer to a string representing the date and time stored in a structure?

A. ctime()
B. time()
C. asctime()
D. localtime()
Answer» D. localtime()
18.

Which function is used to recombine the fraction and exponent parts of a floating-point value after you have worked on them separately?

A. frexp()
B. exp()
C. modf()
D. Idexp()
Answer» E.
19.

Which of the following library functions is used to read location dependent information?

A. localtime()
B. B.
C. C.
D. D.
Answer» C. C.
20.

HUGE_VAL macro is used when the output of the function may not be ___________

A. floating point numbers
B. integer number
C. short int
D. long int
Answer» B. integer number
21.

Which macro can be used to detect and report exceptional conditions?

A. extern
B. edom
C. assert
D. lbdl_min 1e-37
Answer» D. lbdl_min 1e-37
22.

The number of bytes contained in the multibyte character pointed to by a character is ___________

A. getenv()
B. bsearch()
C. mblen()
D. qsort()
Answer» D. qsort()
23.

The assert macro returns__________value.

A. integer
B. float
C. double
D. no
Answer» E.
24.

Which of the given function differs from the statement'errno is not neccessarily set on conversion error'?

A. atof()
B. atoi()
C. atol()
D. strtod()
Answer» E.
25.

If the result overflows, the function returns the value of the macro HUGE_VAL, carrying the same sign except for the_________ function as the correct value of the function.

A. sin
B. cos
C. cosec
D. tan
Answer» E.
26.

The macro which is used to find the maximum value of an unsigned integer is _________

A. UNINT_MAX
B. UNSINT_MAX
C. UINT_MAX
D. UNIT_MAX
Answer» D. UNIT_MAX
27.

What is returned by the function localeconv()?

A. current location value
B. past location value
C. pointer to the last location
D. pointer to the current location
Answer» E.
28.

If the result underflow, the function returns zero.

A. true
B. false
Answer» B. false
29.

sqrt(x) function is not faster than the apparent equivalent pow(x,0.5).

A. true
B. false
Answer» C.
30.

Which of the given option is declared under the header file stdlib.h?

A. SEEK_CUR
B. SEEK_END
C. CLOCKS_PER_SEC
D. EXIT_SUCCESS
Answer» E.
31.

void free(void *p) performs which of the following functions?

A. returns pointer to allocated space for existing contents of p
B. de-allocates space to which p points
C. to abnormally terminate the program
D. no such function defined in stdlib.h
Answer» C. to abnormally terminate the program
32.

Which statement is true with respect to RAND_MAX?

A. specifies value for status argument to exit indicating failure
B. specifies value for status argument to exit indicating success
C. specifies maximum value returned by rand()
D. specifies maximum value returned by srand()
Answer» D. specifies maximum value returned by srand()
33.

Initial seed is ________ for the function srand(unsigned int seed).

A. 1
B. 00
C. 01
Answer» C. 01
34.

What will the following C code do on compilation?

 void main () { char com[50]; strcpy( com, "dir" ); system(com); }

A. error
B. lists down all the files and directories in the current directory under windows machine
C. terminates the calling process immediately
D. calls specified function and terminates it at the end of the program
Answer» C. terminates the calling process immediately
35.

Point out the error in the following program.

 #include int main() { fprintf("IndiaBIX"); printf("%.ef", 2.0); return 0; }

A. Error: unknown value in printf() statement.
B. Error: in fprintf() statement.
C. No error and prints "IndiaBIX"
D. No error and prints "2.0"
Answer» C. No error and prints "IndiaBIX"
36.

Point out the error in the following program.

 #include #include int main() { char str1[] = "Learn through IndiaBIX 0.com", str2[120]; char *p; p = (char*) memccpy(str2, str1, 'i', strlen(str1)); *p = ' 0'; printf("%s", str2); return 0; }

A. Error: in memccpy statement
B. Error: invalid pointer conversion
C. Error: invalid variable declaration
D. No error and prints "Learn through Indi"
Answer» E.
37.

Can you use the fprintf() to display the output on the screen?

A. Yes
B. No
Answer» B. No
38.

What is the purpose of fflush() function.

A. flushes all streams and specified streams.
B. flushes only specified stream.
C. flushes input/output buffer.
D. flushes file buffer.
Answer» B. flushes only specified stream.
39.

Does there any function exist to convert the int or float to a string?

A. Yes
B. No
Answer» B. No
40.

What will be the output of the program?

 #include int main() { int i; i = printf("How r u n"); i = printf("%d n", i); printf("%d n", i); return 0; }

A. How r u 7 2
B. How r u 8 2
C. How r u 1 1
D. Error: cannot assign printf to variable
Answer» C. How r u 1 1
41.

What will the function randomize() do in Turbo C under DOS?

A. returns a random number
B. returns a random number generator in the specified range
C. returns a random number generator with a random value based on time
D. return a random number with a given seed value
Answer» D. return a random number with a given seed value
42.

Which of the given statement is true with respect to the function atexit()?

A. The atexit() function cannot return to its caller
B. The atexit() function is used to return zero if the registration succeeds, nonzero if it fails
C. The atexit() function returns no value
D. The atexit() function causes abnormal program termination to occur
Answer» C. The atexit() function returns no value
43.

size_t is of ______________ type.

A. signed integer
B. signed character
C. unsigned integer
D. unsigned character
Answer» D. unsigned character
44.

Which of the following macros is defined under the header limits.h?

A. FLT_ROUNDS
B. USHRT_MAX
C. DBL_MAX
D. DECIMAL_DIG
Answer» C. DBL_MAX
45.

Which statement is true regarding abs() and labs()?

A. The abs() function is similar to the labs() function, except that the argument and the returned value each of them have type long int
B.
C. C.
D. D.
Answer» B.
46.

A non-zero value is returned, if setjmp() returns from a longjmp() function call.

A. false
B. true
Answer» C.
47.

Which of the given options is an array type used for holding information?

A. longjmp
B. setjmp
C. jmp_buf
D. no such variable
Answer» D. no such variable
48.

Which of the following macros is not defined?

A. ULONG_MIN
B. LONG_MIN
C. ULONG_MAX
D. LONG_MAX
Answer» B. LONG_MIN
49.

Point out the error in the following program.

 #include int main() { fprintf("Compscibits"); printf("%.ef", 2.0); return 0; }

A. Error: unknown value in printf() statement
B. Error: in fprintf() statement
C. No error and prints "Compscibits"
D. No error and prints "2.0"
Answer» C. No error and prints "Compscibits"
50.

_______variable type defined in the header stdlib.h is an integer type of the size of a wide character constant.

A. size_t
B. wchar_t
C. div_t
D. ldiv_t
Answer» C. div_t