Pointers Questions and Answers

Take Exam

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

71. The declaration float (*fp())(); is

  • pointer fp returning float
  • function fp returning a pointer to a function returning float
  • function fp returning a pointer
  • pointer to a function
Show Answer Report

72. When applied to a variable, what does the unary "&" opertor yield ?

  • the variable's value
  • the variable's address
  • the variable's format
  • the variable's right value
Show Answer Report

73. Which of the following is the most accurate statement about runtime memory ? 1. Memory is allocated by using malloc () 2. Memory is freed by a garbage collector 3. Allocated memory can be freed by calling free ( )

  • option 1 only
  • option 2 only
  • both options 1 and 2
  • both options 1 and 3
Show Answer Report

74. Which of the following is true about pointers ? 1. Pointers do not require memory storage. 2. The size of a pointer depends on the type of the variable it points to.

  • option 1 only
  • option 2 only
  • options 1 and 2
  • neither option 1 nor 2
Show Answer Report

75. Which of the following is True about pointers ? 1. Pointers do not require  memory storage. 2. The size of a pointer depends on the type f the variable it points to.

  • option 1 only
  • option 2 only
  • options 1 and 2
  • both options 1 and 3
Show Answer Report

76. If ptrl and ptr2 are valid pointers in the same array, then which of the following statements is valid ?

  • ptrl + 2
  • ptrl - ptr2
  • ptrl * ptr2
  • both options a and b
Show Answer Report

77. char *x; x = "AMMA"; is the above code valid ?

  • Yes. A new memory space will be allocated to hold the string "AMMA".
  • No. It would assign the string "AMMA" to an unallocated space in memory.
  • Yes. The pointer x will point to the memory location created for the constant "AMMA".
  • No. This sysntax is not allowed.
Show Answer Report

78. char *x = NULL; printf ("%s\n", x); What will be the behaviour o the sample code above ?

  • This will not compile. A pointer cannot be initialized to NULL.
  • The result will fall into "undefined behviour" and be unpredictable.
  • A "0" will be printed
  • Nothing will be printed.
Show Answer Report

79. char base [5] = "a" ; const char *ptr; Given the above, which of the following statements is legal ?

  • ptr = base;
  • *ptr =
  • *ptr=base;
  • ptr = 'a';
Show Answer Report

80. char *ptr; char string [ ] = "project"; ptr = string; ptr += (ptr + 5); What string does ptr contain in the sample code above ?

  • ct
  • ject
  • oject
  • Unknown. this code is incorrect
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test