0% found this document useful (0 votes)
28 views

Setl MCQ

Uploaded by

Mostafa Roshdy
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views

Setl MCQ

Uploaded by

Mostafa Roshdy
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Software Engineering Tools Lab [RedHat]

Þ Q1: Choose the correct answers to the following questions: [Chapter-1]


1. Which two of the following are benefits of open-source software for the user? (Choose two)

!! Code can survive the loss of the original developer or distributor!


"#Sensitive portions of code are protected and only available to the original developer.
$#You can learn from real-world code and develop more effective applications.
%#Code remains open as long as it is in a public repository, but the license may change when
included with closed source software!
2. Which two of the following are ways in which Red Hat develops their products for the future and
interacts with the community? (Choose two)

!! Sponsor and integrate open-source projects into the community-driven Fedora project.!
"#Develop specific integration tools only available in Red Hat distributions.
$#Participate in upstream projects.
%#Repackage and re-license community products.!
3. Which two statements describe the benefits of Linux? (Choose two)

!! Linux is developed entirely by volunteers making it a low-cost operating system.!


"#Linux is modular and can be configured as a full graphical desktop or a small appliance.
$#Linux is locked in a known state for a minimum of one year for each release, making it easier
to develop custom software.

%#Linux includes a powerful and scriptable command-line interface, enabling easier


automation and provisioning.!
!
!
Þ Q2: Choose the correct answers to the following questions: [Chapter-2]

1. Which term describes the interpreter that executes commands typed as strings?

!! Command "! Console #! Shell $! Terminal


2. Which term describes the visual cue that indicates an interactive shell is waiting for the user to
type a command?

!! Argument "! Command #! Option $! Prompt


3. Which term describes the name of a program to run?

!! Argument "! Command #! Option $! Prompt


4. Which term describes the part of the command line that adjusts the behavior of a command?

!! Argument "! Command #! Option $! Prompt


5. Which term describes the part of the command line that specifies the target that the command
should operate on?

!! Argument "! Command #! Option $! Prompt


6. Which term describes the hardware display and keyboard used to interact with a system?

!! Physical Console "! Virtual Console #! Shell $! Terminal


7. Which term describes one of multiple logical consoles that can each support an independent
login session?

!! Physical Console "! Virtual Console #! Shell $! Terminal


8. Which term describes an interface that provides a display for output and a keyboard for input to
a shell session?

!! Physical Console "! Virtual Console #! Shell $! Terminal

Þ Part 2: Executing Commands Using the Bash Shell


1. Which Bash shortcut or command jumps to the beginning of the previous word on the command line?

!! Pressing Ctrl+LeftArrow "! Pressing Ctrl+K #! Pressing Ctrl+A $! !string


2. Which Bash shortcut or command separates commands on the same line?

!! Pressing Tab "! history #! ; $! Pressing Esc+.


3. Which Bash shortcut or command is used to clear characters from the cursor to the end of the
command line?

!! Pressing Ctrl+LeftArrow "! Pressing Ctrl+K #! ; $! Pressing Esc+.


4. Which Bash shortcut or command is used to re-execute a recent command by matching the
command name?

!! !number "! !string #! history $! Pressing Esc+.


5. Which Bash shortcut or command is used to complete commands, file names, and options?

!! ; "! !number #! history $! Pressing Tab


6. Which Bash shortcut or command re-executes a specific command in the history list?

!! !number "! !string #! history $! Pressing Esc+.


7. Which Bash shortcut or command jumps to the beginning of the command line?

!! "! #! Pressing Ctrl+K %! Preesing Ctrl+A


8. Which Bash shortcut or command displays the list of previous commands?

!! !string "! !number #! history $! Pressing Esc+.


9. Which Bash shortcut or command copies the last argument of previous commands?

!! Pressing Ctrl+K "! Preesing Ctrl+A #! !number $! Pressing Esc+.


!
Þ Q3: Choose the correct answers to the following questions: [Chapter-3]
Þ Part 1: Linux File System Hierarchy Concepts
1. Which directory contains persistent, system-specific configuration data?

