Vidyalelo
C Programming · all questions

Standard Library Functions
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

250

Questions

11/13

Page

Pick an option on a question to see the right answer and solution.

What is returned by the function if the space cannot be allocated by the function malloc(), realloc() and calloc()?

Select an option to see the answer and solution.

The following C code results in an error. State whether true or false.
#include<stdio.h>
#include<time.h>
int main()
{
    struct tm *local;
    time_t t;
    t=time(NULL);
    local=asctime(localtime(&t));
    printf("%d",local->tm_wday);
    return 0;
}

Select an option to see the answer and solution.

RAND_MAX macro is the maximum value returned by the rand function.

Select an option to see the answer and solution.

What will be the output of the following C code?
char word[20 ] = "1.234555 WELCOME"; 
char *w; double dis; 
dis= strtod(word, &w); 
printf("The number is %lf\n", dis); 
printf("String  is |%s|", w);

Select an option to see the answer and solution.

Which function returns the arc sine in the range [-pi/2, +pi/2] radians?

Select an option to see the answer and solution.

If the result underflow, the function returns zero.

Select an option to see the answer and solution.

Which of the following header file defines one function longjmp(), and one variable type jmp_buf?

Select an option to see the answer and solution.

The mbstowcs() function is used to return the number of array elements modified, not including a terminating zero code, if any.

Select an option to see the answer and solution.

longjmp() function is the only function defined under the header file setjmp.h?

Select an option to see the answer and solution.

void assert(int expression) when the expression is evaluated to true?

Select an option to see the answer and solution.

What will be the output of the following C code?
#include <stdio.h>
#include <limits.h>
int main() 
{
    printf("The minimum value of LONG = %lf\n", LONG_MIN);
    return 0;
}

Select an option to see the answer and solution.

What is returned by the function localeconv()?

Select an option to see the answer and solution.

What will be the output of the following C code if the system time is 4:27 PM?
#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,"%H %p %M minutes",ptr);
    puts(str);
    return 0;
}

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

Which macro retrieves the next argument in the parameter list of the function with type type?

Select an option to see the answer and solution.

Which header file should be included if a function has to be defined such that it can accept variable number of arguments?

Select an option to see the answer and solution.

The function computes the exponential function of x.

Select an option to see the answer and solution.

The macro void assert(int expression) allows the diagnostic information to be written in which of the following files?

Select an option to see the answer and solution.

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.

Select an option to see the answer and solution.

Is this right explanation to the given code?
void *calloc(size_t n, size_t size) 
#n -- This is the number of elements to be allocated.
#size -- This is the size of elements.

Select an option to see the answer and solution.