---------------------------------- Test Your "C" Skill -------------------------------------
STRING
STRING
Privous Next Page
1.
void main()
{
char str1[]= “Itchallengers”;
char str2[]= “Itchallengers”;
if(str1==str2)
printf(“\n Equal”);
else
printf(“\nUnequal”);
}
a.Equal
b.Unequal
c. Error
d. None of above
Output: B
2.
void main()
{
printf(5+ “Welcome”);
}
a. Error
b. Welcome
c. me
d. None of above
Output:
C
3.
void main()
{
char str[7]= “Welcome”;
printf(“%s”,str);
}
a. Error
b. Welcome
c. Can not predict
d. None of above
Output: C
4.
void main()
{
printf(“%c”,”Itchallengers”[4]);
}
a. Error
b. h
c. a
d. Itchallengers
Output: C
5.
void main()
{
char ch=’A’;
printf(“%d %d”, sizeof(ch),
sizeof(‘A’));
}
a. 1
1
b. 1
2
c. 2
2
d. 2
1
Output: B.
6.
void main()
{
printf(“\n %d %d %d”, sizeof(‘3’), sizeof(“3”), sizeof(3));
}
a. 1
1 1
b. 2
2 2
c. 1
2 2
d. 1 1
1
Output: B.
7.
void main()
{
char *str[] = { “Frogs”, “Do”, “Not”, “They”, “Croak!”};
printf(“%d %d”, sizeof(str),
sizeof(str[0]));
}
Output:
12 2
8. Can you write the code in strcpy()
into single line?
Output:
mystrcpy( char *t, char *s)
{
while (*t++ = *s++);
}
No comments:
Post a Comment