NEW
Font size
WorksheetsArrays and Strings in C
Total questions: 10
Worksheet time: 5mins
A sequential collection of homogeneous elements is called_____
variable
constant
Array
keyword
Fill in the blank
printf("Numbers from 1 to 10 in reverse order:")
for(i=10;i>0;___)
printf("%d\n",i);
i++
i=i+1
i+=2
i--
special character which is stored at the end of string is ___
\n
\0
\t
\b
____ is the control character used for strings
%c
%d
%f
%s
____is the function used to compare two strings
strcmp()
strcpy()
strlen()
strcat()
Number of bytes required to store a character is
1 byte
2 bytes
4 bytes
8 bytes
_____is a sequential collection of heterogeneous elements
Array
structure
string
function
Identify the error
int a[];
a[0]=35;
a[1]=46;
printf("%d\t%d",a[0],a[1]);
size not specified in declaration of array
printf statement is wrong
assignment is wrong
can not use index 0
What is the output of following code snippet?
char msg[20]="welcome to c programming lab";
int len;
len=strlen(msg);
printf("length=%d",len);
25
28
24
29
What is the output of strcmp() when strings are equal?
1
0
negative value
positive value
