Bash - conditional variables - multichoice questions

Question 1

What happens if you use the set -e in a Bash script?

Question 2

What is the result of this script?

txt=Penguins
[ "${txt:2:4}" = "ngui" ]; echo $?

Question 3

What is the result of this script?

txt=Penguins
[[ $txt =~ [a-z]{8} ]]; echo $?

Question 4

What is wrong with this script?

#!/bin/bash
if [ $PET = dog ] ;then
  echo "You have a dog"
fi

Question 5

Which command is being run in this script to check if file.txt exists?

if [ -f file.txt ]; then
    echo "file.txt exists"
fi

Question 6

The code below seems to work and outputs "8 is greater than 5". However, what unexpected result will tell you it is not functioning properly?

#!/bin/bash
var="8"
if [ $var > 5 ]; then
echo "$var is greater than 5"
fi