Top

Strings

71.

What will be the output of the following C code?

#include 
    #include 
    int main()
    {
        char *str = "hello, world";
        char str1[9];
        strncpy(str1, str, 9);
        printf("%s %d", str1, strlen(str1));
    }

 

Answer: C

No answer description available for this question.
 

Enter details here

72.

What will be the output of the following C code?

#include 
    int main()
    {
        char str[11] = "hello";
        char *str1 = "world";
        strcat(str, str1);
        printf("%s %d", str, str[10]);
    }

 

Answer: A

No answer description available for this question.
 

Enter details here

73.

Which function will you choose to join two words?

Answer: B

The strcat() function is used for concatenating two strings, appends a copy of the string.
char *strcat(char *s1,const char *s2);

Enter details here

74.

What will be the output of the program ?

#include

int main()
{
    char str[7] = "IndiaBIX";
    printf("%s\n", str);
    return 0;
}

 

Answer: C

No answer description available for this question.

Enter details here

Answer: A

In the C library function memcpy() is used to copy n characters from memory area src to memory area dest.

Enter details here

76.

What will be the output of the following C code?

#include 
    int main()
    {
        char str[10] = "hello";
        char *str1 = "world";
        strncat(str, str1, 9);
        printf("%s", str);
    }

 

Answer: A

No answer description available for this question.

Enter details here

77.

If char=1, int=4, and float=4 bytes size, What will be the output of the program ?

#include

int main()
{
    char ch = 'A';
    printf("%d, %d, %d", sizeof(ch), sizeof('A'), sizeof(3.14f));
    return 0;
}

 

Answer: B

No answer description available for this question.

Enter details here

78.

What will be the output of the program ?

#include
#include

int main()
{
    char str[] = "India\0\BIX\0";
    printf("%s\n", str);
    return 0;
}

 

Answer: B

No answer description available for this question.

Enter details here

Answer: A

The prototype of strcoll() function is int strcoll(const char *s1,const char *s2).

Enter details here

80.

NULL is the macro defined in the header string. h.

Answer: A

NULL macro is the value of a null pointer constant.

Enter details here

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