AllInfoHub Logo

AllInfoHub – MCQ Practice

Pointers – Multiple Choice Questions (MCQs)

  1. 1. What is a pointer in C?

    • A. A variable that stores a data value
    • B. A keyword used for loops
    • C. A variable that stores the memory address of another variable
    • D. A function that returns an address
  2. 2. Which operator is used to get the address of a variable in C?

    • A. *
    • B. &
    • C. ->
    • D. .
  3. 3. Which operator is used to dereference a pointer (access the value pointed to by the pointer) in C?

    • A. *
    • B. &
    • C. ->
    • D. .
  4. 4. How do you declare an integer pointer in C?

    • A. int ptr;
    • B. pointer int ptr;
    • C. int *ptr;
    • D. *int ptr;
  5. 5. What value does an uninitialized pointer typically hold?

    • A. 0
    • B. A garbage value
    • C. NULL
    • D. The address of the main function
  6. 6. What is the significance of the NULL pointer in C?

    • A. It points to the first memory location
    • B. It indicates that the pointer is not currently pointing to a valid memory location
    • C. It represents the end of a string
    • D. It is used for error handling only
  7. 7. What is pointer arithmetic in C?

    • A. Performing arithmetic operations on the values pointed to by pointers
    • B. Performing arithmetic operations on the memory addresses stored in pointers
    • C. Performing arithmetic operations on the size of the data type
    • D. It's not allowed in C
  8. 8. If `int *ptr; int arr[5]; ptr = arr;`, what does `ptr + 1` represent?

    • A. The value of the second element of the array
    • B. The memory address of the second element of the array
    • C. The value of the first element + 1
    • D. The memory address of the first element + 1
  9. 9. What is the size of a pointer in C (in a typical 32-bit system)?

    • A. 1 byte
    • B. 2 bytes
    • C. 4 bytes
    • D. 8 bytes
  10. 10. What is the size of a pointer to a 'char' in C (in a typical 32-bit system)?

    • A. 1 byte
    • B. 2 bytes
    • C. 4 bytes
    • D. It depends on the char size
  11. 11. What is the size of a pointer to an 'int' in C (in a typical 32-bit system)?

    • A. 1 byte
    • B. 2 bytes
    • C. 4 bytes
    • D. It depends on the int size
  12. 12. What is the size of a pointer to a 'float' in C (in a typical 32-bit system)?

    • A. 1 byte
    • B. 2 bytes
    • C. 4 bytes
    • D. It depends on the float size