0% found this document useful (0 votes)
34 views2 pages

Quiz Session 7

Uploaded by

magi9999
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views2 pages

Quiz Session 7

Uploaded by

magi9999
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

1 How do you read the value stored in a variable named data?

a> #data
b> @data
c> $data
d> %data

Ans: c
2 Which of the following command will list the file(s) having ‘f’, ‘g’ or ’h’ in its name?
a> ls file*
b> ls file[fgh]
c> ls file[f-j]
d> ls file?

Ans b
3 Identify the command which will display the result of addition of two variables x and y in
a shell script.
a> echo `expr $a + $b`
b> echo ‘expr $a + $b’
c> echo `expr a + b`
d> echo expr $a + $b

Ans a
4 Identify the shell script statement that checks if command line parameters are passed to
the script
a> if [$# -eq 0]
b> if [$# -lt 0]
c> if [$# -ge 0]
d> if [$# -gt 0]

Ans d
5 A user has created a shell script named myscript.sh. Which of the following statement
will set the execute permission for the user to execute?
a> chmod u=x myscript.sh
b> chmod u-x myscript.sh
c> chmod x mysript.sh
d> chmod u+x myscript.sh

Ans d
6 Which of the following statement will execute the shell script myscript.sh?
a> /myscript.sh
b> ./myscript.sh
c> ./myscriptsh
d> .myscript.sh

Ans b

7 When working with a file named myfile, which of the following test switches checks if
the file is not empty?
a> If test -r myfile
b> If test -f myfile
c> If test -s myfile
d> If test -d myfile

Ans c
8 Which of the following for loop the control variable takes values from 10 to 15?
a> for (i=10;i<=15;i++)
b> for i in 10,11,12,13,14,15
c> for i in 10 11 12 13 14 15
d> for ((i=15;i>=10;i++))

Ans c
9 What is the representation for the default statement in case?
a> @)
b> ?)
c> %)
d> *)

Ans d
10 Which of the mathematical operators and mathematical statements are not equivalent?
a> -eq and =
b> -ne and !=
c> -gt and >
d> -le and <=

Ans a

You might also like