String Operations Mcqs
Our collections of Multiple choice questions and answers focuses on study of ” String Operations ” in Data Structures. These questions are chosen from a collection of most authoritative and best reference books on Data Structures. Our aim is to prepare an individual for competitive exams like NTS | GAT | ECAT | Data Warehouse jobs | Data Mining | DB administration jobs Software House and Computer Programmer jobs | University and College entrance exams and various tests and job interviews. One should practice our Mcqs to assimilate knowledge on String Operations comprehensively.
2. Pattern matching refers to string____________.
Searching
Matching problem
Both (a) and (b)
None of the above
Answer & Solution
No Solution for this Answer..! Report or Discus this Question
3. Strcat function adds null character
Only if there is space
Always
Depends on the standard
Depends on the compiler
4. String concatenation means –
Combining two strings.
Extracting a substring out of a string.
Partitioning the string into two strings.
Comparing the two strings to define the larger one.
Answer & Solution
No Solution for this Answer..! Report or Discus this Question
5. String operation such as strcat(s, t), strcmp(s, t), strcpy(s, t) and strlen(s) heavily rely upon.
Presence of NULL character
Presence of new-line character
Presence of any escape sequence
None of the mentioned
Answer & Solution
No Solution for this Answer..! Report or Discus this Question
6. The library function used to find the last occurrence of a character in a string is
Strnstr()
Laststr()
Strrchr()
Strstr()
Answer & Solution
No Solution for this Answer..! Report or Discus this Question
7. The return-type used in String operations are
Void only
Void and (char *) only
Void and int only
Void, int and (char *) only
Answer & Solution
No Solution for this Answer..! Report or Discus this Question
8. What is the following code segment doing? void fn( ){ char c; cin.get(c); if (c != ‘
’) { fn( ); cout.put(c); } }
The string entered is printed as it is.
The string entered is printed in reverse order.
It will go in an infinite loop.
It will print an empty line.
Answer & Solution
No Solution for this Answer..! Report or Discus this Question
9. What is the return value of the following statement if it is placed in C program? strcmp(“ABC”, “ABC”);
33
1
Compilation Error
10. Which of the following function compares 2 strings with case-insensitively?
Strcmp(s, t)
Strcmpcase(s, t)
Strcasecmp(s, t)
Strchr(s, t)
Answer & Solution
No Solution for this Answer..! Report or Discus this Question
11. Which of the following function is more appropriate for reading in a multi-word string?
Printf(),
Scanf(),
Gets(),
Puts(),
12. Which of the following function is used to find the first occurrence of a given string in another string?
Strchr()
Strrchr()
Strstr()
Strnset()
Answer & Solution
No Solution for this Answer..! Report or Discus this Question
13. Which of the following function sets first n characters of a string to a given character?
Strinit()
Strnset()
Strset()
Strcset()
Answer & Solution
No Solution for this Answer..! Report or Discus this Question
14. Which pre-defined function returns a pointer to the last occurence of a character in a string?
Strchr(s, c),
Strrchr(s, c),
Strlchr(s, c),
Strfchr(s, c),
Answer & Solution
No Solution for this Answer..! Report or Discus this Question