Linux Bash Arithmetic Expressions Question:
Download Questions PDF

What is the output of this program?
#!/bin/bash
a=1; b=2; c=3
d=$(( ++a**b*c++ + a ))
echo $d
exit 0

a) 14
b) 12
c) program will generate an error message
d) none of the mentioned

Answer:

a) 14
The operators in decreasing order of precedence are ++, **, *, +.

Download Linux Bash Arithmetic Expressions Interview Questions And Answers PDF

Previous QuestionNext Question
What is the output of this program?
#!/bin/bash
a=10
b=$(( $a<0&&$a<100 ))
echo $b
exit 0
a) 10
b) 0
c) 1
Which command sets up shorthand for command or command line?
a) set
b) alias
c) new
d) echo