Linux Bash Arithmetic Expressions Question:
Download Questions PDF

What is the output of this program?
#!/bin/bash
a=10; b=20
c=$((++a))
let a=c+a
echo $a
exit 0
a) 21
b) 22
c) program will generate an error message
d) none of the above

Linux Bash Arithmetic Expressions Interview Question
Linux Bash Arithmetic Expressions Interview Question

Answer:

b) 22

Download Linux Bash Arithmetic Expressions Interview Questions And Answers PDF

Previous QuestionNext Question
What is the output of this program?
If:
1) #!/bin/bash
2) a=2
3) b=4
4) let c=a**b
5) echo $c
6) exit 0

Options:
a) 8
b) 16
c) 32
d) none of the mentioned
What is the output of this program?
#!/bin/bash
a=10
b=$(( $a<0?10:$a<100 ))
echo $b
exit 0
a) 10
b) 20
c) 1
d) 0