FC0-U61 · Question #481
A programmer is creating a program that makes a decision based on user input and has decided to use a branching statement. Which of the following commands would be BEST for the programmer to use?
The correct answer is A. IF THEN. Branching statements in programming allow a program to make decisions and execute different code blocks based on a given condition. The 'IF THEN' command is the primary construct for implementing this conditional logic.
Question
A programmer is creating a program that makes a decision based on user input and has decided to use a branching statement. Which of the following commands would be BEST for the programmer to use?
Options
- AIF THEN
- BWHILE
- CFOR
- DBEGIN
How the community answered
(16 responses)- A88% (14)
- C6% (1)
- D6% (1)
Why each option
Branching statements in programming allow a program to make decisions and execute different code blocks based on a given condition. The 'IF THEN' command is the primary construct for implementing this conditional logic.
The 'IF THEN' statement is the fundamental branching construct in programming, allowing a program to execute a specific block of code only if a specified condition is true, perfectly suited for making decisions based on user input.
WHILE is a looping statement that repeatedly executes code as long as a condition is true, not a branching statement for a single decision.
Concept tested: Programming - Branching statements (Conditional logic)
Source: https://learn.microsoft.com/en-us/dotnet/visual-basic/language-reference/statements/if-then-else-statement
Topics
Community Discussion
No community discussion yet for this question.