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
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
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
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
void *memcpy(void *dest, const void *src, size_t n) What does the following code do?
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
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
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
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
What is the prototype of strcoll() function?
Answer: A
The prototype of strcoll() function is int strcoll(const char *s1,const char *s2).
Enter details here
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