C Language MCQ - English
A pointer is
A keyword used to create variables
A variable that stores address of an instruction
A variable that stores address of other variable
All of the above
Answer : C
View More Related Question
1) What will be the output of the following C code? #include <stdio.h> int *f();
int main()
{
int *p = f();
printf("%d\n", *p);
}
int *f()
{
int *j = (int*)malloc(sizeof(int));
*j = 10;
return j;
}
10
Compile time error
Segmentation fault/runtime crash since pointer to local variable is returned
Undefined behaviour
View Answer
2) Comment on the following C statement. const int *ptr;
You cannot change the value pointed by ptr
You cannot change the pointer ptr itself
You May or may not change the value pointed by ptr
You can change the pointer as well as the value pointed by it
View Answer
3) Comment on the following pointer declaration. int *ptr, p;
ptr is a pointer to integer, p is not
ptr and p, both are pointers to integer
ptr is a pointer to integer, p may or may not be
ptr and p both are not pointers to integer
View Answer
4) What will be the output of the program ? #include<stdio.h>
int main()
{
int i=3, *j, k;
j = &i;
printf("%d\n", i**j*i+*j);
return 0;
}
5) How many bytes are occupied by near, far and huge pointers (DOS)?