IFT250-Final

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

How does the command mv bar1 bar2 behave, where both bar1 and bar2 are directories, when (i) bar2 exists, (ii) bar2 doesn't exist? -(i) bar1 becomes a subdirectory of bar2 (ii) bar1 is renamed to bar2. -(i) bar1 is renamed to bar2 (ii) bar1 becomes a subdirectory of bar2 . -bar 1 is renamed to bar2 in both cases. -None of the above

-(i) bar1 becomes a subdirectory of bar2 (ii) bar1 is renamed to bar2.

A file in a file system with a block size of 1024 bytes contains 1026 bytes. How many bytes of disk space does it occupy? -2048 bytes -1026 bytes -1024 bytes -1040

-2048 bytes The file would occupy 2048 bytes of disk space since the kernel allocates space in blocks of 1024 bytes

Which of the below comparisons are valid for commands cd ~charlie and cd ~/charlie -Both commands can work if there is a user-id named charlie and the user running the commands also has the subdirectory charlie in her home directory. -Both commands will work without any constraints. -Both are invalid commands .

-Both commands can work if there is a user-id named charlie and the user running the commands also has the subdirectory charlie in her home directory.

Select any four shell programs: -Bourne shell -Bourne again shell -C shell -Korn Shell -Y shell

-Bourne shell -Bourne again shell -C shell -Korn Shell

Charlie uses /usr/charlie as his home directory, and many of his scripts refer to the pathname /usr/charlie/html. Later, the home directory is changed to /home/charlie, thus breaking all his scripts. How could charlie have avoided this problem? -The only way Charlie could have avoided this this problem is by not changing the home directory. -By using $HOME/html in the first place. -The problem could not have been avoided.

-By using $HOME/html in the first place.

How do DOS and UNIX text files differ? -DOS files use CR-LF as the line terminating characters. UNIX files use only LF. -DOS files use LF as the line terminating characters. UNIX files use only CR-LF. -There is no difference.

-DOS files use CR-LF as the line terminating characters. UNIX files use only LF.

Out of the below options, select all that apply. Your system user-id is used for which of the below purposes: -Logging into the system -Output of who command -Communication with other users

-Logging into the system -Output of who command -Communication with other users

Select all options that apply. What is true for using a "#" before a command ?

-The shell will not interpret the words as commands -# can be used to record comment for documentation

Why is the mailx command is superior to a GUI program like Netscape or Mozilla

-non-interactive scripts can be used with the shell to interact with mailx -mailx can pipe the contents of a file into a command to send mail

Which option of setfacl removes ACL rules for a user or a group. -m -x -d None of the above

-x

Select the statement that correctly gives the purpose of each of the below file descriptors

0—Standard input 1—Standard output 2—Standard error

Explain what the following commands do: (i) cd, (ii) cd $HOME, (iii) cd ~

All commands switch to the home directory.

Which of the below does the wild-card pattern [A-z]????* best match ?

All filenames comprising at least 5 characters where the first character is alphabetic.

Which of the below are a part of the /etc/passwd file ? - users and certain login names that are used by the system. - Information on the root login.

Both

Which of the below commands can be used for encryption. Select the best answer. ccrypt mcrypt

Both

Which of the below commands gives the date output with each field on a separate line ? -date | tr ' ' '\n' > foo -date | tr ' ' '\n'

Both

Which of the below will provide the sum of two numbers that are taken from user in argument 1($1) and argument 2($2) - expr $1 + $2 - $1 + $2 | bc

Both

How can you make all of your aliases placed in ~/.alias available in all sub-shells.

By placing a statement in the rc file to execute ~/.alias using the dot or source command

The command who | cut -d " " -f 1 | sort will :

Display only the usernames of currently logged in users in a sorted order.

What does the following command do ? ps -e|tr -s ""|sort -k 4

Displays a list of all processes without the ps header line where processes with the same name are grouped together

Directories, devices, terminals, and printers are not treated as files in UNIX.

False

The Pretty Good Privacy (PGP) system does not use the public-key Cryptography.

False

The below commands will create the same files echo > README echo > readme

False

The below two commands are not interchangeable : tar -tvf /dev/fd0 tar -t -v -f /dev/fd0

False

The case condition can be closed with either endcase or esac.

False

The cd command can be found in /usr/sbin .

False

The exit statement, by default, returns the status 1.

False

The output in the who command cannot have same user-id more than once.

False

We do not need to assume a default value for the permissions for a file using relative assignment.

False

Wild card pattern *.[!s][!h] matches all filenames having a 2-character extension that is .sh.

False

then is optional in an if statement, and will not give any syntactical error if it is not used.

False

Encryption can be used to make files confidential all users, except superuser.

