Full Test Bank Ch.15 Scripting Rothwell - Answer Key + Test Bank | Linux Essentials 1e Rothwell by William Rothwell. DOCX document preview.
Linux Essentials for Cybersecurity (Rothwell/Kinsey)
Chapter 15 Scripting
1) Which of the following refers to creating small programs based on the Linux commands that you want to routinely (or occasionally) execute?
A) Executing
B) Scripting
C) Compiling
D) Parsing
2) Which of the following is not true when comparing scripting and compiled languages?
A) Scripts traditionally are not compiled.
B) Scripts often take less coding to perform a task.
C) Compiled languages can be executed directly from source code.
D) Scripting languages are typically easier to learn.
3) Which of the following is not one of the three most commonly used scripting languages on Linux?
A) Perl
B) BASH
C) MySQL
D) Python
4) Which of the following is a disadvantage to BASH shell scripting?
A) You can use Linux commands natively in BASH shell scripts.
B) Just about every Linux (and Unix) distribution will have the BASH shell.
C) The language allows loop controls, variables, and exit status values.
D) BASH shell scripting doesn’t include object-oriented programming.
5) BASH scripts on a Linux distribution are files that end in which of the following characters?
A) .sh
B) .wc
C) .sc
D) .ba
6) The Perl scripting language can be used for which of the following applications?
A) Code testing
B) Data parsing
C) Web development
D) All of the above
7) Which of the following is not true regarding aspects of the Perl scripting language?
A) Perl’s syntax is fairly simple, derived primarily from the C language.
B) Perl code is inflexible; you are limited by the structure.
C) Perl has very powerful features, such as robust regular expressions.
D) It normally does not take very long to learn Perl.
8) Which of the following scripting languages, created by Guido van Rossum in the late 1980’s, has a very rigid indentation scheme?
A) BASH
B) Perl
C) Python
D) None of the above
9) Which of the following is not true regarding the Python scripting language?
A) It is extendable or embedded.
B) It has a small standard library.
C) The data structures are more diverse than those of many languages.
D) It has object-oriented features.
10) The Python scripting language is often used for which of the following applications?
A) Scientific applications
B) System tools
C) Network-based applications
D) All of the above
11) To start a BASH script, enter __________ as the first line of the script file in a text editor.
A) #!/bin/bash
B) #hello.sh
C) echo $PATH
D) $./hello.sh
12) Comments in a BASH script start with the __________ character and extend to the end of the line.
A) *
B) $
C) #
D) /
13) There are variables available in BASH scripts that represent the arguments passed into the script. The first argument is assigned to which of the following variables?
A) $0
B) $1
C) #0
D) #1
14) In the BASH shell, an “else, if” statement is spelled __________ and is not required if you don’t want to perform additional conditional checks.
A) elseif
B) fi
C) elif
D) else,if
15) When using conditional statements in BASH scripts, which of the following is true regarding the spacing around the square brackets?
A) There should be no spaces before or after a square bracket.
B) There should be a space before but not after each square bracket.
C) There should be a space after but not before each square bracket.
D) There should be a space before and after each square bracket.
16) Variables used in BASH scripts should be surrounded by which of the following?
A) Double quotes
B) Single quotes
C) Square brackets
D) Parentheses
17) If you want to perform integer (numeric) comparison operations in a BASH script, which option results in true if the first value is greater than or equal to the second value?
A) -gt
B) -ne
C) -ge
D) -le
18) Which flow control statement in the BASH scripting language executes a block of code repeatedly as long as the conditional statement is false?
A) The until loop
B) The case statement
C) The while loop
D) The for loop
19) In a case statement in the BASH scripting language, which character can be used to represent “or”?
A) *
B) ?
C) |
D) []
20) Command substitution, the process of executing a subcommand within a larger command, can be performed using which of the following methods?
A) ($cmd)
B) $(cmd)
C) (#cmd)
D) #(cmd)
Document Information
Connected Book
Answer Key + Test Bank | Linux Essentials 1e Rothwell
By William Rothwell