Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

51.

To change the login shell in some system (like Linux) we can use ____ command.(a) chshell(b) chshl(c) chsh(d) chI have been asked this question during an interview.I would like to ask this question from Shell Basics in chapter The Shell of Unix

Answer»

Correct choice is (c) chsh

For explanation I would SAY: Some systems, offer the chsh COMMAND that can change the USER’s login shell. This command will accept the full pathname of an executable file on the system. -s option is USED with chsh command. However, it will ISSUE a warning if the shell is not listed in the /etc/shells file. For example,

52.

Wildcards are special characters which are used to replace or represent one or more characters.(a) True(b) FalseI got this question in an interview for job.My enquiry is from Pattern Matching, Escaping and Quoting in division The Shell of Unix

Answer»

Right choice is (a) True

To explain: A WILDCARD is a SPECIAL character which can be used as a substitute for any of a class of characters, which increases the flexibility and efficiency of searching and replacing. For example, to remove all the files with a FILENAME starting with ‘CHAP’ prefix, we can use the COMMAND rm chap*. Here * is used as a wildcard for matching all filenames starting with ‘chap’.

53.

Which of the following expression is a correct wildcard pattern if we want an expression in which the last character is not numeric?(a) *[!0](b) *[0-9](c) [0-9](d) *[!0-9]I have been asked this question during a job interview.Question is taken from Shell Basics in division The Shell of Unix

Answer» CORRECT OPTION is (d) *[!0-9]

Explanation: Wildcards are used for PATTERN matching. The COMMAND *[!0-9] will match all expression containing any characters except that the last CHARACTER entered is not numeric. Here ‘!’ is used for NOT.
54.

The shell waits for the command to complete and normally can’t do any work while the command is executing.(a) True(b) FalseThe question was asked during an internship interview.Origin of the question is Shell Basics topic in section The Shell of Unix

Answer»

Right choice is (a) True

For explanation: After the shell has issued the prompt and the scanning for meta-characters has been performed it passes the command on the command LINE to the kernel for execution. After that, the shell waits for the command to COMPLETE its execution and normally we can’t do any other WORK while the command is executing.

55.

Which of the following is/are true about Shell?(a) Shell is a multi-faceted program(b) Shell is a command interpreter(c) Shell provides us with an environment to work in(d) Shell is a multi-faceted, command interpreter and provides an environment to work inThis question was addressed to me in unit test.Enquiry is from Shell Basics in section The Shell of Unix

Answer»

Correct choice is (d) Shell is a multi-faceted, command interpreter and provides an environment to work in

The explanation is: Shell is the agency that SITS between the user and the UNIX system. It is a unique and multi-faceted program. It is ALSO called command-interpreter because it interprets our command entered. It is also a programming language. From ANOTHER point of view, the shell also provides US with an environment to work in.

56.

In Shell’s interpretive cycle, the shell first scans for ____ in the entered command.(a) characters(b) priority(c) meta-characters(d) wildcardsI got this question in an international level competition.This interesting question is from Shell Basics in section The Shell of Unix

Answer»

Right choice is (c) meta-characters

The BEST explanation: In Shell’s interpretive CYCLE, the shell first issues a prompt and waits for the user to enter the command. After the command is entered, the shell SCANS the command line for meta-characters and expands the ABBREVIATIONS (like the * in rm*) to recreate a simplified command line.

57.

Which shell is the most common and best to use?(a) Korn shell(b) POSIX shell(c) C shell(d) Bash shellI have been asked this question in homework.My question is based upon Shell Basics in portion The Shell of Unix

Answer»

Right CHOICE is (d) BASH shell

The explanation: Bash is near POSIX-compliant and probably the best shell to use. It is the most common shell used in UNIX systems. Bash is an ACRONYM which stands for –“Bourne Again SHell”. It was first released in 1989 and was distributed widely as the DEFAULT login shell for most Linux distributions.

58.

Which command does not terminates unless we log out of the system?(a) history(b) shell(c) echo(d) loginI have been asked this question in an interview for job.My question is based upon Shell Basics in section The Shell of Unix

Answer»

