InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
fgetc, getc, getchar are all declared in ________(a) stdio. h(b) ctype. h(c) assert. h(d) stdarg. hI got this question in an interview.Origin of the question is Character Handling in chapter String Operations in C of C |
|
Answer» RIGHT answer is (a) stdio. h Explanation: The FUNCTIONS getc, fgetc, getchar are all declared in stdio.h HEADER FILE. |
|
| 2. |
Which function returns true only for the characters defined as lowercase letters?(a) islow()(b) islower()(c) isalpa()(d) isalnum()The question was asked in an internship interview.My doubt stems from Character Handling topic in division String Operations in C of C |
|
Answer» Right choice is (b) islower() |
|
| 3. |
What is the function of strcoll()?(a) compares the string, result is dependent on the LC_COLLATE(b) copies the string, result is dependent on the LC_COLLATE(c) compares the string, result is not dependent on the LC_COLLATE(d) copies the string, result is not dependent on the LC_COLLATEI have been asked this question in an interview for job.My question is taken from String Operations in division String Operations in C of C |
|
Answer» RIGHT choice is (a) compares the string, RESULT is DEPENDENT on the LC_COLLATE Easiest explanation - The strcoll() FUNCTION compares the string s1 to the string s2, both interpreted as appropriate to the LC_COLLATE CATEGORY of the current locale. |
|
| 4. |
ERANGE is reported on an overflow or an underflow.(a) true(b) falseThe question was asked in a national level competition.This intriguing question originated from Error Handling in chapter String Operations in C of C |
|
Answer» The correct ANSWER is (a) true |
|
| 5. |
What occurs when a result has nowhere near the number of significant digits indicated by its type.(a) domain(b) underflow(c) overflow(d) significance lossI got this question in a job interview.Question is taken from Error Handling in chapter String Operations in C of C |
|
Answer» RIGHT answer is (d) significance loss The explanation: A significance loss OCCURS when a result has NOWHERE near the number of significant DIGITS indicated by its type. |
|
| 6. |
The C library function checks whether the passed character is printable.(a) isgraph()(b) isalpha()(c) isprint()(d) ispunct()The question was posed to me in an interview.I'd like to ask this question from Character Handling topic in portion String Operations in C of C |
|
Answer» Right ANSWER is (c) isprint() |
|
| 7. |
The________function converts an uppercase letter to the corresponding lowercase letter.(a) islower()(b) isupper()(c) toupper()(d) tolower()The question was asked by my school teacher while I was bunking the class.I want to ask this question from Character Handling topic in chapter String Operations in C of C |
|
Answer» Right choice is (d) tolower() |
|
| 8. |
The______function returns a pointer to the first character of a token.(a) strstr()(b) strcpy()(c) strspn()(d) strtok()The question was asked during an internship interview.My question is taken from String Operations in section String Operations in C of C |
|
Answer» CORRECT ANSWER is (d) strtok() The EXPLANATION: The strtok() function returns a pointer to the first character of a TOKEN, if there is no token then a null pointer is returned. |
|
| 9. |
Which function will you choose to join two words?(a) strcpy()(b) strcat()(c) strncon()(d) memcon()The question was posed to me in an interview for internship.My enquiry is from String Operations topic in section String Operations in C of C |
|
Answer» The CORRECT CHOICE is (b) strcat() |
|
| 10. |
The mem functions are meant for _______(a) returning a pointer to the token(b) manipulating objects as character arrays(c) returning a pointer for implemented-defined string(d) returning a pointer to first occurrence of string in another stringI got this question in exam.This key question is from String Operations topic in division String Operations in C of C |
|
Answer» The correct OPTION is (b) manipulating OBJECTS as CHARACTER ARRAYS |
|
| 11. |
Which code from the given option return pointer to last occurrence of c in ch or NULL if not present?(a) char *strchr(ch, c)(b) char *strrchr(ch, c)(c) char *strncat(ch, c)(d) char *strcat(ch, c)The question was posed to me in homework.Query is from String Operations topic in division String Operations in C of C |
|
Answer» Right option is (b) CHAR *strrchr(ch, c) |
|
| 12. |
Which of the following is the right syntax to copy n characters from the object pointed to by s2 into the object pointed to by s1?(a) void *memcpy(void *s1,const void *s2,size_t n);(b) void *memcpy(void*s2, const void *s1, size_t n);(c) void memcpy(void*s1,const void *s2, size_t n);(d) void memcpy(void *s2,const void *s1,size_t n);This question was posed to me during an interview.Query is from String Operations topic in section String Operations in C of C |
|
Answer» The correct ANSWER is (a) void *memcpy(void *s1,const void *s2,size_t N); |
|
| 13. |
This function offers the quickest way to determine whether two character sequences of the same known length match character for the character up to and including any null character in both.(a) strcmp()(b) memcmp()(c) strncmp()(d) no such functionThis question was addressed to me during an internship interview.The origin of the question is String Operations topic in division String Operations in C of C |
|
Answer» Correct answer is (c) strncmp() |
|
| 14. |
The C library function _________ breaks string s1 into a series of tokens using the delimiter s2.(a) char *strtok(char *s1,const char *s2);(b) char*strtok(char *s2,const char *s1);(c) char *strstr(char *s1,const char *s2);(d) char *strstr(char *s2,const char *s1);The question was asked in a national level competition.I would like to ask this question from String Operations in section String Operations in C of C |
|
Answer» CORRECT choice is (a) char *strtok(char *s1,const char *s2); EXPLANATION: The C LIBRARY function char *strtok(char *s1, const char *s2) breaks string s1 into a SERIES of tokens using the delimiter s2. |
|
| 15. |
What is the use of function char *strchr(ch, c)?(a) return pointer to first occurrence of ch in c or NULL if not present(b) return pointer to first occurrence of c in ch or NULL if not present(c) return pointer to first occurrence of ch in c or ignores if not present(d) return pointer to first occurrence of cin ch or ignores if not presentThis question was addressed to me by my college professor while I was bunking the class.This key question is from String Operations topic in division String Operations in C of C |
|
Answer» The CORRECT option is (b) RETURN pointer to first occurrence of c in ch or NULL if not PRESENT |
|
| 16. |
Which among the following is Copying function?(a) memcpy()(b) strcopy()(c) memcopy()(d) strxcpy()The question was posed to me in an interview.The question is from String Operations topic in section String Operations in C of C |
|
Answer» The CORRECT CHOICE is (a) memcpy() |
|
| 17. |
The ______ function appends not more than n characters.(a) strcat()(b) strcon()(c) strncat()(d) memcat()I have been asked this question in semester exam.Query is from String Operations topic in division String Operations in C of C |
|
Answer» The CORRECT choice is (C) strncat() |
|
| 18. |
What is the function of void *memset(s, c, n)?(a) places character s into first n characters of c, return c(b) places character c into first n characters of s, return s(c) places character s into first n characters of c, return s(d) places character c into first n character of s, return cThis question was posed to me in homework.I'm obligated to ask this question of String Operations topic in chapter String Operations in C of C |
|
Answer» Correct answer is (b) PLACES character c into first N CHARACTERS of s, return s |
|
| 19. |
What will strcmp() function do?(a) compares the first n characters of the object(b) compares the string(c) undefined function(d) copies the stringThis question was addressed to me by my school teacher while I was bunking the class.I need to ask this question from String Operations topic in portion String Operations in C of C |
|
Answer» Right ANSWER is (b) compares the STRING |
|
| 20. |
The______function tests for any character for which isalpha or isdigit is true.(a) isxdigit()(b) isspace()(c) isalnum()(d) isupper()The question was posed to me in class test.Query is from Character Handling topic in portion String Operations in C of C |
|
Answer» The correct option is (C) isalnum() |
|
| 21. |
Which among the given options compares atmost n characters of string ch to string s?(a) int strncmp(ch, s, n)(b) int strcmp(ch, s)(c) int strncmp(s, ch, n)(d) int strcmp(s, ch)The question was posed to me in unit test.This interesting question is from String Operations topic in section String Operations in C of C |
|
Answer» Correct choice is (a) int strncmp(CH, s, n) |
|
| 22. |
errno causes trouble in two subtler ways(vague and explicit).(a) true(b) falseThis question was addressed to me during an interview.This intriguing question originated from Error Handling in section String Operations in C of C |
|
Answer» Right answer is (a) true |
|
| 23. |
______ is reported on a domain error.(a) EDOM(b) ERANGE(c) Significance loss(d) UnderflowI have been asked this question during an interview.I would like to ask this question from Error Handling topic in portion String Operations in C of C |
|
Answer» The CORRECT ANSWER is (a) EDOM |
|
| 24. |
isalpha() function is used to detect characters both in uppercase and lowercase.(a) true(b) falseI had been asked this question in an online interview.This question is from Character Handling in chapter String Operations in C of C |
|
Answer» CORRECT option is (a) true Explanation: ISALPHA() function is used to test for letters in the local alphabet. For the locale, the local alphabet CONSISTS of26 ENGLISH letters, in each of two CASES. |
|
| 25. |
The toupper() function converts a ______ to the corresponding ______(a) uppercase, lowercase(b) lowercase, uppercase(c) binary, decimal(d) decimal, binaryI had been asked this question in unit test.This is a very interesting question from Character Handling in portion String Operations in C of C |
|
Answer» Correct choice is (b) lowercase, UPPERCASE |
|
| 26. |
The strpbrk() function is used to return a pointer to the character, or a null pointer if no character from s2 occurs in s1.(a) true(b) falseI had been asked this question in examination.The doubt is from String Operations in portion String Operations in C of C |
|
Answer» The CORRECT option is (a) true |
|
| 27. |
Which function tests for any character that is an uppercase letter.(a) iscntrl()(b) ispunct()(c) isdigit()(d) isupper()This question was addressed to me in semester exam.Question is from Character Handling topic in division String Operations in C of C |
|
Answer» Correct choice is (d) isupper() |
|
| 28. |
Is there any function declared as strstr()?(a) true(b) falseI had been asked this question in an interview.Asked question is from String Operations topic in portion String Operations in C of C |
|
Answer» Correct answer is (a) true |
|
| 29. |
No library function will store a zero in errno.(a) true(b) falseThis question was posed to me in an interview.My question is based upon Error Handling topic in division String Operations in C of C |
|
Answer» Correct answer is (a) true |
|
| 30. |
This function checks whether the passed character is white-space.(a) ispunct()(b) isgraph()(c) isspace()(d) isalpha()The question was asked during a job interview.This intriguing question originated from Character Handling topic in section String Operations in C of C |
|
Answer» The CORRECT CHOICE is (c) isspace() |
|
| 31. |
Which of the given function is used to return a pointer to the located character?(a) strrchr()(b) strxfrm()(c) memchar()(d) strchar()I had been asked this question by my school principal while I was bunking the class.I need to ask this question from String Operations in division String Operations in C of C |
|
Answer» Correct ANSWER is (d) strchar() |
|
| 32. |
What is the prototype of strcoll() function?(a) int strcoll(const char *s1,const char *s2)(b) int strcoll(const char *s1)(c) int strcoll(const *s1,const *s2)(d) int strcoll(const *s1)This question was addressed to me during an interview.I'd like to ask this question from String Operations in chapter String Operations in C of C |
|
Answer» The CORRECT OPTION is (a) int strcoll(const char *S1,const char *s2) |
|
| 33. |
Which among the given options is the right explanation for the statement size_t strcspn(c, s)?(a) return length of prefix of s consisting of characters not in c(b) return length of prefix of s consisting of characters present in c(c) return length of prefix of c consisting of characters not in s(d) return length of prefix of c consisting of characters present in sThis question was posed to me in quiz.This interesting question is from String Operations topic in section String Operations in C of C |
|
Answer» Correct CHOICE is (c) return length of PREFIX of c consisting of characters not in s |
|
| 34. |
There are two groups of string functions defined in the header . What are they?(a) first group names beginning with str; second group names beginningwith mem(b) first group names beginning with str; second group names beginning with is(c) first group names beginning with string; second group names beginning with mem(d) first group names beginning with str; second group names beginning with typeThe question was asked in a national level competition.This interesting question is from String Operations in portion String Operations in C of C |
|
Answer» The CORRECT choice is (a) FIRST group names beginning with str; SECOND group names beginningwith mem |
|
| 35. |
What error occurs when a result is undefined for a given argument value?(a) significance loss(b) underflow(c) overflow(d) domainThe question was asked during an interview.My question comes from Error Handling topic in chapter String Operations in C of C |
|
Answer» Correct answer is (d) domain |
|
| 36. |
The isdigit function tests for any decimal-digit character.(a) true(b) falseThe question was asked during an interview.I would like to ask this question from Character Handling in portion String Operations in C of C |
|
Answer» Correct answer is (a) true |
|
| 37. |
Functions whose names begin with “strn”(a) manipulates sequences of arbitrary characters(b) manipulates null-terminated sequences of characters(c) manipulates sequence of non – null characters.(d) returns a pointer to the tokenThis question was addressed to me in an interview.The origin of the question is String Operations topic in division String Operations in C of C |
|
Answer» Right OPTION is (c) manipulates sequence of non – NULL characters. |
|
| 38. |
What is the return value of strxfrm()?(a) length of the transformed string, not including the terminating null-character(b) length of the transformed string, including the terminating null-character(c) display the transformed string, not including the terminating null character(d) display the transformed string, not including the terminating null-characterThis question was addressed to me in a job interview.The above asked question is from String Operations topic in division String Operations in C of C |
|
Answer» Correct option is (a) length of the transformed string, not INCLUDING the TERMINATING null-character |
|
| 39. |
Use_______to determine the null-terminated message string that corresponds to the error code errcode.(a) strerror()(b) strstr()(c) strxfrm()(d) memset()I have been asked this question at a job interview.I'm obligated to ask this question of String Operations topic in chapter String Operations in C of C |
|
Answer» Correct CHOICE is (a) strerror() |
|
| 40. |
The function strsp() is the complement of strcspn().(a) true(b) falseI got this question in homework.This interesting question is from String Operations topic in section String Operations in C of C |
|
Answer» The correct option is (a) true |
|
| 41. |
which of the following function returns a pointer to the located string or a null pointer if string is not found.(a) strtok()(b) strstr()(c) strspn()(d) strrchr()I got this question in my homework.This intriguing question originated from String Operations in division String Operations in C of C |
|
Answer» Right option is (b) strstr() |
|
| 42. |
Which of the following is the variable type defined in header string. h?(a) sizet(b) size(c) size_t(d) size-tThis question was addressed to me during an online exam.My question is taken from String Operations in division String Operations in C of C |
|
Answer» Right ANSWER is (c) size_t |
|
| 43. |
_______ occurs when a result is too large in magnitude to represent errors as a floating-point value of the required type.(a) underflow(b) significance loss(c) domain(d) overflowThis question was posed to me during an interview.Question is from Error Handling topic in division String Operations in C of C |
|
Answer» The CORRECT answer is (d) overflow |
|
| 44. |
Which header declares several functions useful for testing and mapping characters?(a) assert.h(b) stdio.h(c) ctype.h(d) errno.hThis question was posed to me by my college director while I was bunking the class.Enquiry is from Character Handling topic in portion String Operations in C of C |
|
Answer» CORRECT ANSWER is (c) ctype.h Easiest explanation - The HEADER |
|