Shell Scripting/Shell Scripting Mcq Question Set 1 Sample Test,Sample questions

Question:
 Given x=10 then, The given statement is ____

1.True

2. False

3.all of the above

4.None of the mentioned


Question:
 In UNIX there are ___ major types of shells.

1.2

2.3

3.4

4.many


Question:
 On a UNIX system, there can be ____ shells running simultaneously.

1. 1

2.2

3.many

4. 4


Question:
 Shell scripts need to be saved with an extension .sh .

1.True

2.False

3.all of the above

4.None of the mentioned


Question:
 The first argument is read by the shell into the parameter ___

1.1$

2.$3

3.$$

4.$1


Question:
 The prompt issued by the shell is called ______

1.prompt

2.command translator

3. command prompt

4.command executor


Question:
 The ____ allows us to read data from the same file containing the script.

1.>>

2. <<

3.!!

4.—


Question:
 We can use the here document with interactive programs also.

1.True

2. False

3.all of the above

4.None of the mentioned


Question:
 What is the default symbol for command prompt in C shell?

1. $

2.%

3. #

4.@a = split(/s/, $str).


Question:
 Where is the exit status of a command stored?

1.$0

2. $>

3.$1

4. $?


Question:
 Which command is used for changing filename extensions?

1.chown

2.rename

3.basename

4.rm


Question:
 Which of the following is false?

1.here document provides standard input to any script non interactively

2.read command is used for making scripts interactive

3.$* stores the number of arguments specified

4.&& and || are logical operators


Question:
 Which of the following loop statements uses do and done keyword?

1. for

2.while

3.case

4.for and while


Question:
A shell script stopped running when we change its name. Why?

1. location of the file changed

2. we can’t change the name of the script

3. $0 was used in the script

4. many possible reasons


Question:
A single read statement can be used with one or more variables.

1. True

2.False

3.all of the above

4.None of the mentioned


Question:
Any command using standard input can take the input from here document.

1.True

2.False

3.all of the above

4.None of the mentioned


Question:
Every time shift command is used, the leftmost variable is lost.

1.True

2.False

3.all of the above

4.None of the mentioned


Question:
In Shell’s interpretive cycle, the shell first scans for ____ in the entered command.

1.characters

2. priority

3.meta-characters

4.wildcards


Question:
read command is shell’s internal tool.

1.True

2.False

3.all of the above

4.None of the mentioned


Question:
Shell provides us with an interface to the operating system.

1.True

2.False

3.all of the above

4.None of the mentioned


Question:
Shell scripts are executed in a separate child shell process.

1. True

2. False

3.all of the above

4.None of the mentioned


Question:
Suppose x =10, then what will be the value of x$x$?

1.undefined

2.erroneous

3.100

4.x10$


Question:
test statement cannot ______

1.compare two numbers

2.compare two strings

3.compare two files

4.check a file’s attributes


Question:
The complete set of positional parameters is stored in ______ as a single string.

1. $n

2.$#

3. $*

4.$$


Question:
The first line in any shell script begins with a _____

1. &

2. !

3.$

4. #


Question:
The shell waits for the command to complete and normally can’t do any work while the command is executing.

1.True

2. False

3.all of the above

4.None of the mentioned


Question:
There can be multiple kernels on a single UNIX system.

1.True

2.FALSE

3.all of the above

4.None of the mentioned


Question:
To run the script, we should make it executable first by using _____

1.chmod +x

2.chmod +r

3.chmod +w

4.chmod +rwx


Question:
To spawn a child of our own choice for running the script, we can use ___ command.

1.ps

2.pr

3.sh

4.$$


Question:
until loop operates with a reverse logic as used in while loop.

1.True

2.False

3.all of the above

4.None of the mentioned


Question:
What are positional parameters?

1. special variables for assigning arguments from the command line

2. pattern matching parameters

3.special variables for reading user input

4.special variables and patterns


Question:
What is a shell script?

1.group of commands

2.a file containing special symbols

3. a file containing a series of commands

4.group of functions


Question:
What is the default symbol for command prompt in Bourne shell?

1. $

2.%

3.#

4. @


Question:
Which command does not terminates unless we log out of the system?

1.history

2.shell

3.echo

4.login


Question:
Which command is used by the shell for manipulating positional parameters?

1.set

2. cut

3.case

4. paste


Question:
Which command is used for making the scripts interactive?

1.ip

2.input

3.read

4.Write (append)


Question:
Which of the following command doesn’t accept a filename as an argument?

1. cut

2.ls

3.paste

4.mailx


Question:
Which of the following commands let us perform a set of instructions repeatedly?

1.for

2.while

3.until

4. for, while, until


Question:
Which of the following expression is a correct wildcard pattern if we want an expression in which the last character is not numeric?

1. *[!0]

2. *[0-9]

3.[0-9]

4.*[!0-9]


Question:
Which of the following is used for storing the number of positional parameters?

1.$n

2.$#

3. $*

4.$2


Question:
Which of the following keywords are used in while loop?

1. do

2.done

3.then

4.do and done


Question:
Which of the following option is used with a set for debugging shell scripts?

1.-a

2.-x

3.-d

4.-e


Question:
Which one of the following command will display the name of the shell we are working on?

1.echo shell

2.echo $

3. echo $SHELL

4.echo $$


Question:
Which one of the following is an internal command?

1.cut

2.expr

3. set

4.isMaster


Question:
Which one of the following is used for looping with a list?

1.while

2.until

3.case

4.for


Question:
Which shell is the most common and best to use?

1.Korn shell

2.POSIX shell

3. C shell

4. Bash shell


Question:
Which symbol is used with the set command for command substitution?

1. –

2. —

3. ??

4. _


Question:
___ option is used with a test for checking if the file exists and has the size greater than zero.

1. -f

2. -r

3.-e

4. -s


Question:
____ command is the appropriate way to interrupt a program.

1. kill

2.SIGKILL

3. INT

4. trap


Question:
____ statement is used for shifting arguments left.

1. set

2. shift

3.cut

4. paste


More MCQS

  1. Shell Scripting Mcq Question Set 1
  2. Shell Scripting Mcq Question Set 2
  3. Shell Scripting Mcq Question Set 3
  4. Shell Scripting Mcq Question Set 4
Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!