Pointers Questions and Answers
Practice ModeShowing 10 of 217 questions
Q201
Find the output
void main ( )
{
int a=5, b=7;
int *p;
p=&a;
p--;
*p=10;
printf("%d %d", a, b);
}
Answer: Option B
Q202
What is major difference between malloc and calloc ?
Answer: Option B
Q203
Find the output
void main ( )
{
char *s1="alpha", *s2="alpha";
if (!strcmp (s1, s2))
printf("%d", *s1+*s2);
}
Answer: Option B
Q204
After we free an allocated memory block using free (), the pointer will become
Answer: Option A
Q205
Consider the following declarations:
int a[10];
int *p=a;
Which amot the following is portable way to print value of pointer p?
Answer: Option A
Q206
Find the output
int man ()
{
char *cp=NULL;
{
char c;
cp=&c;
}
return 0;
}
After the execution of above inner block
Answer: Option B
Q207
Modifying the object's value pointed by dangling pointer can cause
I. Change in object's value unexpectedly
II. Memory corruption
III. Null pointer assinment
IV. Error: Constant object can't modidy
Answer: Option C
Q208
Find the output
void main ( )
{
int *p, *q;
p=(float *) 2000;
q=(char *) 3000;
printf("%d", q-p);
}
Answer: Option A
Q209
Find the output
void main ()
{
int *p = (int *)50;
int *q;
q=p+5;
printf("%c", (q-p) + 62);
}
Answer: Option C
Q210
What is true about the following statement
typedef int (*mass) (char*, char*);
mass m1, m2;
Answer: Option A