NEW
Font size
Worksheetsc-languiz
Total questions: 10
Worksheet time: 9mins
What is a String in C Language.?
String is a new Data Type in C
String is an array of Characters with null character as the last element of array
String is an array of Characters with null character as the first element of array
String is an array of Integers with 0 as the last element of array.
What is the maximum length of a C String.?
32 characters
64 characters
256 characters
none of the above
Choose a correct C Statement about Strings.
PRINTF is capable of printing a multi word string.
PUTS is capable of printing a multi word string.
GETS is capable of accepting a multi word string from console or command prompt
All the above
If the two strings are identical, then strcmp() function returns
-1
1
0
yes
What is the output of c program with strings?
int main()
{
char str[]={'g','l','o','b','e','\0'};
printf("%s",str);
return 0;
}
g
globe
globe/0
compiler error
What is the output of c program with strings ?
int main()
{
char str[]={'g','l','o','b','e'};
printf("%s",str);
return 0;
}
g
globe
globe/0
none of the above!
What is the output of c program with strings?
int main()
{
char str1[]="JOHN";
char str2[20];
str2= str1;
printf("%s",str2);
return 0;
}
JOHN
J
JOHN/0
Compiler error
What is the output of c program with strings?
int main()
{
char str[2];
scanf("%s", str);
printf("%s",str);
return 0;
}
//Input: South
Sou
South
Compiler error
none of the above
What is the output of c program with string arrays?
int main()
{
char *p1 = "GOAT";
char * p2;
p2 = p1;
p2="ANT";
printf("%s", p1);
}
ANT
GOAT
G
A
What is the output of c program ?
int main()
{
int str[]={'g','l','o','b','e'};
printf("A%c ",str);
printf("A%s ",str);
printf("A%c ",str[0]);
return 0;
}
A A A
A Ag Ag
A*randomchar* Ag Ag
(*same line)
Compiler error
