Explore topic-wise MCQs in C Programming.

This section includes 6 Mcqs, each offering curated multiple-choice questions to sharpen your C Programming knowledge and support exam preparation. Choose a topic below to get started.

1.

What is the following code segment doing? void fn( ){ char c; cin.get(c); if (c != ‘\n’) { fn( ); cout.put(c); } }

A. The string entered is printed as it is.
B. The string entered is printed in reverse order.
C. It will go in an infinite loop.
D. It will print an empty line.
Answer» C. It will go in an infinite loop.
2.

String concatenation means -

A. Combining two strings.
B. Extracting a substring out of a string.
C. Partitioning the string into two strings.
D. Comparing the two strings to define the larger one.
Answer» B. Extracting a substring out of a string.
3.

Pattern matching refers to string____________.

A. Searching
B. Matching problem
C. Both (a) and (b)
D. None of the above
Answer» D. None of the above
4.

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);
Answer» C. strlchr(s, c);
5.

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
Answer» E.
6.

Strcat function adds null character

A. Only if there is space
B. Always
C. Depends on the standard
D. Depends on the compiler
Answer» C. Depends on the standard