!! /etc "! /root #! /run $! /usr


2. Which directory is the top of the system's file system hierarchy?

!! /etc "! / #! /home/root $! /root


3. Which directory contains user home directories?

!! / "! /home #! /root $! /user


4. Which directory contains temporary files?

!! /tmp "! /trash #! /run $! /var


5. Which directory contains dynamic data, such as for databases and websites?

!! /etc "! /run #! /usr $! /var


6. Which directory is the administrative superuser's home directory?

!! /etc "! / #! /home/root $! /root


7. Which directory contains regular commands and utilities?

!! /commands "! /run #! /usr/bin $! /usr/sbin


8. Which directory contains non-persistent process runtime data?

!! /tmp "! /etc #! /run $! /var


9. Which directory contains installed software programs and libraries?

!! /etc "! /lib #! /usr $! /var

Þ Part 2: Specifying Files by Name

1. Which command is used to return to the current user's home directory, assuming the current
working directory is /tmp and their home directory is /home/user?

!! cd "! cd .. #! cd * $! cd/home
2. Which command displays the absolute path name of the current location?

!! cd "! pwd #! ls - $! ls -d
3. Which command will always return you to the working directory used prior to the current
working directory?

!! cd - "! cd -p #! cd ~ $! cd ..
4. Which command will always change the working directory up two levels from the current
location?

!! cd ~ "! cd ../ #! cd ../ .. $! cd -u2


5. Which command lists files in the current location, using a long format, and including hidden
files?
!! llong ~ "! ls -a #! ls -l $! ls -al
6. Which command will always change the working directory to /bin?

!! cd bin "! cd /bin #! cd ~bin $! cd -bin


7. Which command will change the working directory to /tmp if the current working directory is
/home/student?

!! cd ~ "! cd .. #! cd ../ .. $! cd -u1


8. Which command will change the working directory to /tmp if the current working directory is
/home/student?

!! cd tmp "! cd .. #! cd ../ ../tmp $! cd ~tmp

Þ Part 3: Matching File Names with Shell Expansions


1. Which pattern will match only filenames ending with "b"?

!! b* "! *b #! *b* $! [!b]*


2. Which pattern will match only filenames beginning with "b"?

!! b* "! *b #! *b* $! [!b]*


3. Which pattern will match only filenames where the first character is not "b"?

!! b* "! *b #! *b* $! [!b]*


4. Which pattern will match all filenames containing a "b"?

!! b* "! *b #! *b* $! [!b]*


5. Which pattern will match only filenames that contain a number?

!! *#* "! *[[:digit:]]* #! *[digit]* $! [0-9]


6. Which pattern will match only filenames that begin with an uppercase letter?

!! ^?* "! ^* #! [upper]* $! [[:upper:]]*


4. Which pattern will match only filenames at least three characters in length?

!! ???* "! ??? #! +++* $! \3*

Note: Chapter 4 doesn’t contain MCQ.


Þ Q4: Choose the correct answers to the following questions: [Chapter-5]

1. Which answer displays output to a terminal and ignores all errors?

!! &>file "! 2> &> file #! 2> /dev/null $! 1>/dev/null


2. Which answer sends output to a file and sends errors to a different file?

!! >file 2>file2 "! >file 1>file2 #! >file &2>file2 $! | tee file


3. Which answer sends both output and errors to a file, creating it or overwriting its contents?

!! | tee file "! 2 &>file #! 1 &>file $! &>file


4. Which answer sends output and errors to the same file ensuring existing file content is
preserved?

!! >file 2>file2 "! &>file #! >>file 2>&1 $! >>file 1>&1


5. Which answer discards all messages normally sent to the terminal?

&>/dev/null
!! >file 2>file2 "! &>/dev/null #! 2>file $! &>file

6. Which answer sends output to both the screen and a file at the same time?

!! &>/dev/null "! >file 2>file2 #! | tee file $! | < file


7. Which answer saves output to a file and discards error messages?

| tee file2> > file 1> > file 2>


