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

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.

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

6.
The library function used to find the last occurrence of a character in a string is

Strnstr()

Laststr()

Strrchr()

Strstr()

7.
The return-type used in String operations are

Void only

Void and (char *) only

Void and int only

Void, int and (char *) only

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.

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)

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()

13.
Which of the following function sets first n characters of a string to a given character?

Strinit()

Strnset()

Strset()

Strcset()

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),

0Shares
0
Scroll to Top