C-Pointers Question and Answer

C-Pointers Question and Answer
181. Find the output
void main ()
const * ptr=(const*) "SHYMLI";
ptr+=2;
printf("%s", ptr);
}


  • SHYMALI
  • YAMLI
  • MLI
  • Error: can not modify constant object
Show Answer
182. Find the output
void main ( )
char *p="Hi Bye";
printf("*%s*", p);
}

  • *ai By*
  • *Hi Bye*
  • *%s*
  • Compiler error
Show Answer
183. Find the output
void test (int, int*);
void main ()
{
int *iptr, j, k=2;
iptr=&j;
j=k;
printf("%d %d", k,j);
test (j, iptr);
printf ("%d %d", k,j);
}
void test (int 1,  int *p)
{
1++;
(*p)++;
}

  • 2 3 3
  • 2 3 4 3
  • 2 2 2 3
  • None of these
Show Answer
184. When a pointer points to zero or base address of a segment is called
  • Null pointer
  • Generic pointer
  • Smart pointer
  • Near pointer
Show Answer
185. Find the output
void main ( )
{
char *str1="D.A.V. \0 SHYAMLI";
char *str2[20];
strcpy (str2, str1);
printf("%s", str2);
}

  • D.A.V. \0 SHYAMLI
  • D.A.V.
  • D.A.V. SHYMLI garbage
  • D.A.V. Garbage
Show Answer
186. Which of the following is true about the following code :
#include "alloc.h"
void main ()
{
printf ("The size of heap is =%u Bytes", coreleft( ) );
}

  • Gives the maximum sizeof heap area.
  • Returns the number of unused memory left on heap.
  • Gives the minimum size of heap area
  • Returns the maximum size -minimum size of heap)area
Show Answer
187. Find the output
void main ( )
{
int x=440; int **q;
const **p=* (&x);
q=*(&p)+60;
printf("%d", q);
}


  • 500
  • 560
  • 440
  • Compilation error
Show Answer
188. Which of the following is true ?
  • Near pointer is a normalize pointer
  • Far pointer is a normalize
  • Huge pointer is a normalize pointer
  • None of these
Show Answer
189. Without the knowledge of pointer if memory is de-allocated it will be
  • smart pointer
  • Dangling pointer
  • Null pointer
  • Generi pointer
Show Answer
190. Attempts to write data in a read only location is called
  • Segmentation fault
  • Generic pointer
  • Null pointer assignment
  • None of these
Show Answer
Questions and Answers for Competitive Exams Various Entrance Test