False File encryption can be used keep some of your files confidential, so that no other user can read them, including the superuser

By default, the file pubring.pgp contains the private key ring and secring.pgp contains the public key ring.

False In PGP, your private secret key ring is kept in the file secring.pgp and public key ring is kept in pubring.pgp

The command mv * ../bin moves all files in the current directory (including the hidden files) to the bin directory of the parent.

False The command moves all files in the current directory to the bin directory of the parent, excluding the hidden files.

The value of #$ stays the same for the below two scripts, given that the files bar1, bar2, bar3 exist. foo -l -t bar[1-3] foo -lt bar[1-3]

False The value of $# is 5 for the first script. If the options are combined,like in second script, $# becomes 4.

bash supports aliases while ksh does not.

False ksh supports alias while bash does not.

Which of the below is true? - I/*[Esc] will add /* at the beginning of a line and A*/[Esc] will add */ at the end of a line. - A/*[Esc] will add /* at the beginning of a line and I*/[Esc] will add */ at the end of a line.

I/*[Esc] will add /* at the beginning of a line and A*/[Esc] will add */ at the end of a line. I Inserts text at beginning of line. A Appends text at end of line.

Select the statement that is true. -In PGP, private secret decrypting key (or keys) is stored on one key ring and the public encrypting key and those of other people on another key ring. In GPG both private and public keys are stored on same key ring. -In PGP and GPG, private secret decrypting key (or keys) is stored on one key ring and the public encrypting key and those of other people on another key ring. -None of the above statements are true.

In PGP and GPG, private secret decrypting key (or keys) is stored on one key ring and the public encrypting key and those of other people on another key ring.

Explain why the error message is seen at the terminal in spite of having used the 2> symbol: $ cat < foo 2>bar ksh: cannot open foo: No such file or directory

Input redirection occurs before error redirection

Select the statement that is true for the bash profile and rc files. -The commands to be executed once, on login, are placed in the rc. The profile file contains settings that need to be executed every time a sub-shell is created. -The commands to be executed once, on login, are placed in the profile. The rc file contains settings that need to be executed every time a sub-shell is created . -The profile and rc file have the same purpose

The commands to be executed once, on login, are placed in the profile. The rc file contains settings that need to be executed every time a sub-shell is created .

What do the | and the three dots in the SYNOPSIS section of man pages indicate as shown below? /usr/xpg4/bin/tail [ -f | -r ] /usr/bin/ls [ -aAbcCdfFgilLmnopqrRstux1 ] [ file ... ]

The three dots signify that there can be more than one instance of the argument passed for that command. The | also known as "pipe" signifies that only one option on either side of the pipe can be used.

$* Stores the complete set of positional parameters as a single string.

True

:w filename can be used in vi editor to save the current file with a different filename.

True

A nonprivileged user cannot change the system date. Only users with root access can.

True

A shell built in command won't be found as a file in any of the system administrator directories, but is built-in into the shell executable

True

All users can read the /etc/passwd file. But only root can read /etc/shadow, which contains encrypted passwords.

True

An interactive shell is used to run commands. A noninteractive shell runs shell scripts.

True

By creating a file named ~/.last_login in the .profile , and defining the alias alias: current="find . -type f -newer $HOME/.last_login -print", allows you to use an alias named current to display recursively only the ordinary files in the current directory tree which have been modified since you logged in.

True

Echo will be treated as a built in command even if it is found in /bin .

True

For the comm command to work properly, the files being compared need to be sorted.

True

GNU Privacy Guard is an implementation of the OpenPGP which specifies the protocol for encrypting and signing e-mail messages and certificates used to securely exchange encryption keys.

True

If the system does not have the apropos command man -k can be used instead.

True

If you have a file named foo which has all date components on separate lines, tr '\n' '' "<foo will display the contents of the file in one line.

True

Interaction with a UNIX system is achieved through the shell. The shell acts as a command interpreter by interpreting the keyed in word as a command to be executed.

True

Removing the read permission from your directory for others will ensure that no one is able see the names of the files you have.

True

Shell starts executing upon successful login to your terminal

True

