Strings
- Which pre-defined function returns a pointer to the last occurence of a character in a string?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
strrchr(s, c);
- String operation such as strcat(s, t), strcmp(s, t), strcpy(s, t) and strlen(s) heavily rely upon.
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
Presence of NULL character
- What type of return-type used in String operations?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
void, int and (char *) only
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
char *s = "Interview, Mania";
char s1[20] = "hello Interview Mania";
strcpy(s, s1);
printf("%s", s1);
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
Segmentation fault
- What will be the output of the following C code?
#include <stdio.h>
#include <string.h>
int main()
{
char *s = "hello, Interview, Mania";
char s1[25];
strncpy(s1, s, 25);
printf("%s %d", s1, strlen(s1));
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
hello, Interview, Mania 23