Pointers Questions and Answers
Pointers questions with answers are a crucial part of C programming preparation, often included in technical interviews and MCQ-based exams. Pointers are variables that store the memory address of other variables, making them fundamental to dynamic memory management and efficient program design. These C programming MCQ questions and answers help students understand pointer arithmetic, function pointers, arrays, and memory allocation. Commonly asked in placement exams by TCS, Infosys, and Wipro, mastering pointer concepts gives you a competitive edge in coding tests and programming interviews.
Pointers
Showing 10 of
217 questions
181. Find the output void main () const * ptr=(const*) "SHYMLI"; ptr+=2; printf("%s", ptr); }
- SHYMALI
- YAMLI
- MLI
- Error: can not modify constant object
182. Find the output void main ( ) char *p="Hi Bye"; printf("*%s*", p); }
- *ai By*
- *Hi Bye*
- *%s*
- Compiler error
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
184. When a pointer points to zero or base address of a segment is called
- Null pointer
- Generic pointer
- Smart pointer
- Near pointer
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
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
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
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
189. Without the knowledge of pointer if memory is de-allocated it will be
- smart pointer
- Dangling pointer
- Null pointer
- Generi pointer
190. Attempts to write data in a read only location is called
- Segmentation fault
- Generic pointer
- Null pointer assignment
- None of these