Single quotes protect all special characters(except the single quote and \) but double quotes enable the $ and ` to be interpreted as the variable evaluation and command substitution characters.

True

The /etc/shadow contains information about a user's password and data about password aging.

True

The basename command by default extracts the "base" filename from an absolute pathname

True

The command cd ~/charlie switches to the subdirectory charlie in the user's home directory.

True

The command cd ~charlie changes the current directory to charlie's home directory. Given that the user-id here is charlie.

True

The command chmod 700 foo will assign all permissions for the file foo to the owner and remove all permissions from others.

True

The command cp -r bar1 bar2 recursively copies the directorybar1 to bar2.

True

The command mv $HOME/include . moves the include directory to the current directory

True

The commands used by the System Administrator are in /sbin and /usr/sbin.

True

The file /etc/shadow contains the encrypted passwords.

True

The mask in setfacl command limits the effective permissions granted to ACL groups and users.

True

The sequence of fields on each line in the /etc/passwd file is separated by colons

True

The setfacl --modify (or -m) adds or modifies one or more rules in a file's ACL.

True

The tail command displays the last 10 lines of the end of the file when used without arguments.

True

The wild-card pattern [fF]oo[125] will match both of the following filenames : foo1, foo2, and Foo5.

True

When a program needs to read a file on a disk, it makes a system call to the operating system. The OS then directs the disk controller to open the file and enables the program to read data from the file.

True

When the script foo -l -t bar[1-3] runs, the values of $# is 5.

True

You can protect confidentiality of files by encrypting their contents.

True

alias lh="ls -d .*" frames alias only the hidden filenames in the current directory

True

bc is superior to expr because it can also handle floating point numbers.

True

case delimits multiple patterns with a |.

True

dos2unix andunix2dos can be used perform conversions from one format to another.

True

expr can handle integers and string operations

True

if conditional statement closes with fi.

True

if conditional uses the test statement to handle relational tests.

True

script command in UNIX is used to record your session

True

the setfacl command can take permissions in both the octal or rwx representation.

True

zip combines the functions of tar and gzip in a single command.

True Some of the advantages of zip over gzip are- (i) can compress multiple files into a single archive. (ii) can archive a complete directorystructure.(iii) combines the functions of tar and gzip in a single command.

On a directory, the owner's permissions override the group's.

True This is clearer with an example;If the owner doesn't have write permission on a file but her group has, she can not edit because the owner's permissions override the group's.

Indicate what the following command is meant to do :- setfacl -m g:support:5 dog

Will set the permissions for group support to read & exec

Which of the below wild-card patterns work for all of the following filenames : watch.htm, watch.HTML, and Watch.html

[Ww]atch.[Hh][Tt][Mm]*

Select the correct output for the below script: a=-2; b=3; c=5 ans = $((++a - b++ * ++c)) echo "ans1==$ans, a==$a, b==$b, c==$c"

ans1==-19, a==-1, b==4, c==6

Select the correct output for the script: a=-2; b=3; c=5 (( ans2 = --a + ++b % c-- )) echo "ans2==$ans2, a==$a, b==$b, c==$c"

ans2==1, a==-3, b==4, c==4

Select the correct output for the below script: a=-2; b=3; c=5 ans3=$(( ++b / a-- * - ++c )) echo "ans3==$ans3, a==$a, b==$b, c==$c"

ans3==12, a==-3, b==4, c==6

Select the correct output for the below script: a=-1; b=0; c=2; (( r4 = ++a && b-- || -c--)) echo "ans4== $r4, a== $a, b== $b, c== $c"

ans4== 1, a== 0, b== 0, c== 1

Select the correct output for the below script: a=-1; b=0; c=2 (( r5 = -a-- && -++b || c--)) echo "ans5== $r5, a== $a, b== $b, c== $c"

ans5== 1, a== -2, b== 1, c== 2

Upon encryption the original content changes into seemingly meaningless data, known as :

ciphertext

Two lists, foo1 and foo2, contain names of users. How do you create a third list of users who are present in foo2 but absent in foo1?

comm -13 foo1 foo2

Select the command that can be used to print the month name of current date . -date +%h -date +%m -date %m

date +%h

You tried to copy a file foo from another user's directory, but you got the error message cannot create file foo. You have write permission in your own directory. What could be the reason, and how do you copy the file?

foo exists at the destination but is write-protected. Remove or rename this file before copying.

Which command can be used for displaying a file's Access Control List.

getfacl

Which of the below options will work if you do not want to display the header when viewing the ACL of a file using getfacl

getfacl --omit <filename> getfacl -c <filename> getfacl --omit-header <filename>

Select the statement/set of statements without a syntactical error from below options: - ppprunning=yes - while $ppprunning = yes ; do

ppprunning=yes

Select the incorrect statement: -test can be used for numerical comparisons -test can be used for string comparisons -test can not be used for file content comparison -test can not be used for file attribute tests

test can not be used for file attribute tests


Set pelajaran terkait

Combo with "Combo with "BYU Econ Review #3" and 20 others" and 21 others

View Set

3.20 Quiz: Respiration and Photosynthesis

View Set

Negligence DUTY - Riess Spring 2022

View Set

1.8.0 - AMERICAN DEPOSITORY RECIEPTS

View Set

Ch 16: The Nursing Role in Providing Comfort During Labor and Birth

View Set

Steps in Muscle Contraction and Relaxation

View Set