Question 320
A RHEL 10 shell script executes the following code. What value is printed? #!/bin/bash total=0 for n in {10..14}; do total=$((total+n)); done printf "%d" "$total"
Explanation
Correct Answer
Bash expands {10..14} into 5 loop values, inclusive, then arithmetic expansion accumulates their sum: (10+14)×5÷2 = 60. printf formats the resulting integer as 60 without a newline.
Incorrect Answers
Value 50 is inconsistent with the inclusive Bash brace range from 10 through 14. The loop adds exactly 5 values and the arithmetic series yields (10+14)×5÷2 = 60; it does not skip an endpoint or count entries only.
Value 74 is inconsistent with the inclusive Bash brace range from 10 through 14. The loop adds exactly 5 values and the arithmetic series yields (10+14)×5÷2 = 60; it does not skip an endpoint or count entries only.
Value 5 is inconsistent with the inclusive Bash brace range from 10 through 14. The loop adds exactly 5 values and the arithmetic series yields (10+14)×5÷2 = 60; it does not skip an endpoint or count entries only.






Red Hat Certified System Administrator (RHCSA) (EX200) Practice Tests