!! "! &>file #! /dev/null $! /dev/null
/dev/null

Þ Q5: Choose the correct answers to the following questions: [Chapter-6]

1. Which item represents a number that identifies the user at the most fundamental level?

!! primary user "! UID #! GID $! username


2. Which item represents the program that provides the user's command-line prompt?

!! primary shell "! home directory #! login shell $! command namr


3. Which item or file represents the location of the local group information?

!! home directory "! /etc/passwd #! /etc/GID $! /etc/group


4. Which item or file represents the location of the user's personal files?

!! home directory "! login shell #! /etc/passwd $! /etc/group


5. Which item represents a number that identifies the group at the most fundamental level?

!! primary group "! UID #! GID $! groupid


6. What is the fourth field of the /etc/passwd file?

!! home directory "! /etc/passwd #! /etc/UID $! /etc/group


7. What is the fourth field of the /etc/passwd file?

!! home directory "! UID #! login shell $! primary group


Þ Q6: Choose the correct answers to the following questions: [Chapter-7]

1. Which regular file is owned by operator1 and readable by all users?

!! 1file1 "! 1file2 #! rfile1 $! rfile2


2. Which file can be modified by the contractor1 user?

!! 1file1 "! 1file2 #! rfile1 $! rfile2


3. Which file cannot be read by the operator2 user?

!! 1file1 "! 1file2 #! rfile1 $! rfile2


4. Which file has a group ownership of consultant1?

!! 1file1 "! 1file2 #! rfile1 $! rfile2


5. Which files can be deleted by the operator1 user?

!! rfile1 "! rfile2 #! all of the above $! none of the above


6. Which files can be deleted by the operator2 user?

!! rfile1 "! rfile2 #! all of the above $! none of the above

Þ Q7: Choose the correct answers to the following questions: [Chapter-8]

1. Which state represents a process that has been stopped or suspended?

!!D "!R #!S $!T & Z

2. Which state represents a process that has released all of its resources except its PID?

!!D "!R #!S $!T & Z

3. Which process does a parent use to duplicate to create a new child process?

!!exec "!fork #!zombie $!syscall & reap

4. Which state represents a process that is sleeping until some condition is met?

!!D "!R #!S $!T & Z


Þ Q8: Choose the correct answers to the following questions: [Chapter-11]
1. Which of these log files stores most syslog messages, with the exception of those that are related
to authentication, mail, scheduled jobs, and debugging?

!! /var/log/maillog
"#/var/log/boot.log
$#/var/log/messages
%#/var/log/secure
2. Which log file stores syslog messages related to security and authentication operations in the
system?

!! /var/log/maillog
"#/var/log/boot.log
$#/var/log/messages
%#/var/log/secure
3. Which service sorts and organize ssyslog messages into files in /var/log?

!! rsyslog "! systemd-journald #! auditd $! tuned


4. Which directory accommodates the human-readable syslog files?

!! /sys/kernel/debug
"#/var/log/journal
$#/run/log/journal
%#/var/log
5. Which file stores syslog messages related to the mail server?

!! /var/log/lastlog
"#/var/log/maillog
$#/var/log/tallylog
%#/var/log/boot.log
6. Which file stores syslog messages related to the scheduled jobs?

!! /var/log/cron
"#/var/log/tallylog
$#/var/log/spooler
%#/var/log/secure
7. What file stores console messages related to system startup?

!! /var/log/cron
"#/var/log/tallylog
$#/var/log/boot.log
%#/var/log/secure
Þ Summary – Chapter 1:
- Open source software is software with source code that anyone can freely use, study, modify, and share.
- A Linux distribution is an installable operating system constructed from a Linux kernel and supporting
user programs and libraries.
- Red Hat participates in supporting and contributing code to open source projects, sponsors and integrates
project software into community-driven distributions, and stabilizes the software to offer it as supported
enterprise-ready products.
- Red Hat Enterprise Linux is Red Hat's open source, enterprise-ready, commercially-supported Linux
distribution.

