Pointers Questions and Answers
Practice ModeShowing 10 of 217 questions
Q121
main ( )
{
char *a [ ] = {"jaya", "mahe", "chandra", "buchi"};
printf ("%d", sizeof (a) / sozeof (char *));
}
Answer: Option A
Q122
main ( )
{
char *p = "abc";
char *q = "abc123";
while (*p++=*q++)
{
printf ("%c%c, *p, *q);
}
}
What will be the output of the above ?
Answer: Option D
Q123
What is the result of the expression for the following declaration ?
int A [ ] = {1, 2, 3, 4, 5 };
*A + 1 - *A +3
Answer: Option C
Q124
Which are valid ?
(i)Pointers can be added;
(ii)Pointers can be subtracted.
(iii)Integers can be added to pointers.
Answer: Option C
Q125
x = malloc (y). Which off the following statements is correct ?
Answer: Option C
Q126
p and q are pointers to the same type of data items. Which of these are valid ?
(i) *(p+q)
(ii) *(P-q)
(iii) *p-*q
Answer: Option C
Q127
int *i;
float *f;
char *c;
Which are the valid castings ?
(i) (int *) &c
(ii) (float *) &c
(iii) (char *) &i
Answer: Option A
Q128
int a = 'a', d = 'd';
char *b = "b", **c = "cr";
main ( )
{
mixup (a, b, &c);
}
mixup (int p1, char *p2, chr **p3)
{
int *temp;
...
}
What is the value of a and b in mixup at the beginning ?
Answer: Option C
Q129
main ( )
{
char s [ ] = "S.T.S.", *A;
print (s);
{
print (char *p)
{
while (*p ! = '\0')
{
if (*p ! = '' . ') printf ("%c", *p);
p++;
}
}
What is the output?
Answer: Option B
Q130
Find the output
void main()
{
int a[5]={2, 3, 4, 5}, *c=a;
(*c) --;
printf ("d", *c);
}
Answer: Option B