Linux Foundations Flashcards

1
Q

Important facts regarding the Linux kernel(choose 3):
The kernel is found in /boot
Is based on the Mac OS
Provides GUI access for configuration
Allocates system resources to process
Should be spelled “Colonel”
Everything is a file

A

The kernel is found in /boot ✅
Allocates system resources to process ✅
Everything is a file ✅

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Inside the /proc directory, you will find a separate directory for each instance of a running process.
True or False?

A

True ✅
True. The /proc directory in Linux contains a directory for each running process, named by its PID (Process ID). It’s a virtual filesystem providing an interface to kernel data structures

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the function of /etc/skel/ directory?
It is a template directory for new users
It is a log of all current passwords to ensure there are no duplicates
It is the default directory for new users until they get other permissions
It is a log of who created which users for security accountability.

A

It is a template directory for new users ✅

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Which command is used to make a shell variable to other executed programs.
env
export

A

export ✅

Ex: $ export greeting
$ export greeting=hey
Note: working with Global variable : To make a variable available to subprocesses, turn it form a local into a environment. The is doneby the command export. When invoked with the variable name, this is added to the shell’s environment:

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Which of the following are stored in the /etc/passwd file (choose 4)?
username
expiration
user’s home directory
hashed password
UID (user ID)
default shell

A

username
user’s home directory
UID (user ID)
default shell

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Select all of the files involved in Linux account configuration (choose 3).
/etc/shadow/
/etc/pwd
/etc/passwd
/var/run/accounts/
/var/log/system
/etc/group

A

The three files involved in Linux account configuration are:

/etc/shadow/
/etc/passwd
/etc/group

They manage user account information, including passwords and group memberships.
ex: $ cut -d “:” -f 1 /etc/passwd | sort -r | less
ex: $ wc /etc/passwd

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What does this Linux command do:
cut -d “:” -f 1 /etc/passwd | sort -r | less

A

This command processes the /etc/passwd file in several stages:

cut -d “:” -f 1 /etc/passwd: Extracts the first field (username) from each line of the /etc/passwd file.

The -d “:” option specifies that fields are separated by colons.

sort -r: Sorts the usernames in reverse alphabetical order.

less: Displays the sorted usernames in a paginated view, allowing for easy navigation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Which file on a Linux a system sets the maximum number of days before a password must be changed?
/etc/users
/etc/passwd
/etc/group
/etc/shadow

A

/etc/shadow ✅

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

The sticky bit permission…
prevents others from overwriting files they don’t own in common directories
changes the group ownership of existing files in a directory.
sets the group ownership of any new file created in a directory.
prevents other from removing files they don’t own from a common directory.

A

prevents other from removing files they don’t own from a common directory. ✅

$ls -ld Sample Directory/
drqqr-xr-t 2 carol carol 4096 Dec 28 18:46Sample_Directory/
ex:$ cd~
ex:$ sudo deluser jimbo
ex:$ ls -l 1*

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Use the command to remove a directory (xyz) and all files within it.
rmdir xyz
rm -r xyz
rm * xyz
del . \xyz

A

rm -r xyz ✅

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Which commands allows a file (xyz.sh) to execute (select 2)?
chmod a+w xyz.sh
chmod 755 xyz.sh
chown 777 xyz.sh
chmod +x xyz.sh

A

chmod 755 xyz.sh
chmod +x xyz.sh

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are the difference between a private web browser window and a regular web browser window? (Choose three.)
Private web browser windows do not keep records in the browser history.
Private web browser windows do not send regular stored cookies.
Private web browser windows do not store cookies persistently.
Private web browser windows do not allow printing or storing websites.

A

Private web browser windows do not keep records in the browser history. ✅
Private web browser windows do not send regular stored cookies.✅
Private web browser windows do not store cookies persistently. ✅

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Use the following to install “tree” on a Ubuntu system.
sudo apt-install tree
sudo apt-get install tree
setup install tree /s
sudo install tree

A

sudo apt-get install tree ✅

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

This type of DNS record is the opposite of an “A” record
PTR
WWW
CNAME
MX

A

PTR ✅

ex:Total978 (kernel 0)
TCP: 4 9estab 0, closed 0, orphaned 0, synrecv 0, timewait 0/0), port 0
Transport Total—— IP —–IPv6
*——–0————- - ———— - —-
RAW–1———–0————–1——

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Use this wildcard to replace a single character (Ex: is_inux)
#
*
?
%

