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.


A program needs to choose apples, oranges, or bananas based on an input. Which of the following programming constructs is BEST to use?

  1. Loop

  2. Array

  3. If

  4. Class

The correct answer is: If

An 'if' statement is the best programming construct to use in this scenario because it allows the program to make a decision based on a specific input. The 'if' statement will check if the input matches one of the specified options (apples, oranges, or bananas) and then execute the corresponding code. Using a loop or an array would not be necessary in this case, as there are only three options to choose from. A class is used to create a new data type, so it would not be suitable for this situation either.