Unix Shell Script Test
A shell script is executed by:
A shell variable cannot start with:
If x=11 and y=6, then what is the exit status of the following expression? [ ! $x -gt 9 -a ! $y -ne 23 ]
If x=11 and y=6, then what is the exit status of the following expression? [ $x -eq 11 -a $y -ne 89 ]
On executing the statement: set -3 + 1
Precedence hierarchy decides which operator:
Suppose there are three files test0.sh, test1.sh, and test2.sh in your current directory. Which of the following options would occur during the execution of read statement? exec < test0.sh exec < ...
Suppose you are writing a shell script that accepts five positional parameters from the terminal. What will be the effect of using statement "shift 1" in your shell script and then executing the sh...
The break statement is used to exit from:
The exit statement is used in a loop to:
The expression expr -2 % 7 evaluates to:
The expression expr -7 % 2 evaluates to:
The statement z=`expr 5 / 2` would store which of the following values in z?
What is the error in the following loop statement? while [ $1 -gt 10 -a ($2 -o -w $3 ) ]
What is the error in the following program? 1. j=1 2. while [ $j -le 10 ] 3. do 4. echo $j 5. j = j + 1 6. done
What is the error in the following program? 1. j=10 k=12 2. if [ $k>=$j ] 3. then 4. k=$j 5. j=$k 6. fi 7. echo $j $k
What is the error in the following program? 1. j=10 k=12 2. if test [ $k -ge $j ] 3. then 4. k=$j 5. j=$k 6. fi 7. echo $j $k
What is the error in the following program? 1. while who | grep aa12 | wc -l 2. do 3. echo false 4. done
What is the error in the following program? 1. x=10 2. if [ x -ge 2 ] 3. then 4. echo $x 5. fi
What is the error in the following shell script code? #!/bin/sh 1. a=12.25 b=12.52 2. if [a=b] 3. then 4. echo " a and b are equal" 5. fi
What is the error in the following shell script code? 1. until=1 2. while [ $until -eq 5 ] 3. do 4. echo until cannot be used as a variable name 5. until=`expr $until + 1` 6. done
What is the output of the following program when directory name "home" is given as input? echo Enter a directory Name read dirname case $dirname in *) echo any directory name ;; c*) echo c...
What is the output of the following program? a=300 [ -n $a ] echo $? [ -z $a ] echo $?
What is the output of the following program? i=4 z=12 [ $i = 5 -a $z -gt 5 ] echo $?
What is the output of the following program? 1. x=3 y=5 z=10 2. if [ ($x -eq 3) -a ( $y -eq 5 -o $z -eq 10 ) ] 3. then 4. echo $x 5. else 6. echo $y 7. fi
What is the output of the following program? b= [ -n $b ] echo $? [ -z $b ] echo $?
What is the output of the following program? for i in 'a b c d e' do echo $i done
What is the output of the following program? for i in a b c d e do echo $i done
What is the output of the following program? i=1 for [ i -le 10 ] do echo $i i='expr $i + 1' done
What is the output of the following program? i=1 j=1 k=1 while [ $i -lt 10 ] do while [ $j -lt 10 ] do while [ $k -lt 10 ] do echo $i $j $k k='expr $k + 1' break 3 done j='expr $j + 1' done i='exp...
What is the output of the following program? k=35 echo `[ $k -eq 35 ]``[ $k -eq 50 ]`
What is the output of the following program? terminal=vt100 case $terminal in vt100) echo Dec terminal;; vt200) echo Old terminal;; ansi) echo Commonly used terminal;; v*) echo vt ...
What is the output of the following program? x=3 y='[$x -eq 10 ]' z='[$x -lt 10 ]' echo x=$x y=$y z=$z
What is the output of the following shell script code? suite=3 case $suite in 1) echo Diamond ;; 2) echo Spade ;; 3) echo Heart ;; 4) echo Club ;; esac
What will be the output of the following program assuming that the command line arguments are dog parrot cuckoo? for argument in "$*" do echo $argument done
What will be the output of the following program assuming that the command line arguments are dog parrot cuckoo? for argument in $* do echo $argument done
What will be the output of the following program assuming that the command line arguments are Unix shell scripting? for argument in * do echo $argument done
What would be the condition to check whether file with name "xyz" is a regular file?
Which of the following assignments is illegal?
Which of the following expressions is correct?
Which of the following expressions is valid?
Which of the following is not a shell keyword?
Which of the following is true about "until" loop?
Which of the following is true about the "continue" statement?
Which of the following is/are allowed in an arithmetic statement involving expr command?
Which of the following is/are correct declaration(s) of a null variable "a" in shell script?
Which of the following lines have an error? 1. echo enter your name 2. read filename 3. read name < $filename 4. echo $name
Which of the following loops is invalid?
Which of the following shows the correct precedence order of operators used in a shell? Operators on left side of comma have higher precedence than those on the right side of comma.
Which of the following statements is false?
Which of the following statements is incorrect regarding if-then-fi?
Which of the following statements is true?
Which of the following variable names is invalid?