DCOM 142 FINAL fully solved graded A+ 2023/2024
DCOM 142 FINALWhat is the default mode "vi" text editor, when "vi" editor is entered initially? - correct answer command Which are two editors discussed in chapter 9 for writing shell scripts? (choose two) - correct answer nano vi Which of the following are correct about for and while loops? (choose two) - correct answer for loops operate over a fixed list of items while loops have a test each cycle to determine if it should run again Which of the following statements acts as a good replacement of the if-then-else-fi statement? - correct answer case What is the purpose of conditional expressions in shell scripts? - correct 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 - correct answer If a file called "goodbye" exists in the current directory What is the correct way to assign the word "Hello". to a variable? - correct answer A="Hello" Which shell command accepts input from the user's keyboard? - correct answer read Given the following part of a script: What is the meaning of $1? if [-f$1 ]; then echo "I am here" fi - correct answer It is the first argument passed to the script What is the effect of the following short script, cp1 if its called as cp1 big.c ? - correct answer It copies the contents of 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? - correct answer esac What key(s) will enable insert mode in "vi" editor? - correct answer "i" key What key(s) will you use to delete a line in "vi" editor? - correct 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? - correct answer Set one or more executable bits using chmod Which of the following entries is maintained at the first line of the bash script? - correct answer #!/bin/bash Which of the following extensions is used at the end of the script name? - correct answer .sh What is the effect of the following short script, ex1, if its called as ex1 big.c ? #!/bin/bash cp $2 $1 - correct answer It copies the contents of to big.c eliminating the old big.c Given the following script that is run through .test .sh hello goodbye: if [ -f $2 ]; then echo "I am here" fi - correct answer If a file called "goodbye" exists in the current directory True or false: Valid looping statements in Bash include for, while and if-elseif-fi - correct answer False True or false: A user types myscript to run a script called myscript. Within myscript, the $0 variable holds the value - correct answer False
Información del documento
- Subido en
- 10 de noviembre de 2023
- Número de páginas
- 13
- Escrito en
- 2023/2024
- Tipo
- Examen
- Contiene
- Preguntas y respuestas