Pointer - Study Mode

[#161] Which of the following declaration will result in run-time error?
Correct Answer

(D) none of the mentioned

[#162] What will be the output of the following C code? #include <stdio.h>
int main()
{
char *a[2] = {"hello", "hi"}
printf("%s", *(a + 1))
return 0
}
Correct Answer

(C) hi

[#163] What will be the output of the following C code? #include <stdio.h>
int main()
{
char *p = NULL
char *q = 0
if (p)
printf(" p ")
else
printf("nullp")
if (q)
printf("q
")
else
printf(" nullq
")
}
Correct Answer

(A) nullp nullq

[#164] What will be the output of the following C code? #include <stdio.h>
int main()
{
int i = 97, *p = &i
foo(&i)
printf("%d ", *p)
}
void foo(int *p)
{
int j = 2
p = &j
printf("%d ", *p)
}
Correct Answer

(A) 2 97

[#165] What will be the output of the following C code? #include <stdio.h>
int main()
{
int ary[2][3][4], j = 20
ary[0][0] = &j
printf("%d
", *ary[0][0])
}
Correct Answer

(A) Compile time error