C-Pointers Question and Answer
C-Pointers Question and Answer
141. What happens when huge pointer is incremented ?
- Only segment address is incremented.
- Only offset address is incremented.
- Both segment and offset address are incremented.
- None of these
142. Which of the following sttement is false ?
I. If real addresses are same for both far pointers, when pointers are same.
II. If real addresses are same for both huge pointers, then ponters are ame.
III. There are many far addresses for a single real address.
IV. There are many real addresses for a single far address
I. If real addresses are same for both far pointers, when pointers are same.
II. If real addresses are same for both huge pointers, then ponters are ame.
III. There are many far addresses for a single real address.
IV. There are many real addresses for a single far address
- I & III
- II &IV
- II &III
- I &IV
143. Find the output
vaoid main ( )
{
int *p, **q, i=5;
p=&i;
q=p;
**q=10;
printf ("%d %d", *p, **q);
}
vaoid main ( )
{
int *p, **q, i=5;
p=&i;
q=p;
**q=10;
printf ("%d %d", *p, **q);
}
- 5 10
- 10 10
- 5 5
- 5 10Null pointer assignment
144. Find the output
void main ( )
{
int x=5, *p, sum=0;
p=&x;
*p=10;
p=∑
*p=x;
printf ("%d %d %d", x, *p,sum);
}
void main ( )
{
int x=5, *p, sum=0;
p=&x;
*p=10;
p=∑
*p=x;
printf ("%d %d %d", x, *p,sum);
}
- 5 10 0
- 5 10 5
- 10 10 10
- 5 10 10
145. Which of the following statement is false
- huge pointers are the default pointers in huge memoy model
- ar pointers can work beyond 64kb segment offseg
- huge pointers can never be the default pointers
- static local pointers are initialized to 0 automatically
146. Find the output
void main ( )
{
int *p, i=10;
void *q;
p=&i;
q=p;
printf ("%d", *q++);
}
void main ( )
{
int *p, i=10;
void *q;
p=&i;
q=p;
printf ("%d", *q++);
}
- 10
- 11
- compilation error
- None of these
147. State the true statement
- Generic pointers can't be derererenced.
- Generic pointers can be dereferenced using explicit type conversion.
- Generic variables can't be declared.
- All the above
148. Int far **p, here p is a
- Far pointer holds address of another far pointer.
- Near pointer holds address of another far pointer.
- Far pointer holds address of another near pointer.
- Near pointer holds address of another near pointer.
149. Find the output
void main ( )
{
int a [ ] ={1, 2, 3, 4, 5};
int i ;
for (i=0; i<5; i++)
{
printf ("%d", *a);
a++;
}
}
void main ( )
{
int a [ ] ={1, 2, 3, 4, 5};
int i ;
for (i=0; i<5; i++)
{
printf ("%d", *a);
a++;
}
}
- 1 2 3 4 5
- 1 0 0 0 0
- Error: Lvalue required
- None of these
150. Null pointer assignment error occurs only in
- Tiny & small memory model
- Small & compact memory model
- Compact & large memory model
- Small & medium memory model