MCQs Computer Systems Analyst

By: Prof. Fazal Rehman Shamil
Last modified on April 22nd, 2021

Solved MCQs of Command Substitution and Shell Variables in UNIX for Computer Systems Analyst.

Command Substitution and Shell Variables MCQs

Use of what is recommended by POSIX instead of archaic command for command substitution?
(A). |
(B). $
(C). %
(D). #
(E). None of these
Multiple Choice Question Answer: b


Using $ recommended by POSIX, which shell doesn’t support the command substitution?
(A). Korn
(B). bash
(C). bourne
(D). C
(E). None of these
Multiple Choice Question Answer: c


By using what a variable can be removed?
(A). bash
(B). read-only
(C). del
(D). unset
(E). None of these
Multiple Choice Question Answer: d


When we evaluate the following statement What will be the result?
$ directory=’pwd’=pwd
(A). erroneous
(B). undefined output
(C). the output of a pwd command along with string pwd=
(D). the directory variable will hold the string pwd
(E). None of these
Multiple Choice Question Answer: c


To protect a variable from reassignment we can use read-only command.
(A). True
(B). False
(C). Partially True
Multiple Choice Question Answer: a


Which command is used by C shell to assign the values to variables?
(A). =
(B). unset
(C). set
(D). $
(E). None of these
Multiple Choice Question Answer: c


The variable assignment as x = 10 will work if we don’t use the C shell.
(A). False
(B). True
(C). Partially True

Multiple Choice Question Answer: a


What is not a system-defined variable?
(A). $cd
(B). $HOME
(C). $SHELL
(D). $PATH
(E). None of these
Multiple Choice Question Answer: a


An invalid variable is ____
(A). _user
(B). -txtfile
(C). us01
(D). txt123
(E). None of these
Multiple Choice Question Answer: b


The command substitution requires the command to use what?
(A). standard output
(B). standard input
(C). standard error
(D). all of the mentioned
(E). None of these
Multiple Choice Question Answer: a


The following command is valid.
$ ls -lRa $HOME > home.ls
(A). True
(B). False
(C). Partially True
Multiple Choice Question Answer: a


To assign the value to the variables which symbol do we use?
(A). $
(B). =
(C). &
(D). @
(E). None of these
Multiple Choice Question Answer: b


For the evaluation of variables which symbol do we use?
(A). @
(B). &
(C). =
(D). $
(E). None of these
Multiple Choice Question Answer: d


What is the correct initialization of variables to the null strings?
(A). x=
(B). x=, x=’ ‘, x=” “
(C). x=” “
(D). x=’ ‘
(E). None of these
Multiple Choice Question Answer: b


One or more arguments to be obtained from the standard output of another command enabled by Shell. What is this feature called?
(A). korn
(B). argument substitution
(C). shell substitution
(D). command substitution
(E). None of these
Multiple Choice Question Answer: d


In command substitution, which meta-character is used?
(A). “
(B). ‘
(C). `
(D). >
(E). None of these
Multiple Choice Question Answer: c


The Command substitution is also enabled in the single quote.
(A). True
(B). False
(C). Partially True
Multiple Choice Question Answer: b