Study for the CompTIA ITF+ Exam. Enhance your tech literacy with multiple-choice questions and detailed explanations. Prepare thoroughly and succeed!

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


Joe, a developer, is writing a program in which he needs to store a number that changes over the duration of the program's run. Which of the following would Joe MOST likely use to accomplish this?

  1. Pointer

  2. Function

  3. Algorithm

  4. Variable

The correct answer is: Variable

A pointer is a variable that holds the memory address of another variable. While it can be used to indirectly access and change the value of a variable, it is not the most efficient or common method for simply storing and updating a changing number. A function is a block of code that performs a specific task. While functions can be used to manipulate and update the value of a variable, their primary purpose is to execute a specific action rather than to store a value. An algorithm is a step-by-step procedure for solving a specific problem. It is a sequence of instructions that can be followed to achieve a desired result. While algorithms may use variables as part of their steps, they are not used specifically for storing changing values. A variable is a named location in a computer's memory that holds a value. In this scenario, Joe would most likely use a variable to store the number that changes over the program's duration. By assigning a value to a variable and using it throughout the program, Joe can easily update and access the changing number as needed. Therefore, a variable would be the most likely choice for Joe to use in this scenario.