Top

Library Functions

51.

Point out the error in the following program.

#include

int main()
{
    char str[] = "IndiaBIX";
    printf("%.#s %2s", str, str);
    return 0;
}

 

Answer: D

No answer description available for this question.

Enter details here

52.

What will be the output of the program?

#include
#include

int main()
{
    char dest[] = {97, 97, 0};
    char src[] = "aaa";
    int i;
    if((i = memcmp(dest, src, 2))==0)
        printf("Got it");
    else
        printf("Missed");
    return 0;
}

 

Answer: B

memcmp compares the first 2 bytes of the blocks dest and src as unsigned chars. So, the ASCII value of 97 is 'a'.

if((i = memcmp(dest, src, 2))==0) When comparing the array dest and src as unsigned chars, the first 2 bytes are same in both variables.so memcmp returns '0'.
Then, the if(0=0) condition is satisfied. Hence the output is "Got it".

Enter details here

53.

Point out the error in the following program.

#include

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

 

Answer: B

No answer description available for this question.

Enter details here

Answer: C

No answer description available for this question.

Enter details here

55.

MB_CUR_MAX is not defined in stdlib.h.

Answer: B

MB_CUR_MAX is defined under header file stdlib.h .
MB_CUR_MAX expands into a positive integer expression.It is the maximum number of bytes in a multibyte character present in the current locale.

Enter details here

56.

Which standard library function will you use to find the last occurrence of a character in a string in C?

Answer: D

No answer description available for this question.

Enter details here

57.

What will be the output of the program?

#include
#include

int main()
{
    char dest[] = {97, 97, 0};
    char src[] = "aaa";
    int i;
    if((i = memcmp(dest, src, 2))==0)
        printf("Got it");
    else
        printf("Missed");
    return 0;
}

 

Answer: B

No answer description available for this question.

Enter details here

58.

Input/output function prototypes and macros are defined in which header file?

Answer: C

No answer description available for this question.

Enter details here

59.

What will be the output of the program?

#include
#include<math.h>

int main()
{
    float i = 2.5;
    printf("%f, %d", floor(i), ceil(i));
    return 0;
}

 

Answer: C

No answer description available for this question.

Enter details here

60.

The _______ function sorts an array of objects

Answer: D

No answer description available for this question.

Enter details here

Loading…
Tags: Library Functions Questions and Answers || Library Functions MCQ Questions and Answers || Library Functions GK Questions and Answers || Library Functions GK MCQ Questions || Library Functions Multiple Choice Questions and Answers || Library Functions GK || GK on Library Functions || C Programming Questions and Answers || C Programming MCQ Questions and Answers || C Programming GK Questions and Answers || GK on C Programming