Multiple choice technology programming languages

"Count the number of errors in the statement if [password = password1] then echo password else password"

  1. 0

  2. 4

  3. 1

  4. 2

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The statement has multiple errors: 1) Missing then keyword after if condition, 2) Echo command should be 'echo password' not just echo, 3) Missing semicolon or newline between conditions, 4) Missing fi to close the if block. The correct syntax is: if [ password = password1 ]; then echo password; else echo password; fi