DCOM 142 FINAL Exam Questions And
Answers |Latest 2025 | Guaranteed Pass
What is the default mode "vi" text editor, when "vi" editor is entered initially? -
Answer✔command
Which are two editors discussed in chapter 9 for writing shell scripts? (choose two) -
Answer✔nano
vi
Which of the following are correct about for and while loops? (choose two) - Answer✔for loops
operate over a fixed list of items
while loops have a test each cycle to determine if it should run again
1|Page
, ©THEBRIGHT 2025 ALL RIGHTS RESERVED 4:52 PM A+
Which of the following statements acts as a good replacement of the if-then-else-fi statement?
- Answer✔case
What is the purpose of conditional expressions in shell scripts? - Answer✔They enable the
script to take different actions in response to variable data
Given the following script that is run through .test .sh hello goodbye: if [ -f $2 ]; then echo "I am
here" fi - Answer✔If a file called "goodbye" exists in the current directory
What is the correct way to assign the word "Hello". to a variable? - Answer✔A="Hello"
Which shell command accepts input from the user's keyboard? - Answer✔read
Given the following part of a script:
What is the meaning of $1?
if [-f$1 ]; then echo "I am here" fi - Answer✔It is the first argument passed to the script
2|Page
, ©THEBRIGHT 2025 ALL RIGHTS RESERVED 4:52 PM A+
What is the effect of the following short script, cp1 if its called as cp1 big.c big.cc? - Answer✔It
copies the contents of big.cc to big.c eliminating the old big.c
Which of the following statements is included in a case statement to denote the end of a case
statement? - Answer✔esac
What key(s) will enable insert mode in "vi" editor? - Answer✔"i" key
What key(s) will you use to delete a line in "vi" editor? - Answer✔"dd"
After using a text editor to create a shell script, what step should you take before typing to use
the script by typing its name? - Answer✔Set one or more executable bits using chmod
Which of the following entries is maintained at the first line of the bash script? -
Answer✔#!/bin/bash
Which of the following extensions is used at the end of the script name? - Answer✔.sh
3|Page