Ads 720 x 90

Computer Science Questions and Answers: String Part - 10



1) What is a string?


A string is a sequence of one or more characters.





2) Write the syntax for declaration of a string.


syntax: char arrayname [size];


Ex: char str [100];





3) State the difference between a null character and a null sting.


A null character indicates the end of the string. A null string is a string with zero characters or no characters.





4) Which header file is needed to perform string operation? 


#include<string.h>





5) Which header file is needed to perform character operations?


 #include<ctype.h>





6) Write an example for string initialization.


 char str[100] ={“MYSORE CITY”};





7) What is the difference between gets() and scanf() function?


gets() function receives a string input up to the end of the line or a new line character. This means the string may have blank spaces and punctuations. Scanf() function accepts a string only up to the first blank space or punctuation. 


Post a Comment

0 Comments