nerdexam
CompTIA

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.

Software Development

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)
  • A
    88% (14)
  • C
    6% (1)
  • D
    6% (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.

AIF THENCorrect

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.

BWHILE

WHILE is a looping statement that repeatedly executes code as long as a condition is true, not a branching statement for a single decision.

CFOR
DBEGIN

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

#branching statements#conditional logic#programming constructs

Community Discussion

No community discussion yet for this question.

Full FC0-U61 Practice