Correct Answer:
( ) , ** , * or / , + or -
Note: This Question is unanswered, help us to find answer for this one
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 < test2.sh
exec < test3.sh
read line
echo $line
Correct Answer:
It would read only test3.sh
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
tput cup $row $col
Note: This Question is unanswered, help us to find answer for this one
What is the output of the following program?
k=35
echo `[ $k -eq 35 ]``[ $k -eq 50 ]`
Correct Answer:
A blank line will result
Note: This Question is unanswered, help us to find answer for this one
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 cobol directory name ;;
f*) echo fortran directory name ;;
p*) echo pascal directory name ;;
esac
Correct Answer:
any directory name
Note: This Question is unanswered, help us to find answer for this one
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
Correct Answer:
5 and a warning about line 2 will occur
Note: This Question is unanswered, help us to find answer for this one
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 shell script?
Correct Answer:
The positional parameters would be shifted by one position towards left i.e. parameter 1 will have value of parameter 2, parameter 2 will have value of parameter 3 and so on.
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
while $
Note: This Question is unanswered, help us to find answer for this one
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
Correct Answer:
Output will be 10 12 with a warning message in line 2
Note: This Question is unanswered, help us to find answer for this one
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
Correct Answer:
The names of all files in the current directory would be displayed
Note: This Question is unanswered, help us to find answer for this one
What is the output of the following program?
for i in a b c d e
do
echo $i
done
Correct Answer:
a b c d e a b c d e
Note: This question has more than 1 correct answers
Note: This Question is unanswered, help us to find answer for this one
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
Correct Answer:
Line 5 should be j=`expr $j + 1`
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
All of the above.
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
an interpreter.
Note: This Question is unanswered, help us to find answer for this one
On executing the statement:
set -3 + 1
Correct Answer:
An error would occur
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
c=`1972`
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
#regpay
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
-2
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
2
Note: This Question is unanswered, help us to find answer for this one
What is the error in the following loop statement?
while [ $1 -gt 10 -a \($2 -o -w $3 \) ]
Correct Answer:
There is no error
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
ls
Note: This Question is unanswered, help us to find answer for this one
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 series terminal;;
*) echo Any terminal;;
esac
Correct Answer:
Dec terminal
Note: This Question is unanswered, help us to find answer for this one
What is the output of the following program?
i=4 z=12
[ $i = 5 -a $z -gt 5 ]
Correct Answer:
1
Note: This Question is unanswered, help us to find answer for this one
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 "\na and b are equal"
5. fi
Correct Answer:
On line 2, [a=b] should be replaced with [ $a -eq $b ]
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
terminate the execution of a script.
Note: This Question is unanswered, help us to find answer for this one
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='expr $i + 1'
Correct Answer:
1 1 1
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
is used first.
Note: This Question is unanswered, help us to find answer for this one
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
Correct Answer:
There is no error
Note: This Question is unanswered, help us to find answer for this one
The break statement is used to exit from:
Correct Answer:
a
Note: This Question is unanswered, help us to find answer for this one
What is the output of the following program?
i=1
for [ i -le 10 ]
do
echo $i
i=
Correct Answer:
An error will occur
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
d = 25
Note: This Question is unanswered, help us to find answer for this one
What is the error in the following program?
1. while who | grep aa12 | wc -l
2. do
3. echo false
4. done
Correct Answer:
There is no error
Note: This Question is unanswered, help us to find answer for this one
Which of the following lines have an error?
1. echo enter your name
2. read filename
3. read name < $filename
4. echo $name
Correct Answer:
3
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
It continues the control to the beginning of the loop, bypassing the statements below it, inside the loop.
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
dog parrot cuckoo
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
a=`expr $b \* \( $c + $d \ )
Note: This Question is unanswered, help us to find answer for this one
If x=11 and y=6, then what is the exit status of the following expression?
[ $x -eq 11 -a $y -ne 89 ]
Correct Answer:
0
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
The indentation is mandatory otherwise an error will occur on execution.
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
if [ -f xyz ]
Note: This Question is unanswered, help us to find answer for this one
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 ;;
Correct Answer:
Heart
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
Output of echo statement can be redirected to a file.
Note: This Question is unanswered, help us to find answer for this one
What is the output of the following program?
z='[$x -lt 10 ]'
echo x=$x y=$y z=$z
x=3
y=
Correct Answer:
None of the above
Note: This Question is unanswered, help us to find answer for this one
If x=11 and y=6, then what is the exit status of the following expression?
[ ! $x -gt 9 -a ! $y -ne 23 ]
Correct Answer:
1
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
It cannot test for conditions.
Note: This Question is unanswered, help us to find answer for this one
What is the error in the following program?
1. x=10
2. if [ x -ge 2 ]
3. then
4. echo $x
5. fi
Correct Answer:
Line 2 should be if [ $x -ge 2 ]
Note: This Question is unanswered, help us to find answer for this one
What is the output of the following program?
a=300
[ -n $a ]
echo $?
[ -z $a ]
echo $?
Correct Answer:
0 1
Note: This Question is unanswered, help us to find answer for this one
What is the output of the following program?
b= [ -n $b ]
echo $?
[ -z $b ]
echo $?
Correct Answer:
An error will occur
Note: This Question is unanswered, help us to find answer for this one
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
Correct Answer:
Line 1 should be until=$1
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
A number and a special symbol other than the underscore
Note: This Question is unanswered, help us to find answer for this one
Correct Answer:
( )
%
3-5
Note: This question has more than 1 correct answers
Note: This Question is unanswered, help us to find answer for this one
Unix Shell Script MCQs | Topic-wise