203k views
3 votes
The statement z = 'expr 5 / 2' would store which of the following values in z?

1) 0
2) 1
3) 2
4) Cannot be determined

User Nexerus
by
7.4k points

1 Answer

2 votes

Final answer:

In a Unix-based system, the statement 'expr 5 / 2' assigns the result of the integer division of 5 by 2 to the variable z; thus, the value of z would be 2 as integer division truncates the decimal.

Step-by-step explanation:

The statement z = 'expr 5 / 2' appears to be from a scripting or programming context and is likely aimed at assigning a value to the variable z. In most Unix-based systems where expr is used for expression evaluation in shell scripts, this would evaluate the integer division of 5 by 2. Assuming that expr follows traditional integer division rules, the result would be 2, because integer division truncates the decimal part and only returns the integer quotient.

User Roh
by
8.1k points