Correct choice is (b) SHELL

Explanation: When we log on to a UNIX system, we first see a PROMPT. This prompt remains there until we key in something. EVEN when we think the system is idling, a UNIX command is always RUNNING at the terminal. This command is known as the shell. The shell is with US all the time and doesn’t terminates unless we log out.

59.

Which one of the following command will display the name of the shell we are working on?(a) echo shell(b) echo $(c) echo $SHELL(d) echo $$This question was addressed to me in examination.Question is from Shell Basics in portion The Shell of Unix

Answer»

Correct OPTION is (c) echo $SHELL

Explanation: When we run the command echo $SHELL, it will DISPLAY the current shell on which we are WORKING. The output of the command is the absolute pathname of the shell’s command file. If $SHELL EVALUATES to/bin/BASH, our login shell is bash.

60.

What is the default symbol for command prompt in C shell?(a) $(b) %(c) #(d) @The question was asked during an interview.This interesting question is from Shell Basics in portion The Shell of Unix

Answer» RIGHT option is (b) %

The explanation is: If we are using C SHELL on our SYSTEM, then the default prompt will be REPRESENTED by %.
61.

What is the default symbol for command prompt in Bourne shell?(a) $(b) %(c) #(d) @The question was asked during an interview.The query is from Shell Basics topic in section The Shell of Unix

Answer» CORRECT ANSWER is (a) $

The explanation is: If we are using BOURNE shell on our system, then the default prompt will be REPRESENTED by $.
62.

In UNIX there are ___ major types of shells.(a) 2(b) 3(c) 4(d) manyThis question was addressed to me in final exam.This interesting question is from Shell Basics topic in division The Shell of Unix

Answer»

The correct ANSWER is (a) 2

Best explanation: In UNIX, there are two MAJOR types of shells.

•Bourne shell

•C shell

These two categories are further divided into subcategories.

Bourne shell has the following subcategories:-

•Bourne shell (sh)

•Korn shell (ksh)

•Bourne Again shell (BASH)

•POSIX shell (sh)

C shell has the following subcategories:-

•C shell (CSH)

•TENEX/TOPS C shell (tcsh)

63.

There can be multiple kernels on a single UNIX system.(a) True(b) FalseI got this question in quiz.The query is from Shell Basics topic in portion The Shell of Unix

Answer»

The correct answer is (b) False

Easy explanation: There cannot be multiple KERNELS running on a SINGLE UNIX SYSTEM, however, there can be multiple shells in action –each for a user who is logged in. There is only and only one kernel with which every SHELL interact in a UNIX system.

64.

The prompt issued by the shell is called ______(a) prompt(b) command translator(c) command prompt(d) command executorI got this question during an internship interview.My question comes from Shell Basics in chapter The Shell of Unix

Answer»

The CORRECT ANSWER is (c) command prompt

Easiest explanation: The prompt issued by the shell is called a command prompt which is represented by $. However, the symbol for the command prompt DIFFERS according to the shell on which we are WORKING. When the command prompt is displayed, we can type any command followed by an Enter for performing our task.

65.

On a UNIX system, there can be ____ shells running simultaneously.(a) 1(b) 2(c) many(d) 4This question was addressed to me in an online interview.This intriguing question comes from Shell Basics topic in chapter The Shell of Unix

Answer»

Right answer is (c) many

Easiest explanation: Even though there is only one kernel running on our system, there can be multiple shells running in action –one for each user who is logged in. As we know that computers don’t have any INHERENT CAPABILITY of TRANSLATING COMMANDS into actions, this piece of a TASK is performed by the command interpreter –known as the shell.

66.

Shell provides us with an interface to the operating system.(a) True(b) FalseThe question was posed to me in homework.This is a very interesting question from Shell Basics in division The Shell of Unix

Answer»

The correct option is (a) True

Easy explanation: Shell PROVIDES us with an interface to communicate with the UNIX operating system. It is also called command interpreter because it gathers our INPUT and EXECUTES commands accordingly. In simple words, it is actually the interface between the user and the kernel and has the CAPABILITY of translating commands into ACTIONS.