About C Interview Questions-Strings:

This C interview Questions-Strings page provides all the interview questions on Strings in C language and these questions providing answers about uses, processing strings and pre-defined string handling functions.


C Interview Questions-Strings

What is a String?
A one-dimensional array of characters.


When we use String?
Used to process the information like names, address….


What is the use of string.h header file?
Contains many pre-defined functions used to process String data in C application.


How many characters can be stored into an array of size n?
Only n-1 characters.


What is ‘\0’ character?
The last character of every string by default used to process string.


Can we use loops to read strings?
No.


What is %s?
Special format specifier used to read and display strings.


What is size_t?
A data type that represents a positive integer value.


Can we pass a string as a parameter to function?
Yes allowed, we can collect into same type argument in the called function.


What is the use of strcmp() function?
Compares two strings character by character.
Returns 0 if both characters are equal.
Returns ASCII difference between mismatching characters if not equal.


Can we process Strings without using string.h functions?
Yes, it is possible to process stings using user logic and ‘\0’ character..


Can we compare 2 strings using address?
No, because 2 strings get memory allocation at 2 different locations.
But it is possible to compare references in C programming.


What is the use of strstr() function?
Used to process part of the string(substrings) in String data processing.


How can you print only part of String?
Using strstr() function of string.h header file we can process substrings.


>C Language Interview Questions-Arrays<

Share this