Free LPI 102-500 Actual Exam Questions - Question 10 Discussion

Question No. 10
What keyword is missing from this code sample of a shell script?
____ i in *.txt; do
echo $i
done
Select one option, then reveal solution.
US
ZP
Zain P.
2026-02-22

A makes sense because 'for' is the standard keyword for this pattern.

0
ZP
Zain P.
2026-02-21

A, cause only 'for' fits iterating over files like that.

0
SZ
Sam Z.
2026-02-17

It’s A for sure. The structure “i in *.txt; do” is a giveaway that it’s a for loop. B, C, and D don’t match that pattern at all. The “loop” keyword doesn’t even exist in shell scripts, and “while” or “until” wouldn’t use “in *.txt” like that. This is basic shell looping syntax you see all the time when iterating over file lists.

0
UQ
Usman Q.
2026-02-16

Guessing A since only 'for' pairs with 'i in *.txt' correctly here.

0
UQ
Usman Q.
2026-02-14

This one’s definitely A since the “for … in” syntax is classic for looping over files or items in shell scripts. None of the other keywords (B, C, D) fit with the “in *.txt” part. Also, the rest of the code uses “do” which pairs with “for” loops, not while or until loops. So yeah, missing keyword is for (A).

0
WO
Will O.
2026-02-13

A imo, only 'for' fits the 'i in' pattern in standard shell scripts.

0
MH
Mohammad H.
2026-02-13

A, because only 'for' works with the 'i in' loop syntax in shell scripts.

0
AE
Adeel E.
2026-01-29

A. The pattern "i in *.txt; do" clearly matches the syntax for a for loop in most shell scripts. The others don’t fit here because "loop" isn’t a shell keyword, and "while" or "until" loops use different syntax without "in". So, without overcomplicating, “for” is the missing keyword that makes this code work as intended.

0
AY
Andre Y.
2026-01-28

Can't be B, C, or D since only "for" fits the "i in" pattern here.

0
JT
James T.
2026-01-25

D imo, none of the other options fit the “i in” syntax except for a “for” loop. “While” or “until” wouldn’t be followed by “i in *.txt” like that.

0
JT
James T.
2026-01-25

A for sure, since “i in” requires a “for” loop syntax here.

0
PW
Peter W.
2026-01-23

A vs C? Until loops don’t use “in” either, so that rules out C. The only keyword that fits “i in *.txt; do” is definitely A. for.

0
AE
Ash E.
2026-01-21

A. The structure with "i in *.txt; do" is classic for-loop syntax in shell scripts. “While” loops don’t use the “in” keyword, and “loop” isn’t a shell keyword at all. “Until” also doesn’t fit here since it’s for condition-based looping, not iterating over a list. So the missing keyword has to be “for”.

0
AE
Ash E.
2026-01-20

This one’s definitely A. The pattern “i in *.txt; do” only makes sense with a for loop. While loops don’t use the “in” keyword like this, and “loop” isn’t a valid shell keyword anyway. So the missing word has to be for.

0
MH
Mohammad H.
2026-01-18

A. The code clearly follows the standard for-loop syntax in shell scripts: for variable in list; do commands; done. None of the other options fit this structure. While the semicolon before done is important if everything’s on one line, the missing keyword itself is definitely “for.”

0
MW
Mason W.
2026-01-18

Maybe D, but I’m pretty sure it’s not while because the pattern "in *.txt" is typical with for loops. Since the question asks for a missing keyword, and the structure is "____ i in *.txt; do ... done", it’s almost always for. While loops don’t use "in" like that. So D doesn’t really make sense here, which kind of confirms that A is the best fit.

0
JF
Jason F.
2026-01-17

It can't be B/C/D because loop/until/while don't fit the syntax here.

0
AB
Ash B.
2026-01-16

A this looks like a classic for loop in shell scripts

0