Pointers and Memory Allocation

Download Q&A
Q. What does the 'malloc' function do in C?
  • A. Allocates memory on the stack
  • B. Allocates memory on the heap
  • C. Frees allocated memory
  • D. Initializes a pointer
Q. What does the term 'memory leak' refer to?
  • A. Not freeing allocated memory
  • B. Accessing uninitialized memory
  • C. Using too much stack space
  • D. Overwriting memory
Q. What is a dangling pointer?
  • A. A pointer that points to a valid memory location
  • B. A pointer that points to a memory location that has been freed
  • C. A pointer that is not initialized
  • D. A pointer that points to itself
Q. What is a pointer in programming?
  • A. A variable that stores a memory address
  • B. A type of loop
  • C. A function that returns a value
  • D. A data structure
Q. What is the purpose of the 'free' function in C?
  • A. To allocate memory
  • B. To release allocated memory
  • C. To initialize a pointer
  • D. To check memory usage
Q. What is the result of dereferencing a null pointer?
  • A. It returns zero
  • B. It causes a segmentation fault
  • C. It returns a random value
  • D. It is valid and returns a pointer
Q. What is the size of a pointer on a 64-bit system?
  • A. 2 bytes
  • B. 4 bytes
  • C. 8 bytes
  • D. 16 bytes
Q. Which of the following is true about pointers?
  • A. Pointers can only point to integers
  • B. Pointers can point to any data type
  • C. Pointers cannot be reassigned
  • D. Pointers are always initialized to zero
Q. Which operator is used to access the value at the address stored in a pointer?
  • A. &
  • B. *
  • C. ->
  • D. []
Showing 1 to 9 of 9 (1 Pages)
Soulshift Feedback ×

On a scale of 0–10, how likely are you to recommend The Soulshift Academy?

Not likely Very likely