Here is a listing of C interview questions on “String Operations” along with answers, explanations and/or solutions:
1. The return-type used in String operations are.
a) void only
b) void and (char *) only
c) void and int only
d) void, int and (char *) only
2. String operation such as strcat(s, t), strcmp(s, t), strcpy(s, t) and strlen(s) heavily rely upon.
a) Presence of NULL character
b) Presence of new-line character
c) Presence of any escape sequence
d) None of the mentioned
3. Which pre-defined function returns a pointer to the last occurence of a character in a string?
a) strchr(s, c);
b) strrchr(s, c);
c) strlchr(s, c);
d) strfchr(s, c);
4. Which of the following function compares 2 strings with case-insensitively?
a) strcmp(s, t)
b) strcmpcase(s, t)
c) strcasecmp(s, t)
d) strchr(s, t)
5. What will be the value of var for the following?
var = strcmp(“Hello”, “World”);
d) strcmp has void return-type
6. What is the output of this C code?
char str = "hello";
char *p = strrchr(str, 'l');
d) Compilation error
Sanfoundry Global Education & Learning Series – C Programming Language.
To practice all features of C programming language, here is complete set of 1000+ Multiple Choice Questions and Answers on C.