InterviewSolution
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.
| 101. |
test command can be used to check which of the following?(a) Compare two numbers(b) Compare two strings(c) Check attributes of a file(d) All of the mentionedI had been asked this question in an interview for job.The query is from Using test and [ ] to Evaluate Expressions in division Essential Shell Programming of Unix |
|
Answer» CORRECT answer is (d) All of the mentioned To explain I would say: When we use if to evaluate expressions, we need the test statement because the true or false values RETURNED by expressions can’t be directly handled by if. The test uses certain operators to evaluate the condition on its right and returns EITHER true or false exit status. test works in three ways: •compares two numbers •compare two strings or a SINGLE ONE for a null value •check a file’s attributes |
|
| 102. |
To check more than two conditions, ___ is used with if-else statements.(a) while(b) for(c) elif(d) forI have been asked this question in an interview for internship.I want to ask this question from Logical Operators and Conditional Execution in chapter Essential Shell Programming of Unix |
|
Answer» Correct choice is (c) elif |
|
| 103. |
To know the exit status of a command, we can use ____(a) $$(b) $*(c) $?(d) $-The question was posed to me in quiz.My query is from Logical Operators and Conditional Execution topic in chapter Essential Shell Programming of Unix |
|
Answer» Right option is (c) $? |
|
| 104. |
The name of the script is stored in which special parameter?(a) Dollar 1(b) Dollar 0(c) Dollar #(d) Dollar *The question was posed to me in my homework.This interesting question is from Logical Operators and Conditional Execution topic in section Essential Shell Programming of Unix |
|
Answer» The correct option is (B) DOLLAR 0 |
|
| 105. |
To perform decision depending on the fulfillment of certain criteria, ____ is used.(a) if(b) else(c) for(d) if and elseThis question was addressed to me by my college professor while I was bunking the class.I'd like to ask this question from Logical Operators and Conditional Execution topic in section Essential Shell Programming of Unix |
|
Answer» CORRECT OPTION is (d) if and else To explain: The if and else STATEMENT makes two-way decisions depending on the FULFILLMENT of certain criteria. These statements are used in UNIX as they are used in other programming languages. For example, |
|
| 106. |
Every if is closed with a corresponding ____(a) else(b) fi(c) if(d) else ifThe question was posed to me in a job interview.I'd like to ask this question from Logical Operators and Conditional Execution topic in division Essential Shell Programming of Unix |
|
Answer» Right answer is (B) FI |
|
| 107. |
The syntax for using && is ______________(a) cmd1 && cmd2(b) cmd1 cmd2 &&(c) cmd1 & cmd2&(d) cmd1I got this question during an internship interview.This interesting question is from Logical Operators and Conditional Execution in section Essential Shell Programming of Unix |
|
Answer» Correct CHOICE is (a) cmd1 && cmd2 |
|
| 108. |
Which of the following is used for storing the number of positional parameters?(a) $n(b) $#(c) $*(d) $2This question was addressed to me during an online exam.The origin of the question is Shell Programming using read Command and Command Line Arguments topic in division Essential Shell Programming of Unix |
|
Answer» Correct choice is (B) $# |
|
| 109. |
When we use ||, both the commands are executed.(a) True(b) FalseI got this question in an international level competition.My question is from Logical Operators and Conditional Execution topic in portion Essential Shell Programming of Unix |
|
Answer» Right option is (B) False |
|
| 110. |
When we use &&, the second command is executed only when first succeeds.(a) True(b) FalseThis question was posed to me during a job interview.My question is taken from Logical Operators and Conditional Execution in chapter Essential Shell Programming of Unix |
|
Answer» The CORRECT answer is (a) True |
|
| 111. |
Which of the following operators are used for logical execution?(a) ||(b) &&(c) %%(d) && and ||I got this question in unit test.This interesting question is from Logical Operators and Conditional Execution topic in section Essential Shell Programming of Unix |
|
Answer» Right OPTION is (d) && and || |
|
| 112. |
A single read statement can be used with one or more variables.(a) True(b) FalseI have been asked this question in class test.This interesting question is from Shell Programming using read Command and Command Line Arguments in division Essential Shell Programming of Unix |
|
Answer» Correct choice is (a) True |
|
| 113. |
The complete set of positional parameters is stored in ______ as a single string.(a) $n(b) $#(c) $*(d) $$This question was posed to me in an online interview.My doubt is from Shell Programming using read Command and Command Line Arguments in section Essential Shell Programming of Unix |
|
Answer» The correct ANSWER is (C) $* |
|
| 114. |
The first argument is read by the shell into the parameter ___(a) 1$(b) $3(c) $$(d) $1The question was asked during an interview.My question is taken from Shell Programming using read Command and Command Line Arguments topic in section Essential Shell Programming of Unix |
|
Answer» The CORRECT choice is (d) $1 |
|
| 115. |
What are positional parameters?(a) special variables for assigning arguments from the command line(b) pattern matching parameters(c) special variables for reading user input(d) special variables and patternsThe question was asked in an international level competition.This interesting question is from Shell Programming using read Command and Command Line Arguments in division Essential Shell Programming of Unix |
|
Answer» CORRECT option is (a) special variables for ASSIGNING arguments from the command line For explanation: Shell scripts can also take INPUT from command line. When arguments are specified with a shell SCRIPT, they are ASSIGNED to certain special variables called positional parameters. |
|
| 116. |
read command is shell’s internal tool.(a) True(b) FalseThis question was posed to me in final exam.I would like to ask this question from Shell Programming using read Command and Command Line Arguments topic in section Essential Shell Programming of Unix |
|
Answer» Correct OPTION is (a) True |
|
| 117. |
To spawn a child of our own choice for running the script, we can use ___ command.(a) ps(b) pr(c) sh(d) $$I got this question by my college professor while I was bunking the class.Origin of the question is Shell Programming using read Command and Command Line Arguments topic in division Essential Shell Programming of Unix |
|
Answer» Correct choice is (c) sh |
|
| 118. |
To run the script, we should make it executable first by using _____(a) chmod +x(b) chmod +r(c) chmod +w(d) chmod +rwxI have been asked this question in examination.My question comes from Shell Programming using read Command and Command Line Arguments in chapter Essential Shell Programming of Unix |
|
Answer» The correct choice is (a) chmod +X |
|
| 119. |
The first line in any shell script begins with a _____(a) &(b) !(c) $(d) #I got this question in quiz.Question is taken from Shell Programming using read Command and Command Line Arguments topic in portion Essential Shell Programming of Unix |
|
Answer» CORRECT answer is (d) # For EXPLANATION I would say: When the comment character (#) is PLACED anywhere in a line; the shell ignores all characters on its right. However, this rule doesn’t apply to the first line which is the interpreter line. It always begins with #! and FOLLOWED by the pathname of the shell to be used for running the script. |
|
| 120. |
Which command is used for making the scripts interactive?(a) ip(b) input(c) read(d) writeThe question was asked in an interview for internship.My enquiry is from Shell Programming using read Command and Command Line Arguments in portion Essential Shell Programming of Unix |
|
Answer» The correct answer is (c) read |
|
| 121. |
Shell scripts are executed in a separate child shell process.(a) True(b) FalseI have been asked this question in an internship interview.This key question is from Shell Programming using read Command and Command Line Arguments in section Essential Shell Programming of Unix |
|
Answer» Right option is (a) True |
|
| 122. |
Shell scripts need to be saved with an extension .sh .(a) True(b) FalseI got this question in exam.This question is from Shell Programming using read Command and Command Line Arguments topic in division Essential Shell Programming of Unix |
|
Answer» Right option is (b) False |
|
| 123. |
What is a shell script?(a) group of commands(b) a file containing special symbols(c) a file containing a series of commands(d) group of functionsI had been asked this question in homework.My question is based upon Shell Programming using read Command and Command Line Arguments topic in division Essential Shell Programming of Unix |
|
Answer» The correct choice is (c) a file containing a series of COMMANDS |
|