C C++ Java Data Structure Python JavaScript CSS Ajax PL/SQL PHP Puzzles C programs C++ programs Java programs

Home » Aptitude Questions and Answers » C Aptitude Questions and Answers

C Pointers (Basics) - Aptitude Questions and Answers

C Pointers (Basics) - Aptitude Questions and Answers : In this section you will find C Aptitude Questions and Answers on Pointers (Basics).


1) Which operator is used to get the "content of a variable pointed to by a pointer"?

  1. Dot Operator (.)
  2. Address of Operator (&)
  3. Indirection or De-reference Operator (*)
  4. Arrow Operator (→)

2) What will be the type of a pointer, which is pointing to an integer variable?

  1. int *
  2. long int *
  3. char *
  4. unsigned *

3) If ptr is a pointer to one dimensional array, which statement will return the value of 3rd element?

  1. (ptr+3)
  2. *(ptr+3)
  3. (&ptr+3)
  4. *ptr+3

4) Consider the given declaration:

int* ptr1,ptr2;

What is the type of ptr2 here?

  1. int * (Integer pointer)
  2. void
  3. void * (void pointer)
  4. int (integer)

5) What will be the correct way to declare two integer pointers using single line declaration?

  1. int *ptr1,*ptr2;
  2. int* ptr1,ptr2;
  3. int * ptr1, ptr2;
  4. All of the above

6) Consider the following statement:

int arr[5],*ptr;

How to initialize ptr with the address of array arr?

  1. ptr = arr;
  2. ptr = &arr[0];
  3. ptr = &arr;
  4. Both 1) and 2)







COMMENTS