Multiple choice technology operating systems

Which of the following command sets the previously undefined variable x to 40?

  1. typset x=32+8

  2. set x=32+8

  3. let x=32+8

  4. x=32+8

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

In shell scripting, 'let' is used for arithmetic operations. The command 'let x=32+8' evaluates the arithmetic expression 32+8 and assigns the result 40 to variable x. Option A uses 'typset' which is a typo for 'typeset' (used for variable declaration), Option B 'set' is for shell options/parameters, and Option D is just a string assignment in most shells.