A

? ✅

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Multiple users can have the default group ID (GID).
True
False

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Use the following command to rename a file in Linux
mv
cp
ren
rename

A

mv

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Where did the kernel originate?
It originated at Apple for macOS.
Linus Torvalds created it.
It originated at Microsoft for Windows.
It originated at IBM.

A

Linus Torvalds created it. ✅

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Which of the following are Linux desktop environments? (Choose all that apply.)
A. GTK+
B. GNOME
C. KDE Plasma
D. Evolution
E. Xfce

A

GNOME ✅
KDE Plasma ✅
Xfce ✅

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

If you want to enable one Linux computer to access files stored on another Linux
computer’s hard disk, which of the following network protocols is the best choice?
A. SMTP
B. NFS
C. PHP
D. DNS
E. DHCP

A

NFS (Network File System) ✅

NFS is specifically designed for file sharing over a network.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

In which of the following languages was most of the Linux kernel written?
A. Bash shell script
B. Java
C. C
D. C++
E. Perl

A

C ✅

This language provides the low-level access to memory and system resources necessary for a robust operating system kernel.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

True or false: OpenOffice.org forked from Calligra.

A

False ✅

OpenOffice.org was developed by Sun Microsystems
KOffice was developed by Calligra for KDE desktop envir.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

True or false: Python is generally implemented as an interpreted language.

A

True ✅

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

A Linux server that handles the SMB/CIFS protocol normally runs the software.
A. ProFTPD
B. telnetd
C. named
D. Dovecot
E. Samba

A

Samba ✅

