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?
An IF THEN statement is used for decision-making in programming. It allows the program to execute certain blocks of code based on whether a specified condition is true or false, making it ideal for branching based on user input.
Here’s why the other options are not suitable:
B. WHILE: A WHILE loop is used for repeating a block of code while a condition is true, not for decision-making.
C. FOR: A FOR loop is used for iterating a block of code a specific number of times, not for conditional branching.
D. BEGIN: The BEGIN command is used to start a block of code, but it does not make decisions based on conditions.
upvoted 1 times
...
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
lexxone
1 week, 4 days ago