CompTIA ITF+ (FC0-U61) — Question 144
A program needs to choose apples, oranges, or bananas based on an input. Which of the following programming constructs is BEST to use?
Answer options
- A. Variable
- B. If
- C. Datatype
- D. Comment
Correct answer: B
Explanation
The best choice is 'If' since it allows the program to execute different code blocks based on the input fruit. A 'Variable' simply holds data, 'Datatype' defines the kind of data being used, and 'Comment' is used for explanations in code but does not affect program logic.