A shell script is executed by:
a code generator. 0.0%
an assembler. 0.0%
an interpreter. 100.0%
a compiler. 0.0%
A shell variable cannot start with:
An alphabet 0.0%
An underscore 0.0%
A number and an underscore 0.0%
An alphabet and an underscore 0.0%
A number and a special symbol other than the underscore 100.0%
If x=11 and y=6, then what is the exit status of the following expression? [ ! $x -gt 9 -a ! $y -ne 23 ]
0 50.0%
1 50.0%
2 0.0%
3 0.0%
4 0.0%
If x=11 and y=6, then what is the exit status of the following expression? [ $x -eq 11 -a $y -ne 89 ]
0 75.0%
1 25.0%
2 0.0%
3 0.0%
4 0.0%
On executing the statement: set -3 + 1
$1 would be -3 0.0%
$1 would be 1 0.0%
$1 would be - 0.0%
$1 would be set 0.0%
An error would occur 100.0%
Precedence hierarchy decides which operator:
is used last. 0.0%
is used first. 100.0%
is unary type i.e. the operators that operate on single operand. 0.0%
is binary type i.e. the operators that operate on two operands. 0.0%
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 < ...
It would not read any file 0.0%
It would read all the files in reverse order 0.0%
It would read only the test0.sh 0.0%
It would read only test3.sh 100.0%
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 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. 100.0%
Only the first positional parameter would be shifted to left position. 0.0%
All of the positional parameters would be shifted by one position towards right i.e. parameter 2 will have value of parameter 3, parameter 3 will have value of parameter 4 and so on. 0.0%
It would result in an error. 0.0%
The break statement is used to exit from:
the script. 0.0%
a "for" loop. 100.0%
an "if" statement. 0.0%
the shell. 0.0%
the "case" construct. 0.0%
The exit statement is used in a loop to:
exit from the "for" or "while" loop. 0.0%
exit from the "case" construct. 0.0%
terminate the execution of a script. 100.0%
exit from an "if" statement. 0.0%
The expression expr -2 % 7 evaluates to:
1 0.0%
2 0.0%
-2 100.0%
0 0.0%
0.285 0.0%
The expression expr -7 % 2 evaluates to:
0 0.0%
1 0.0%
-1 100.0%
2 0.0%
-2 0.0%
The statement z=`expr 5 / 2` would store which of the following values in z?
0 0.0%
1 0.0%
2 100.0%
2.5 0.0%
3 0.0%
What is the error in the following loop statement? while [ $1 -gt 10 -a ($2 -o -w $3 ) ]
There is no error 100.0%
( ) brackets are to be used instead of [] 0.0%
{} brackets are to be used instead of [] 0.0%
One cannot use -gt and -o in the same expression 0.0%
One cannot use -o and -w in the same expression 0.0%
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
There is no error 0.0%
Line 1 should be j=$1 0.0%
Statements on lines 3 and 4 should be between curly brackets 0.0%
Line 4 should be echo {$j} 0.0%
Line 5 should be j=`expr $j + 1` 100.0%
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
One cannot declare two variables on line 1 0.0%
Statements on lines 4 and 5 must appear with curly braces {} 0.0%
On line 2, test should be used instead of [] 0.0%
There is no error 100.0%
On line 2 -ge should be used instead of >= 0.0%
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
There is no error. 0.0%
Variable declaration on line 1 is incorrect. 0.0%
The variables to be outputted on line 7 should be enclosed within quotes. 0.0%
Output will be 10 12 with a warning message in line 2 100.0%
fi should be replaced by endif on line 6 0.0%
What is the error in the following program? 1. while who | grep aa12 | wc -l 2. do 3. echo false 4. done
There is no error 100.0%
Condition on line 1 is invalid 0.0%
Line 3 should be echo "false" 0.0%
Line 3 should be enclosed with {} 0.0%
Line 3 should be echo {false} 0.0%
What is the error in the following program? 1. x=10 2. if [ x -ge 2 ] 3. then 4. echo $x 5. fi
There is no error 0.0%
Line 4 should be echo x 0.0%
Test should be used on line 2 instead of [] 0.0%
Line 1 should be x={10} 0.0%
Line 2 should be if [ $x -ge 2 ] 100.0%
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
There is no error 0.0%
Variable declaration on line 1 is incorrect 0.0%
The statement to be printed with echo on line 4 should be within curly brackets 0.0%
fi should be replaced by endif on line 5 0.0%
On line 2, [a=b] should be replaced with [ $a -eq $b ] 100.0%
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
Line 1 should be until=$1 0.0%
Until cannot be used as a variable name 0.0%
There is no error 100.0%
Line 4 should be echo "until cannot be used as a variable name" 0.0%
Line 4 should be enclosed within { } 0.0%
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...
any directory name 100.0%
cobol directory name 0.0%
fortran directory name 0.0%
pascal directory name 0.0%
An error will occur 0.0%
What is the output of the following program? a=300 [ -n $a ] echo $? [ -z $a ] echo $?
1 2 0.0%
0 2 0.0%
2 3 0.0%
0 0 0.0%
0 1 100.0%
What is the output of the following program? i=4 z=12 [ $i = 5 -a $z -gt 5 ] echo $?
0 0.0%
1 100.0%
2 0.0%
3 0.0%
4 0.0%
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
1 and a warning about line 2 will occur 0.0%
3 and a warning about line 2 will occur 0.0%
5 and a warning about line 2 will occur 100.0%
10 and a warning about line 2 will occur 0.0%
An error will occur 0.0%
What is the output of the following program? b= [ -n $b ] echo $? [ -z $b ] echo $?
1 1 0.0%
2 2 0.0%
0 0 100.0%
0 1 0.0%
An error will occur 0.0%
What is the output of the following program? for i in 'a b c d e' do echo $i done
An error will occur 0.0%
5 0.0%
e d c b a 0.0%
a b c d e 0.0%
a b c d e 100.0%
What is the output of the following program? for i in a b c d e do echo $i done
5 0.0%
1 2 3 4 5 0.0%
a b c d e 100.0%
e d c b a 0.0%
An error will occur 0.0%
a b c d e 0.0%
What is the output of the following program? i=1 for [ i -le 10 ] do echo $i i='expr $i + 1' done
An error will occur 100.0%
1 0.0%
2 0.0%
5 0.0%
10 0.0%
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...
An error will occur 0.0%
3 4 5 0.0%
2 2 2 0.0%
2 3 4 0.0%
1 1 1 100.0%
What is the output of the following program? k=35 echo `[ $k -eq 35 ]``[ $k -eq 50 ]`
1 1 0.0%
0 0 0.0%
0 1 0.0%
An error will occur 0.0%
A blank line will result 100.0%
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 ...
Dec terminal 100.0%
Old terminal 0.0%
commonly used terminal 0.0%
vt series terminal 0.0%
Any terminal 0.0%
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
x=3 y=1 z=1 0.0%
x=3 y=0 z=0 0.0%
x=3 y=3 z=5 0.0%
x=3 y=2 z=1 0.0%
None of the above 100.0%
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
Diamond 0.0%
Spade 0.0%
Heart 100.0%
Club 0.0%
An error will occur 0.0%
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
An error will occur 0.0%
No output will be displayed 0.0%
dog 0.0%
dog parrot cuckoo 0.0%
dog parrot cuckoo 100.0%
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
An error will occur 0.0%
dog 0.0%
cuckoo 0.0%
cuckoo parrot dog 0.0%
dog parrot cuckoo 100.0%
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
An error will occur 0.0%
Unix shell scripting 0.0%
shell 0.0%
The names of all files in the current directory would be displayed 100.0%
What would be the condition to check whether file with name "xyz" is a regular file?
if [ -f xyz ] 100.0%
if [ -d xyz ] 0.0%
if [ -v xyz ] 0.0%
if [ -r xyz ] 0.0%
if [ -e xyz ] 0.0%
Which of the following assignments is illegal?
a='cat file' 0.0%
b=100 0.0%
c=50 0.0%
d = 25 100.0%
e='ls' 0.0%
a=`ls` 0.0%
b=`ls -l` 0.0%
c=`1972` 100.0%
d=`who` 0.0%
e=`who | grep aa1` 0.0%
Which of the following expressions is correct?
a=expr $b + $c 0.0%
a=`expr $b * $c` 0.0%
a=`expr $b * ( $c + $d )` 0.0%
a=expr $c * $d 0.0%
a=`expr $b * ( $c + $d )` 100.0%
Which of the following expressions is valid?
t = 256 (space on both sides of '=' operator) 0.0%
3.14 * $r * $r = area 0.0%
k=`expr a*b` 0.0%
tput cup $row $col 100.0%
Which of the following is not a shell keyword?
shift 0.0%
readonly 0.0%
ls 100.0%
unset 0.0%
echo 0.0%
Which of the following is true about "until" loop?
The condition is tested at the end. 0.0%
It is executed as long as the given condition or list of items evaluate to true. 100.0%
It cannot test for conditions. 0.0%
We cannot use exit statement under until loop. 0.0%
Which of the following is true about the "continue" statement?
It cannot be used inside a loop. 0.0%
It continues the control to the beginning of the loop, bypassing the statements below it, inside the loop. 100.0%
It can only be used in a while loop. 0.0%
It has to be associated with an if statement. 0.0%
It is used with the case construct. 0.0%
Which of the following is/are allowed in an arithmetic statement involving expr command?
<> 0.0%
{} 0.0%
( ) 50.0%
&& 0.0%
% 50.0%
Which of the following is/are correct declaration(s) of a null variable "a" in shell script?
a= 100.0%
a= '' 0.0%
a= "" 0.0%
All of the above. 0.0%
Which of the following lines have an error? 1. echo enter your name 2. read filename 3. read name < $filename 4. echo $name
1 0.0%
2 0.0%
3 0.0%
4 0.0%
There is no error. 100.0%
Which of the following loops is invalid?
while [ $? -eq 0 ] 0.0%
while [ $count -le 0.1] 0.0%
while [ $1 -gt 10] 0.0%
while [ 0 ] 0.0%
while $ 100.0%
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.
( ) , ** , * or / , + or - 0%
( ) , * or / , ** , + or - 0%
( ) , ** , + or - , * or / 0%
** , ( ) , + or - ,* or / 0%
Which of the following statements is false?
Output of echo statement can be redirected to a file. 0.0%
Shell variables are case sensitive. 0.0%
Programs written for Bourne shell are compatible with Korn shell. 100.0%
expr can handle only integers. 0.0%
Comments can be split over multiple lines if each line is preceded by #. 0.0%
Which of the following statements is incorrect regarding if-then-fi?
It is a decision making construct. 0.0%
The group of commands between the then and else forms the if block. 0.0%
The else block is optional. 0.0%
The indentation is done in the if-then-fi to improve readability. 0.0%
The indentation is mandatory otherwise an error will occur on execution. 100.0%
Which of the following statements is true?
While executing a shell script, the shell acts as a compiler. 0.0%
Variables declared in a shell script can be displayed at the dollar prompt using the set command. 0.0%
There is no restriction on the length of a shell variable name. 100.0%
Any shell script by default gets executed in the current shell. 0.0%
A shell variable cannot hold negative values. 0.0%
Which of the following variable names is invalid?
_newvar 0.0%
variable 0.0%
#regpay 100.0%
expr 0.0%