125,316 views
3 votes
3 votes
Hello, this is for my compute science class, and I don’t know the answer, please help? Thank you in advance =)

Hello, this is for my compute science class, and I don’t know the answer, please help-example-1
User Mark Green
by
2.8k points

1 Answer

5 votes
5 votes

Haven't taken Computer Science in a year so my answer may be wrong (APCSA).

Defining Column B,

  • Selection is when a piece of code is run only when its conditions are met.
  • Iteration is typically represented by for loops, enhanced for loops, and while loops, and will all repeat until a condition is met.
  • Sequence is usually the simplest, carrying out commands in order.

From what I see, the first box in column A is a sequence as it defines and casts num1 and num2, computes its difference in int form, and prints it out. The second box in column A is a selection even though it counts to 5 in the first segment of code. The key here is the if else statement as it checks that num1 is greater than num2 before it subtracts. The third box in column A is an iteration due to its enhanced for loop.

Hope that helps! :)

User Jamieson
by
3.6k points