Samba is the software that allows Linux servers to handle SMB/CIFS protocols, facilitating file and print services to Windows clients.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
A program written in a(n)/the programming language is completely converted to binary form before being run. A. Python B. compiled C. Javascript D. interpreted E. Perl
compiled ✅
26
You can install and manage various Linux software applications via a management system. A. office B. file C. email D. package E. program
package ✅
27
What type of multitasking does Linux use? A. Preemptive B. Multiuser C. Cooperative D. Single-tasking E. Single-user
Preemptive ✅
28
Which of the following programs is most likely to be installed and regularly used on a desktop computer that runs Linux? A. Apache B. Postfix C. Android D. Evolution E. BIND
Evolution ✅ Evolution is a personal information management application for emails, calendar events, and tasks, making it a useful program for a Linux desktop environment.
29
True or false: VMS was a common OS on x86 PCs at the time Linux was created.
False ✅ VMS X86 is a virtual machine (VM) that uses the x86 architecture and hardware-assisted virtualization capabilities:
30
True or false: A Linux computer being used as a server generally does not require X.
True. ✅ A Linux server typically does not require a graphical user interface (X), as it usually operates headlessly to conserve resources and enhance security. Most server management tasks are performed through the command line interface (CLI).
31
A type of software that’s distributed for free but that requires payment on the honor system if a person uses it is called . A. open source B. commercial C. freeware D. shareware E. virus
shareware ✅
32
The software package is an example of a web server written for the Linux server environment. A. MySQL B. LibreOffice C. Firefox D. GIMP E. Apache
Apache ✅ Apache is indeed a web server software package written for the Linux server environment, widely used for hosting websites.
33
Raspberry Pi - Features Specifications CPU: RAM: Storage:
Specifications CPU: 700 MHz -1.2 GHz RAM: 512 MB-1 GA SDRAM Storage: SD card
34
You are working as an IT manager. Your team is spending a lot of time doing infrastructure management. What is the ideal solution to reducing time in infrastructure management and increasing the time in actual software development? Apply advanced hybrid principles for software development. Hire additional team members to manage the infrastructure. Use the managed services provided by a public cloud. Use the build as a service concept.
Use the managed services provided by a public cloud.✅
35
You are working as a software developer and need to evaluate the operating system requirements. Your software is going to be deployed on the cloud. Which operating system is open source and can reduce the cost of overall software deployment on the cloud? Linux Windows 10 iOS iO X
Linux✅ Correct: Correct! Linux is open source and can reduce the cost of overall software deployment on the cloud.✅
36
What keystroke moves the cursor to the start of the line when typing a command in Bash? A. Ctrl+A B. Left arrow C. Ctrl+T D. Up arrow E. Ctrl+E
Ctrl+A This keystroke moves the cursor to the beginning of the line in Bash. Ctrl+E would move it to the end.
37
How can you run a program in the background when launching it from a shell? (Choose all that apply.) A. Launch the program by typing start command, where command is the command that you want to run. B. Launch the program by typing bg command, where command is the command that you want to run. C. Append an ampersand (&) to the end of the command line. D. Launch the program normally, press Ctrl+Z in the shell, and then type bg in the shell. E. Launch the program normally, press Ctrl+Z in the shell, and then type fg in the shell.
Append an ampersand (&) to the end of the command line. ✅ Launch the program normally, press Ctrl+Z in the shell, and then type bg in the shell. ✅
38
3. Which of the following commands is an improved version of more? A. grep B. html C. cat D. less E. man
less The less command is an improved version of more as it allows for both forward and backward navigation through a file.
39
True or false: Pressing Alt+F3 in the GUI brings up a text-mode display that you can use to log into Linux.
False. Ctrl+Alt+F3 that brings up a text-mode display where you can log in. Alt+F3 in a typical Linux GUI setup might switch to another virtual console, but it's often
40
True or false: You can force man to display a man page in a specific section of the manual by preceding the search name with the section number, as in man 5 passwd.
True
41
True or false: Info pages are a web-based documentation format.
False
42
True or false: Linux documentation in the /usr/share/doc directory tree is almost always in OpenDocument text format.
False. It is various formats, such as plain text, HTML, and PDF.
43
9. Each document in an info page is known as a . A. pager B. site C. node D. link E. level
node
44
The command searches a database of filenames, enabling you to identify files quickly whose names match a term that you specify. A. find B. whereis C. grep D. rpm E. locate
locate The locate command searches a pre-built database of filenames, allowing you to quickly identify files whose names match your specified term.
45
Which command would you use to get the most information about your motherboard? lspci info lspc info_spec
lspc ✅
46
Which of the following commands would you type to rename newfile.txt to afile.txt? A. mv newfile.txt afile.txt B. cp newfile.txt afile.txt C. ln newfile.txt afile.txt D. rn newfile.txt afile.txt E. touch newfile.txt afile.txt
mv newfile.txt afile.txt The mv command is used to move or rename files in Linux. It renames newfile.txt to afile.txt.
47
You want to copy a directory, MyFiles, to a USB flash drive that uses the FAT filesystem. The contents of MyFiles are as follows: $ ls MyFiles/ contract.odt outline.pdf Outline.PDF The USB flash drive is mounted at /media/usb, and so you type cp -a MyFiles/ /media/usb. What problem will occur when you attempt to copy these files? A. The command will fail because it tries to create links. B. The MyFiles directory will be copied, but none of its files will be copied. C. One file will be missing on the USB flash drive. D. One file’s name will be changed during the copy. E. Everything will be fine; the command will work correctly.
One file will be missing on the USB flash drive. The FAT filesystem is case-insensitive, so it won't differentiate between outline.pdf and Outline.PDF. As a result, one of those files will overwrite the other.
48
You type mkdir one/two/three and receive an error message that reads, in part, No such file or directory. What can you do to overcome this problem? (Choose all that apply.) A. Add the --parents parameter to the mkdir command. B. Issue three separate mkdir commands: mkdir one, then mkdir one/two, and then mkdir one/two/three. C. Type touch /bin/mkdir to be sure the mkdir program file exists. D. Type rmdir one to clear away the interfering base of the desired new directory tree. E. Type rm -r one to clear away the entire interfering directory tree.
A. Add the --parents parameter to the mkdir command. B. Issue three separate mkdir commands: mkdir one, then mkdir one/two, and then mkdir one/two/three.
49
50
True or false: You can create a symbolic link from one low-level filesystem to another.
True. You can create a symbolic link that points to a file or directory on a different filesystem. Symbolic links, or symlinks, are independent of the underlying filesystem and can link across different filesystems without any issues.
51
True or false: You can easily damage your Linux installation by mistyping an rm command when you log into your regular account.
True. Mistyping an rm command, especially with recursive options like -r or using wildcards, can result in unintended deletion of critical system files, potentially compromising your Linux installation. Always double-check your commands and consider using the -i flag for interactive prompts to minimize risk.
52
True or false: You can set a directory’s time stamps with the touch command.
True. The touch command can update the access and modification timestamps of directories, just like it does for files.
53
Which of the following is a variant of Debian? Redhat Ubuntu Fedora CentOS
Ubuntu
54
What is meant by Free Software? Donating money to the creator is optional There is no charge to buy the software The software can be used for whatever you choose There is no charge to use the software
The software can be used for whatever you choose
55
This concept gives you the right to freely distib & modify version of source & req's the same of its derivatives. copyleft creative commons copyright open source software
copyleft The concept you're describing is copyleft. It ensures that anyone can freely distribute and modify the source code, with the condition that the same rights apply to derivative works. This helps maintain the freedom of software for all users.
56
Which of the following are common package manager tools in Linux? (Select 4) get-software yum apt-get installer rpm dpkg
yum apt-get rpm dpkg
57
Which of the following application is a web server? ifconfig Nginx WWWHost Samba
Nginx
58
Select all open-source image editing application (choose 3) Blender GIMP Paintbrush Chimp Inkscape Acrobat
Blender GIMP Inkscape Notes: Learn Apache Apps
59
In which directory can you find documentation for installed packages? /lib/documents /etc/documentation /media/docs /usr/share/doc
/usr/share/doc
60
Which of the following is not used for reading a text file? head tail grep less
grep
61
Which of the following is NOT valid for learning about the command "grep"? grep -? man grep grep --help info grep
grep -?
62
While in /home/jimbo/Downloads directory, where will "cd." take you? /home /home/jimbo /home/jimbo/Downloads /
/home/jimbo/Downloads Using cd . in the terminal will keep you in the current directory. So if you're in /home/jimbo/Downloads, cd . will leave you exactly where you are: /home/jimbo/Downloads.
63
Which command shows the contents of all sub-directories? ls -R show -subdir dir /r ls -r
ls -R This command recursively lists all files and directories, including the contents of subdirectories, starting from the current directory.
64
Use the following character to "wrap" a long command in terminal / ~
\
\
65
The following programs compress by default shrink gzip zip tar
gzip zip
66
Which of the following could extract the contents of a tarball file (myfile.tar)? tar -czf myfile.tar unpack myfile.tar untar myfile.tar tar -xf myfile.tar
tar -xf myfile.tar This command extracts the files from the tarball, placing them in the current directory.
67
Which one of the commands will direct error messages to the file error.log? ls /root 1> error.log ls //roots > error.log ls /root 2>error.log ls /root >> error.log
ls /root 2> error.log In this command, 2> redirects the standard error (stderr) output to the specified file, error.log.
68
What is the return value of a successfully executed shell script? 0 True -1 1
0
69
Which of the following is a valid shebang?
70
Which are invalid extensions for a Linux script? .exe .py .ps None of these
None of these
71
To add all files in the current directory to myarchinve.tar, run the following command: tar -xzf myarchive.tar -all tar * myarchive.tar tar -czf myarchive.tar* tar -czf myzrchinve.tar *.*
tar -czf myarchive.tar* Note: *.* in not found in Linux.
72
The Macintosh OS is based in Linux. True False
False BSD Unix
73
Which program shows the contents of the ring buffer and is overwritten once full? Info top syslog dmesg
dmesg
74
Which program is similar to task manager in that it will show process with highest resources? taskmonitor cpustat top dmesg top
top
75
Log files are commonly found within this directory /bin /var /boot /etc
/var are commonly found within the /var directory. Specifically, they are often located in /var/log.
76
Where is the Linux kernel stored? /kernel /root /bin /boot
/boot
77
Which character signifies a standard user is logged into the shell? $ # ? ~
$
78
What file permission result from chmod 745? -rwxrwxrwx -r-x--xrwx -rw-rw-rw -rwxr--r-x
-rwxr--r-x
79
File permissions are read from left to right as (rwx rwx rwx), stack the following accordingly (top=left): group, owner , other
owner group other
80
Which command creates a new user (jimbo) with home directory? create jimbo -home useradd -m jimbo useradd -create jimbo adduser jimbo
useradd -m jimbo
81
Which command is used to reset a user's password? passchange pwd passowr passwd
passwd
82
Which file contains user passwords? /etc/passwd /shadow/passwd /etc/shadow /bin/passwords
/etc/shadow
83
A user account can be created with the passwd command. True False
False
84
What is the UID of the first "regular" user created on a Linux system? 0 1000 1 5000
1000
85
Which of the following commands will print lines from the file world.txt that contain matches to changes and changed? A. grep change[ds] world.txt B. tar change[d-s] world.txt C. find "change'd|s'" world.txt D. cat world.txt changes changed E. find change[^ds] world.txt
grep change[ds] world.txt This command uses grep to search for lines containing either "changes" or "changed" in world.txt. The pattern change[ds] matches both "changes" and "changed".
86
Which of the following redirection operators appends a program’s standard output to an existing file without overwriting that file’s original contents? A. | B. 2> C. &> D. > E. >>
>> This operator is used to append output to the end of the specified file, preserving its current contents.
87
You’ve received a tar archive called data79.tar from a colleague, but you want to check the names of the files it contains before extracting them. Which of the following commands would you use to do this? A. tar uvf data79.tar B. tar cvf data79.tar C. tar xvf data79.tar D. tar tvf data79.tar E. tar Avf data79.tar
tar tvf data79.tar The t option stands for "list" (table of contents), which shows the names of the files contained in the archive.
88
True or false: The regular expression Linu[^x].*lds matches the string Linus Torvalds.
False. The regular expression Linu[^x].*lds does not match the string "Linus Torvalds" because of the [^x] part of the expression. [^x] means "any character except 'x'," so it would not match the character 's' in "Linus." If you want a regular expression that matches "Linus Torvalds," a more appropriate example would be Linus.*lds, which matches "Linus" followed by any characters and then "lds."
89
True or false: The find command enables you to locate files based on their sizes.
True. The find command in Linux can be used to locate files based on their sizes, among other criteria. You can use the -size option to search for files of specific sizes.
90
True or false: To compress files archived with zip, you must use an external compression program such as gzip or bzip2 in a pipeline with zip.
False. The zip command itself is capable of compressing files. There's no need to use an external compression program like gzip or bzip2 when using zip. The zip command creates a compressed archive file in one step.
91
The character that represents the start of a line in a regular expression is . A. ^ B. $ C. | D. ( E. ̏
A. ^ The caret (^) character is used in regular expressions to denote the start of a line.
92
The command can extract specified data fields from a file’s records. A. grep B. cut C. sort D. find E. cat
cut The cut command allows you to select and extract specific columns or fields from a file or text stream, making it very useful for handling tabular data.
93
Complete the following command to redirect both standard output and standard error from the bigprog program to the file out.txt. $ bigprog out.txt A. | B. 2> C. &> D. > E. >>
&> EX: bigprog &> out.txt This redirects both the standard output and standard error of bigprog to the file out.txt.
94
The gzip, bzip2, and xz programs all perform compression, in which the compressed data will exactly match the original data, when uncompressed. A. zip B. tar C. high D. lossy E. lossless
lossless The gzip, bzip2, and xz programs perform lossless compression, meaning that the compressed data will exactly match the original data when uncompressed. This ensures that no data is lost during the compression and decompression process.
95
Which of the following commands would you run to display TCP socket statistics? dig route ss iconfig
ss The ss command provides detailed information about socket statistics, including TCP connections.
96
For which type of file is nano least likely to be useful for examining or editing? A. A text file encoded in Unicode B. A shell script file C. A text file encoded in ASCII D. A LibreOffice word processing document E. A Linux configuration fil
A LibreOffice word processing document nano is a text editor, which is great for editing plain text files, shell scripts, and configuration files, but it is not designed to handle complex file formats like those used by LibreOffice.
97
Which keystrokes invoke the nano search function? (Choose all that apply.) A. F3 B. F6 C. Esc-S D. Ctrl+F E. Ctrl+W
C. Esc-S E. Ctrl+W These keystrokes allow you to enter search mode in nano to find text within the file you're editing.
98
How would you remove two lines of text from a file when using vi? A. In command mode, position the cursor on the first line and type 2dd. B. In command mode, position the cursor on the last line and type 2yy. C. In insert mode, position the cursor at the start of the first line, hold down the Shift key while pressing the down arrow key twice, and press the Delete key on the keyboard. D. In insert mode, position the cursor at the start of the first line and press Ctrl+K twice. E. Select the text with the mouse, and then select File ? Delete from the menu.
In command mode, position the cursor on the first line and type 2dd.
99
True or false: Unicode is useful for encoding most European languages but not languages in Asia.
False. Unicode is designed to encode characters from virtually all writing systems used worldwide, including both European and Asian languages. It supports a vast range of characters, symbols, and scripts, making it a universal standard for text representation.
100
True or false: GUI text editors for ASCII are superior to text-mode ASCII text editors because the GUI editors support underlining, italics, and multiple fonts.
False. GUI text editors for ASCII do not inherently support underlining, italics, and multiple fonts for plain ASCII text because ASCII itself is a character encoding standard that lacks formatting capabilities. However, GUI text editors might provide a more user-friendly interface and additional features, but they can't alter the basic limitations of ASCII text formatting.
101
True or false: If you have never used a text editor before, the nano text editor is usually the best one to learn first.
True. nano is considered one of the best text editors to start with because it has a simple, user-friendly interface
102
ASCII supports unique characters (not including control characters). A. 64 B. 128 C. 512 D. 1024 E. 2048
128
103
Three keystrokes that can initiate a search-and-replace operation in nano are , , and . A. Esc+R B. F6 C. F14 D. Ctrl+F E. Ctrl+\
A. Esc+R C. F14 E. Ctrl+\
104
While in vi’s command mode, you can type to undo a change. A. ~ B. :wq C. ZZ D. u E. /
u
105
To save a file and exit the vi text editor in command mode, type . A. ~ B. ? C. ZZ D. cw E. /
ZZ In vi, typing ZZ in command mode will save the file and exit the editor.
106
After using a text editor to create a shell script, what step should you take before trying to use the script by typing its name? A. Set one or more executable bits using chmod. B. Copy the script to the /usr/bin/scripts directory. C. Compile the script by typing bash scriptname, where scriptname is the script’s name. D. Run a virus checker on the script to be sure it contains no viruses. E. Run a spell checker on the script to ensure it contains no bugs.
A. Set one or more executable bits using chmod. EX: chmod +x scriptname
107
Describe the effect of the following short script, cp1, if it’s called as cp1 big.c big.cc: #!/bin/bash cp $2 $1 A. It has the same effect as the cp command—copying the contents of big.c to big.cc. B. It compiles the C program big.c and calls the result big.cc. C. It copies the contents of big.cc to big.c, eliminating the old big.c. D. It converts the C program big.c into a C++ program called big.cc. E. The script’s first line is invalid, so it won’t work.
It copies the contents of big.cc to big.c, eliminating the old big.c.
108
What is the purpose of conditional expressions in shell scripts? A. They prevent scripts from executing if license conditions aren’t met. B. They display information about the script’s computer environment. C. They enable the script to take different actions in response to variable data. D. They enable scripts to learn in a manner reminiscent of Pavlovian conditioning. E. They cause scripts to run only at specified times of day.
They enable the script to take different actions in response to variable data.
109
True or false: A user types myscript laser.txt to run a script called myscript. Within myscript, the $0 variable holds the value laser.txt.
False. In a shell script, the $0 variable holds the name of the script itself, not the arguments passed to it.
110
True or false: Valid looping statements in Bash include for, while, and until.
True. In Bash, valid looping statements include for, while, and until. These looping constructs allow scripts to repeatedly execute a block of code under specified conditions.
111
True or false: The following script launches three simultaneous instances of the terminal program. #!/bin/bash terminal terminal terminal
False
112
You’ve written a simple shell script that does nothing but launch programs. To ensure that the script works with most user shells, the first line should be . A. #!/bin/sh B. /bin/sh C. # /bin/sh D. bash E. #!bash
#!/bin/sh
113
The Bash scripting command is used to display prompts for a user in a shell script. A. case B. while C. if D. echo E. exit
echo
114
The Bash scripting command is used to control the program flow based on a variable that can take many values (such as all the letters of the alphabet). A. case B. while C. if D. echo E. exit
case Ex: #!/bin/bash read -p "Enter a letter: " letter case $letter in a) echo "You entered A";; b) echo "You entered B";; c) echo "You entered C";; *) echo "You entered something else";; esac
115
The Bash scripting command controls the return value generated by a script, inde- pendent of the other commands used in the script. A. case B. while C. if D. echo E. exit
exit
116
Which one of the following choices is known as the shebang combination? ? (#/!/bin/sh) (#!/bin/sh) ? (#/bin/sh/!) (#/bin!/sh)
(#!/bin/sh)
117
118