Nri Fintech
Company
Programming
Wha will be th output of ine following script?
#!/in/bash
secondLoop="A B C D E F G"
counter=0
for a in 6 7 8 9
do
for b in "$secondLoop"
do
let "counter+=1"
done
done
echo "This script has $counter iterations"
Option
1) This script has 28 iterations
2) This script has 21 iterations
3) This script has 4 iterations
4) This script has 0 iterations
Read Solution (Total 2)
-
- Option 1) This script has 28 iterations.
as outer loop will be executed 4 times for 6,7,8,9 and for each iteration of outer loop inner loop(loop b) will execute 7 times for A,B,C,D,E,F,G respectively - 4 years agoHelpfull: Yes(1) No(1)
- Option 3) This script has 4 iterations.
as outer loop will be executed 4 times for 6,7,8,9 and the outer loop(loop b) will be executed once every time. - 4 years agoHelpfull: Yes(0) No(1)
Nri Fintech Other Question