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

Question:
 $# is used to show?

1.The number of arguments supplied to a script.

2.The filename of the current script.

3.The exit status of the last command executed.

4.The process number of the last background command


Question:
 How many types of files are there in Unix?

1.2

2. 3

3.4

4.5


Question:
 The original Unix shell was written by _____

1.Stephen R. Bourne

2.Stephen R. Korn

3.Stephen R. C.

4.Stephen Watson


Question:
 What is the associated file descriptor for stdout?

1.0

2.1

3.2

4. -1


Question:
 What is the syntax of break command that can also be used to exit from a nested loop?

1. break

2. break loop

3.break n

4.break n+i


Question:
 What is the use of -z string operator in bourne shell?

1.Checks if the value of two operands are equal or not

2. Checks if the given string operand size is zero

3. Checks if the given string operand size is zero

4.Checks if the given string operand size is non-zero


Question:
 Which of the following statements that are used to control shell loops?

1.break

2.continue

3.Both A and B

4. None of the above


Question:
 _____ and _____ cannot be used in a filename.

1. /, NULL

2. $,^

3.., %

4.NULL, $


Question:
A loop may continue forever if the required condition is not met is known as _______

1. finite loop

2.infinite loop

3.simple loop

4.definate loop


Question:
A shell variable is capable enough to hold a single value. These variables are called _____

1.vector variables

2.scalar variables

3.array variables

4.none of the above


Question:
Each entry of directory file has component(s) namely _____.

1.filename

2.inode number

3.file size

4.Both a and b


Question:
How many prompt shell has?

1.4

2.2

3.3

4. 5


Question:
How many stream Unix program has?

1.2

2.3

3.4

4.5


Question:
In relational operator, which keyword is used to represent greater than or equal?

1.-eq

2.-gte

3. -ge

4. -gt


Question:
The complete expr and awk expression should be enclosed between _____

1. ()

2.. " "

3. ' '

4.< >


Question:
The most common file type is ___.

1.ordinary file

2.directory file

3.device file

4. ordinary file and directory file


Question:
The name of a variable can contain ________.

1.numbers

2. letters

3. underscore character

4.All of the above


Question:
The original Unix shell was written in the mid _______

1. 1960s

2.1970s

3.1980s

4.1990s


Question:
The _______ loop executes the given commands until the given condition remains true.

1. For loop

2.While loop

3. until loop

4.Both b and c


Question:
Unix shell variables will have their names in _____.

1.Uppercase

2. Lowercase

3.First character Uppercase and all other character Lowercase

4. First character Lowercase and all other character Uppercase


Question:
We cannot use the unset command to unset variables that are marked _______

1.read

2.write

3.readonly

4.writeonly


Question:
What is the syntax of array initialization when you are using bash shell?

1.array_name[index]=value

2.set -A array_name value1 value2 ... Valuen

3. array_name=(value1 ... valuen)

4. ${array_name[index]}=value


Question:
What is the syntax of array initialization when you are using ksh shell?

1. array_name[index]=value

2. set -A array_name value1 value2 ... Valuen

3. array_name=(value1 ... valuen)

4.${array_name[index]}=value


Question:
what is the syntax to access array values?

1.${array_name[index]}

2. #{array_name[index]}

3.$${array_name[index]}

4. $[array_name{index}]


Question:
What is the use of -e file test operator in korn shell?

1. Checks if file is a directory

2.Checks if file is an ordinary file as opposed to a directory or special file

3.Checks if file exists

4.Checks if file is executable


Question:
What is the use of str operator in bourne shell?

1.Checks if str is not the empty string

2.Checks if the given string operand size is non-zero

3.Checks if the given string operand size is zero

4. Checks if the value of two operands are equal or not


Question:
What is the used of -x file test operator?

1.Checks if file is executable

2. Checks if file has size greater than 0

3.Checks if file exists

4.Checks if file has its Set User ID (SUID) bit set


Question:
What is true about array variable in Shell?

1.Shell supports a different type of variable called an array variable.

2.array variable can hold multiple values at the same time.

3.Arrays provide a method of grouping a set of variables

4.All of the above


Question:
What will be the output of $date?

1. Yesterday date

2.Current date

3.Current date and time

4.Tomarrow date and time


Question:
Whch of the following is invalid variable names?

1.VAR_1

2. _ALI

3.VAR1

4. VAR_A!


Question:
Which command is used to list all the files?

1.ld

2. lr

3.ls

4.lp


Question:
Which external program used by bourne shell to perform simple arithmetic operations?

1.awk

2.expr

3.sum

4.Both a and b


Question:
Which File test operator is used to checks if file has its sticky bit set?

1. -g

2.-k

3.-p

4.-a


Question:
Which keyword is used to remove the variable?

1.remove

2. readonly

3. unset

4.delete


Question:
Which of the boolean operator is supported in bourne shell?

1.and

2. or

3.not

4.All of the above


Question:
Which of the following code is used to print elements in range?

1. ${arr[@]:1:4}

2.${arr[@]}

3.${arr[*]}

4.Both A and C


Question:
Which of the following code will count Length of in Array?

1.${#arr[0]}

2.${#arr}

3.${#arr[#]}

4.Both a and b


Question:
Which of the following command is used to display the environment variables only?

1. sh

2. set

3.env

4.var


Question:
Which of the following is correct code to search in array?

1. ${arr[@]/*[aA]*/}

2. ${arr[#]/*[aA]*/}

3. ${arr[*]/*[aA]*/}

4.Both A and C


Question:
Which of the following is correct syntax for defining array values?

1.array_name{index}=value

2.array_name(index)=value

3.array_name[index]=value

4.. [index]array_name=value


Question:
Which of the following is not a type of shell?

1.The C Shell

2.The Korn Shell

3.The Bourne Shell

4.None of the mentioned


Question:
Which of the following is true about files?

1.All data in Unix is organized into files.

2.All files are organized into directories.

3.The directories are organized into a tree-like structure called the filesystem.

4.All of the above


Question:
Which of the following is true about shell?

1.A Shell provides you with an interface to the Unix system.

2.Shell gathers input from you and executes programs based on that input.

3.Shell is an environment in which we can run our commands, programs, and shell scripts.

4. All of the above


Question:
Which of the following loops is not available in shell?

1.The for loop

2.The until loop

3. The select loop

4.The foreach loop


Question:
Which of the following operator is not supported in Bourne shell?

1. Arithmetic Operators

2.Boolean Operators

3.Character operators

4. File Test Operators


Question:
Which of the following statement is supported in unix shell?

1.case

2.Switch

3.switch...case

4.case...esac


Question:
Which of the following statement is used to terminate the execution of the entire loop?

1.continue

2. terminate

3.this

4.break


Question:
Which of the following symbol represents the current directory?

1.Double dot (..)

2.Dollar dot($.)

3.Single dot (.)

4.Hash dot(#.)


Question:
Which of the following syntax is used for creating files in VI editor?

1.$# vi filename

2. $ vi filename

3. # vi filename

4.& vi filename


Question:
Which of the following syntax is used to access all the items in an array?

1.${array_name[*]}

2. ${array_name[@]}

3. ${array_name[$]}

4. Both A and B


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!