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

8/13

Page

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

Which of the following returns a signed integer type on finding the difference between two pointers to elements in the same array?

Select an option to see the answer and solution.

What will be the output of the following C code if the current system date is 6/22/2017?
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
int main()
{
    time_t ct;
    time(&ct);
    struct tm *mt=localtime(&ct);
    printf("%d\n",mt-> tm_date);
}

Select an option to see the answer and solution.

What will be the output of the following C code?
#include <stddef.h>
int main(void)
{
    int num[10];
    int *p1=&num[14], *p2=&num[19];
    ptrdiff_t a = p1-p2;
    printf("%d", a);
}

Select an option to see the answer and solution.

What is "a" in the given C code?
size_t wcstombs(char *s, const wchar_t *a, size_t n)

Select an option to see the answer and solution.

Given that the value of SHRT_MAX is equal to 32767 and that of SHRT_MIN is equal to -32768, What will be the output of the following C code?
#include<stdio.h>
#include<limits.h>
main()
{
    int d;
    d=SHRT_MAX + SHRT_MIN+1;
    printf("%d",d);
}

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

What will be the output of the following C code?
double x=3,y= - 6;
printf("%lf %lf", fabs(x), fabs(y));

Select an option to see the answer and solution.

Which among the given macros is defined in the header file locale.h?

Select an option to see the answer and solution.

To find the maximum value of an object of type unsigned long long int, we use the macro . . . . . . . .

Select an option to see the answer and solution.

void free(void *ptr) deallocates the memory previously allocated by a call to . . . . . . . . , . . . . . . . . or . . . . . . . .

Select an option to see the answer and solution.

What is the meaning of the following C code if output is 0?
#include<stdio.h>
#include<time.h>
int main()
{
    struct tm *local;
    time_t t;
    t=time(NULL);
    local=localtime(&t);
    printf("%d",local->tm_isdst);
    return 0;
}

Select an option to see the answer and solution.

What is the purpose of the given C code?
#include <stdlib.h> 
_Mbsave _Mbxtowc = {0};  
int (mbtowc) (wchar_t *pwc, const char *a, size_t n) 
{
return (-Mbtowc (pwc, s, n, &-Mbxtowc) ) ;
}

Select an option to see the answer and solution.

What will the following C code do on compilation?
void main () 
{
   char com[50];  
   strcpy( com, "dir" ); 
   system(com); 
}

Select an option to see the answer and solution.

What error occurs if the magnitude of x is too large in sinh(double x)?

Select an option to see the answer and solution.

What will be the output of the following C code if the current system date is 6/22/2017?
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
typedef struct tm tm;
int main()
{
    time_t ct;
    time(&ct);
    tm *mt=localtime(&ct);
    printf("%d\n",mt-> tm_year);
}

Select an option to see the answer and solution.

The cos function computes the cosine of x.

Select an option to see the answer and solution.

Which of the following format specifiers is used to represent the name of the time zone?

Select an option to see the answer and solution.

Which macro is used in the setlocale() function?

Select an option to see the answer and solution.

The value returned by the library function mktime(), on failure is . . . . . . . .

Select an option to see the answer and solution.

Which of the following functions decomposes the input string into three pans: an initial, possibly empty, sequence of white-space characters?

Select an option to see the answer and solution.