NEW
Font size
WorksheetsDay 3 {C} Quiz
Total questions: 10
Worksheet time: 6mins
If the two strings are identical, then strcmp() function returns?
-1
1
0
Yes
int main()
{
char str1[20] = "Hello", str2[20] = " World";
printf("%s", strcpy(str2, strcat(str1, str2)));
return 0;
}
Hello
World
Hello World
WorldHello
Which of the following accesses a variable in structure b?
b->var;
b.var;
b-var;
b>var;
Which of the following is a properly defined struct?
struct {int a;}
struct a_struct {int a;}
struct a_struct int a;
struct a_struct {int a;};
void fun(int *ptr){
*ptr = 30;
}
int main(){
int y = 20;
fun(&y);
printf("%d", y);
}
20
30
Compiler Error
Runtime Error
int main()
{
int arr[] = {1, 2, 3, 4, 5};
int *p = arr;
++*p;
p += 2;
printf("%d", *p);
return 0;
}
2
3
4
Compile error
void f(int *p, int *q)
{
p = q;
*p = 2;
}
int i = 0, j = 1;
int main()
{
f(&i, &j);
printf("%d %d n", i, j);
}
0 2
2 2
2 1
2 0
Which of the following is not true about a structure?
Structure are used to construct a complex data type in a meaningful way
We can also declare an array of Structure.
A Structure can be nested inside under Structure.
We cannot pass a structure as a function argument
What’s the size returned for each of sizeof() operator?
char *pChar;
int *pInt;
float *pFloat;
sizeof(pChar);
sizeof(pInt);
sizeof(pFloat);
4 4 4
1 4 4
1 4 8
None of the above.
What is the value of **p2?
int a = 10;
int *p1 = &a;
int **p2 = &p1
Address of a
Address of p1
Value of a
