UNIX MCQ SET 7


1. When we are executing a shell script the shell acts as

a. An interpreter
b. A compiler
c. An operating system
d. None of the above

2. On executing a statement set -3+1

a. $1 would be -3
b. $1 would be –
c. $1 would be set
d. This command would result into an error

3. On executing the command Shift $v

a. The positional parameters would be shifted by the value of the variable v
b. The positional parameters would be shifted by 1
c. The positional parameters would not be shifted at all
d. This command would result into an error

4. Which of the following is NOT a shell keyword

a. Shift
b. Readonly
c. Unset
d. ls

5. To the statement read v1 v2 v3 we can supply

a. maximum 3 values
b. only 1 value
c. exactly 3 values
d. any number of values

6. The metacharacter $* represents

a. Number of parameters supplied at the command prompt
b. Parameters supplied at the command prompt
c. Value of the variable *
d. All files in the current directory

7. A shell variable cannot start with

a. An alphabet
b. A number
c. A special symbol other than an underscore
d. Both b and c above

8. Which of the following shows the correct hierarchy of arithmetic operations in shell

a. (),**,* or /, + or –
b. (), **, *,/,+,-
c. (),**,/,*,+,-
d. (),/,% or *,- or +

9. Which of the following statements is correct

a. a=expr $b + $c
b. a=’expr $b * $c’
c. a=’expr $b * ($c + $d)’
d. a=’expr $b \* \( $c + $d \)’

10. Which of the following is allowed in an arithmetic statement involving exprinstruction

a. []
b. {}
c. ()
d. None of the above

Correct Answers

1. A

2. D

3. A

4. D

5. D

6. B

7. D

8. D

9. D

10. C

Leave a comment