Multiple choice technology programming languages

11.) How can I tell how much memory my system has?

  1. a) Use getmemory()

  2. b) Use sysctl()

  3. c) Use freemem()

  4. d) Use malloc()

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

sysctl() is the system call used to query and modify kernel parameters in BSD-derived systems including macOS. It can retrieve memory information through hardware parameters (e.g., HW_PHYSMEM). On modern Linux, reading /proc/meminfo is more common, but sysctl() remains valid. The other functions are not standard system calls for memory queries.