Þ Summary – Chapter 2:
- The Bash shell is a command interpreter that prompts interactive users to specify Linux commands.
- Many commands have a --help option that displays a usage message or screen.
- Using workspaces makes it easier to organize multiple application windows.
- The Activities button located at the upper-left corner of the top bar provides an overview mode that helps
a user organize windows and start applications.
- The file command scans the beginning of a file's contents and displays what type it is.
- The head and tail commands display the beginning and end of a file, respectively.
- You can use Tab completion to complete file names when typing them as arguments to commands.

Þ Summary – Chapter 3:
- Files on a Linux system are organized into a single inverted tree of directories, known as a file-system
hierarchy.
- Absolute paths start with a / and specify the location of a file in the file-system hierarchy.
- Relative paths do not start with a / and specify the location of a file relative to the current working
directory.
- Five key commands are used to manage files: mkdir, rmdir, cp, mv, and rm.
- Hard links and soft links are different ways to have multiple file names point to the same data.
- The Bash shell provides pattern matching, expansion, and substitution features to help you efficiently
run commands.

Þ Summary – Chapter 5:
- Running programs, or processes, have three standard communication channels, standard input,
standard output, and standard error.
- You can use I/O redirection to read standard input from a file or write the output or errors from a process
to a file.
- Pipelines can be used to connect standard output from one process to standard input of another process,
and can be used to format output or build complex commands.
- You should know how to use at least one command-line text editor, and Vim is generally installed.
- Shell variables can help you run commands and are unique to a particular shell session.
- Environment variables can help you configure the behavior of the shell or the processes it starts.
Þ Summary – Chapter 6:
- There are three main types of user account: the superuser, system users, and regular users.
- A user must have a primary group and may be a member of one or more supplementary groups.
- The three critical files containing user and group information are /etc/passwd, /etc/group, and
/etc/shadow.
- The su and sudo commands can be used to run commands as the superuser.
- The useradd, usermod, and userdel commands can be used to manage users.
- The groupadd, groupmod, and groupdel commands can be used to manage groups.
- The chage command can be used to configure and view password expiration settings for users.

Þ Summary – Chapter 7:
- Files have three categories to which permissions apply. A file is owned by a user, a single group, and
other users. The most specific permission applies. User permissions override group permissions and
group permissions override other permissions.
- The ls command with the -l option expands the file listing to include both the file permissions and
ownership.
- The chmod command changes file permissions from the command line. There are two methods to
represent permissions, symbolic (letters) and numeric (digits).
- The chown command changes file ownership. The -R option recursively changes the ownership of a
directory tree.
- The umask command without arguments displays the current umask value of the shell. Every process
on the system has a umask. The default umask values for Bash are defined in the /etc/profile and
/etc/bashrc files.

Þ Summary – Chapter 8:
- A process is a running instance of an executable program. Processes are assigned a state, which can be
running, sleeping, stopped, or zombie. The ps command is used to list processes.
- Each terminal is its own session and can have foreground process and independent background
processes. The jobs command displays processes within a terminal session.
- A signal is a software interrupt that reports events to an executing program. The kill, pkill, and killall
commands use signals to control processes.
- Load average is an estimate of how busy the system is. To display load average values, you can use the
top, uptime, or w command.

Þ Summary – Chapter 9:
- systemd provides a method for activating system resources, server daemons, and other processes, both
at boot time and on a running system.
- Use the systemctl to start, stop, reload, enable, and disable services.
- Use the systemctl status command to determine the status of system daemons and network services
started by systemd.
- The systemctl list-dependencies command lists all service units upon which a specific service unit depends.
- systemd can mask a service unit so that it does not run even to satisfy dependencies.
Þ Summary – Chapter 10:
- The ssh command allows users to access remote systems securely using the SSH protocol.
- A client system stores remote servers' identities in ~/.ssh/known_hosts and
/etc/ssh/ssh_known_hosts.
- SSH supports both password-based and key-based authentication.
- The ssh-keygen command generates an SSH key pair for authentication. The ssh-copy-id command
exports the public key to remote systems.
- The sshd service implements the SSH protocol on Red Hat Enterprise Linux systems.
- It is a recommended practice to configure sshd to disable remote logins as root and to require
- public key authentication rather than password-based authentication.

