21. What is the output of the following code snippet?
#include<stdio.h>
int main()
{
int x = 5;
int y = 0;
y = x / y;
printf(“%d”, y);
return 0;
}
a) 0
b) 5
c) Program crashes
d) Error: Division by zero
22. What is the correct way to access the nth element of an array in C?
a) array(n)
b) array[n]
c) array.n
d) array-n
23. What is the output of the following code snippet?
#include<stdio.h>
int main()
{
int x = 5;
int y = 3;
printf(“%d”, x >= y);
return 0;
}
a) 0
b) 1
c) 5
d) 3
24. What is the output of the following code snippet?
#include<stdio.h>
int main()
{
int x = 5;
int y = 3;
printf(“%d”, x * y);
return 0;
}
a) 3
b) 5
c) 8
d) 15
25. What is the correct way to compare two strings in C?
a) str1 == str2
b) strcmp(str1, str2)
c) strcat(str1, str2)
d) strlen(str1)