Þ Summary – Chapter 11:


- The systemd-journald and rsyslog services capture and write log messages to the appropriate files.
- The /var/log directory contains log files.
- Periodic rotation of log files prevent them from filling up the file system space.
- The systemd journals are temporary and do not persist across reboot.
- The chronyd service helps to synchronize time settings with a time source.
- The time zone of the server can be updated based on its location.

Þ Summary – Chapter 13:


- The tar command creates an archive file from a set of files and directories, extracts files from the
archive, and lists the contents of an archive.
- The tar command provides a set of different compression methods reduce archive size.
- Besides providing a secure remote shell, the SSH service also provides the scp and sftp commands as
secure ways to transfer files from and to a remote system running the SSH server.
- The rsync command securely and efficiently synchronizes files between two directories, either one of
which can be on a remote system.
Þ Important Red Hat Enterprise Linux Directories

Location Purpose

/usr Installed software, shared libraries, include files, and read-only program data.
Important subdirectories include:
- /usr/bin: User commands.
- /usr/sbin: System administration commands.
- /usr/local: Locally customized software.
/etc Configuration files specific to this system.
/var Variable data specific to this system that should persist between boots. Files
that dynamically change, such as databases, cache directories, log files,
printer-spooled documents, and website content may be found under /var.
/run Runtime data for processes started since the last boot. This includes process ID
files and lock files, among other things. The contents of this directory are
recreated on reboot. This directory consolidates /var/run and /var/lock from
earlier versions of Red Hat Enterprise Linux.
/home Home directories are where regular users store their personal data and
configuration files.
/root Home directory for the administrative superuser, root.
/tmp A world-writable space for temporary files. Files which have not been
accessed, changed, or modified for 10 days are deleted from this directory
automatically. Another temporary directory exists, /var/tmp, in which files
that have not been accessed, changed, or modified in more than 30 days are
deleted automatically.
/boot Files needed in order to start the boot process.
/dev Contains special device files that are used by the system to access hardware.

Þ Command-line File Management

Activity Command Syntax

Create a directory mkdir directory


Copy a file cp file new-file
Copy a directory and its contents cp -r directory new-directory
Move or rename a file or directory mv file new-file
Remove a file rm file
Remove a directory containing files rm -r directory
Remove an empty directory rmdir directory
Þ Table of Metacharacters and Matches

Activity Command Syntax

* Any string of zero or more characters.


? Any single character.
[abc...] Any one character in the enclosed class (between the square brackets).
[!abc...] Any one character not in the enclosed class.
[^abc...] Any one character not in the enclosed class.
[[:alpha:]] Any alphabetic character.
[[:lower:]] Any lowercase character.
[[:upper:]] Any uppercase character.
[[:alnum:]] Any alphabetic character or digit.
[[:punct:]] Any printable character not a space or alphanumeric.
[[:digit:]] Any single digit from 0 to 9.
[[:space:]] Any single white space character. This may include tabs, newlines, carriage
returns, form feeds, or spaces.

Þ Table of Metacharacters and Matches [Chapter 11]


Log File Type of messages stored

/var/log/messages Most syslog messages are logged here. Exceptions include messages
related to authentication and email processing, scheduled job execution,
and those which are purely debugging- related.
/var/log/secure Syslog messages related to security and authentication events.
/var/log/maillog Any one character in the enclosed class (between the square brackets).
/var/log/cron Any one character not in the enclosed class.
/var/log/boot.log Any one character not in the enclosed class.

Þ Syslog Priorities [Chapter 11]


CODE PRIORITY SEVERITY

0 emerg System is unusable


1 alert Action must be taken immediately
2 crit Critical condition
3 err Non-critical error condition
4 warning Warning condition
5 notice Normal but significant event
6 info Informational event
7 debug Debugging-level message

Khalid Shawki
[email protected]

You might also like