Linux final preparation

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

10, 12, 9, 6, 10

#!/bin/bash # adapted from pg 1021, Sobell, 4e # filename: inc_dec.sh n=10 echo $n echo $((--n+3)) echo $n echo $((n++ -3)) echo $n #eof: inc_dec.sh 2. Write the output of each of thefi ve echo statements

c

Answer the following three questions based on the following declaration in bash groups=(audit:2001 finance:2002 account:2003 sales:2004 purchase:2005) 9. What is the output of the following command echo $fgroups[1+2]g A. account:2003 B. finance:2001 C. sales:2004

b

Kernel space is protected because A. user data is con dential and should not be viewed by other users B. an error in an application program is isolated and does not bring down the entire system or make it unstable C. user data can be large and will not t in kernel space

d

The user has set the umask to 022. Answer the next two questions based on this value of umask. A directory is created, what will be the le permission A. ----rw-rw- B. -rw-r--r-- C. -rw-rw-rw- D. -rwxr-xr-x E. -----w--w-

b

The user has set the umask to 022. Answer the next two questions based on this value of umask. A fi le is created, what will be the le permission A. ----rw-rw- B. -rw-r--r-- C. -rw-rw-rw- D. ----r--r-- E. -rwxr-xr-x

a

To delete a le a user must have write and execute permission in the directory, but does not need any permission for the le itself. A. True B. False

a

To move a le a user must have appropriate permission in the source and target directories, but does not need any permission for the le itself. A. True B. False

a

To run a binary le a user must have a minumum of A. execute permission B. read and execute permission C. write and execute permission

b

To run a shell script a user must have a minumum of A. execute permission B. read and execute permission C. write and execute permission

d

groups=(audit:2001 finance:2002 account:2003 sales:2004 purchase:2005) What is the output of the command echo $f#groups[*]g A. 0 B. + C. 4 D. 5

c

groups=(audit:2001 finance:2002 account:2003 sales:2004 purchase:2005) What is the output of the command echo $fgroups[*]g A. audit:2001 B. There is no output from the command C. audit:2001 finance:2002 account:2003 sales:2004 purchase:2005

true

rsyslogd, ftpd, httpd are examples of daemons

d

user1 is logged in. What is the command to change the default shell for user1 to /bin/dash the next time user1 logs in? A. useradd s /bin/dash user1 B. chsh s /bin/dash C. usermod -s /bin/dash user1 D. none of the above

d

user1 is logged in. What is the command to change the default shell for user1 to /bin/sh the next time user1 logs in? A. useradd s /bin/sh user1 B. chsh s /bin/sh C. usermod -s /bin/sh user1 D. sudo usermod -s /bin/sh user1 E. $SHELL=/bin/sh

e

user1 moves the le budget.2015 using the following command. mv /home/user1/budget.2015 /home/accounts/ The minimum le permission required for source and target directories are A. read permission for /home/user1 directory and /home/accounts directory B. write permission for /home/user1 directory and /home/accounts directory C. read and write permission for /home/user1 directory and /home/accounts directory D. read permission for /home/user1 directory and write permission for /home/accounts directory E. write and execute permission for both /home/user1 and /home/accounts direct

a)

A kernel A. gets loaded into system memory and runs code in kernel space B. gets loaded into system memory and runs code in user space C. gets loaded in ROM BIOS and runs from the BIOS D. gets loaded from ash memory then gets loaded in BIOS

a

A task is currently running using the CPU. It is interrupted by the kernel with the intention of resuming later. What term ts this description A. multi user operating system B. single user operating system C. pre-emption D. multi processor system

b

A user edits a document using vim. Identify the memory area where it runs A. kernel space B. user space C. device driver routines

c

Given the le permission rw-rw-r-- for a le report.draft in current directory, identify the chmod command that adds execute permissions for owner and removes read permission from others. Permission for group should remain unchanged. A. chmod 740 report.draft B. chmod 750 report.draft C. chmod 760 report.draft D. chmod 770 report.draft

c

Given the following at command line: user@localhost: /lab6$ touch aaa cbd bbc bda cdd ab ad user@localhost: /lab6$ ls [a-d]?[!ac] What is the output of the above command? A. bbc B. aaa cdd C. cbd cdd D. bda

e

How many times will the echo statement execute when the following script is run? for num in {1..10..2} do echo $num done A. 0 B. 2 C. 3 D. 4 E. 5

d

How may times will the echo statement execute ((a=3)) while [ $a -ge 3 ] || [ $a -le 5 ] do echo "Everest" ((a++)) done A. 0 B. 3 C. 4 D. in nite

d

How will you verify that user2 has been deleted from the system? A. ls /home/user2 B. ls /root C. cat /etc/fstab | grep user2 D. cat /etc/passwd | grep user2

d

Identify the le that stores encrypted passwords A. /etc/fstab B. /etc/passwd C. /etc/group D. /etc/shadow E. /etc/gshadow

All

Identify the Linux command used by root to give everyone full access permission to directory /public. [Select all that apply] A. chmod 777 /public B. chmod ugo=rwx /public C. chmod a+rwx /public D. chmod ugo+rwx /public

c

Identify the command that is used to delete a group in Linux. A. gpasswd B. groupmod C. groupdel D. newgrp

b

Identify the command that will allow the superuser to delete account and home directory of user2 A. userdel user2 B. userdel -r user2 C. usermod -r user2 D. usermod -d user2

d

Identify the command to rename a le in LINUX A. ren B. rename C. cp D. mv

c

Identify the operator that will stream the output of the rst command and send it as input to the second command. A. > B. >> C. | D. ;

b

Identify the redirecton operator, that will not overwrite an existing le but will append it. A. > B. >> C. |

d

Identify the root users home directory in Linux. A. / B. /root/home C. /home/root D. /root

a

Identify the software that interacts with and processes requests from peripherals such as keyboard, mouse, camera, microphone, hard disk, CD ROM, Flash Drive. A. Kernel B. application program C. device driver D. BIOS E. ash memory

c

Identify the term that matches this description. Programs usually started at boot-up time, provides service(s) to other programs that are run by a user or by the system. A. background process B. foreground process C. daemon D. kernel

d

In bash shell, what is the operation done by a dollar sign and brackets $( )? A. arithmetic evaluation B. parameter expansion C. logical evaluation D. command substitution E. arithmetic expansion

e

In bash shell, what is the operation done by a dollar sign and double brackets $(( ))? A. arithmetic evaluation B. parameter expansion C. logical evaluation D. command substitution E. arithmetic expansion

b

In bash shell, what is the operation done by braces {}? A. arithmetic evaluation B. parameter expansion C. logical evaluation D. command substitution E. arithmetic expansion

a

In bash shell, what is the operation done by double brackets (( ))? A. arithmetic evaluation B. parameter expansion C. logical evaluation D. command substitution E. arithmetic expansion

a

Information about a le, a directory, the directory's parent and each of its children is stored in a data structure called A. inode B. metadata C. timestamp D. linkcount E. hardlink

c

Logical drives can reside only on A. a primary partition B. a swap partition C. an extended partition

false

Multiuser is the same as multitasking. These two terms can be used interchangeably.

c

The Linux command that allows for deleting a directory, but only if it is empty: A. mv -u B. rm C. rmdir

a

The Linux command that displays all mounted devices __________. A. mount B. cat /etc/fstab C. fdisk -l D. fsck E. None of the above

a

The Linux command that will print the current working directory A. pwd B. cd C. mkdir D. ls

a

The command gpasswd -a user1 audit will A. add user1 to group audit B. make user1 the administrator to group audit C. delete user1 from group audit D. give an error

d

The command gpasswd -d user1 audit will A. will give an error B. add user1 to group audit C. will make user1 the administrator to group audit D. will delete user1 from group audit

c

The command that is used to change directory to test1, a sub-directory of user1's home directory, /home/user1, given the command prompt listed below: user1@localhost: /etc$ A. cd /test1 B. cd ./test1 C. cd ../home/user1/test1 D. cd home/user1/test1

a

The command useradd -G account,audit user2 will A. add user2 to groups account and audit B. give an error

a

The command useradd -g audit user3 will A. add user3 to group audit B. will make user3 an administrator to group audit C. give an error

c

The command useradd user1 will A. add a user called user1 to the group root B. add a user called user1 to the rst group on the list C. create a group called user1 and add a user called user1 in the newly created group D. give an error

a

The root account has access to all resources on a computer A. True B. False

e

The root user wants to change the owner to cfo and group to ExecCmt for le Strategy.Q03. Identify the command that will achieve the result. A. chown cfo root Strategy.Q03 B. chown Strategy.Q03 cfo root C. chgrp Strategy.Q03 cfo ExecCmt D. chgrp cfo.ExecCmt Strategy.Q03 E. chown cfo.ExecCmt Strategy.Q03

d

User PrjMgr copies the le Plan.Q01 to directory \archive\Mgt\Q01 using the following command: cp \home\PrjMgr\Plan.Q01 \archive\Mgt\Q01\ What are the minimum permissions required for the directories PrjMgr and Mgt A. for source directory r, w and x, for target directory r and w B. for source directory r and w, for target directory r and w C. for source directory x, for target directory r and x D. for source directory x, for target directory w and x E. for source directory w, for target directory w and x

b

What does the command cat le1 le2 do? A. redirects output of le1 to le2 B. concatenates les le1 and le2 and prints to standard output, (i.e. default - screen) C. takes each line from le1 and appends it to corresponding line in le2.

b

What does the command touch le1 do? A. creates le1 with zero bytes, gives an error if le1 exists. B. creates le1 with zero bytes if it does not exist, if le1 exists touch will update the time stamp of the le. C. creates le1 with zero bytes, if le1 exists touch overwrites and creates a le with zero bytes.

Command Substitution

What is the function of $( )

d

What is the minimum permission required for the le to copy it? A. read and write B. read and execute C. write and execute D. read E. write

b

What is the output after the following statements are executed x=20;y=30 { x=300;y=400} (x=30;y=40) echo $x $y A. 20 30 B. 300 400 C. 30 40

son, sun, sin

What is the output of echo s{o,u,i}n

b

What is the output of the command echo "$(pwd)" A. The command will give a syntax error B. The current working directory will be displayed C. $(pwd) D. pwd

b

What is the output of the command echo `We pay $32 per month for Internet' A. `We pay $32 per month for Internet ' B. We pay $32 per month for Internet C. We pay 32 per month for Internet

c

What is the permission, in octal mode, of the le MySQL.log, given the le listing: -rwxrw--w- 2 maotse students 15 Jan 25 12:37 MySQL.log A. 652 B. 651 C. 762 D. 732

e

What minimum permission, is required for a directory, to delete a le? A. read B. read and write C. read, write and execute D. read and execute E. write and execute

c

What special variable will indicate the exit status of the last command? A. $# B. $0 C. $? D. $9

a

What special variable will indicate the number of positional parameters? A. $# B. $0 C. $? D. $9

e

What umask should be set so the resultant le permission is -r--r--r-- A. 044 B. 033 C. 022 D. 011 E. 333

b

What will the command echo $SHELL do? A. it will run the default shell B. it will show the default shell as speci ed in the environment variable SHELL C. it will show all shells currently in the system

b

Which command will give the name of the operating system that is currently running. A. passwd B. uname C. hostname D. whoami E. su

a

Which command will remove all les that begin with a, b or c in the current directory? A. rm [abc]* B. rm [abc]? C. rm [a][b][c]* D. rm [a][b][c]?

a

Which command will restart the system immediately. A. shutdown -r now B. shutdown -h now C. shutdown -P now D. shutdown -k E. shutdown -c

b

Which directory stores device les, i.e. les that interface with hardware and lesystem A. /etc B. /dev C. /root D. /var E. /bin

c

Which directory stores libraries and executables needed to run programs that usually reside in /bin and /sbin A. /etc B. /dev C. /lib D. /var E. /bin

d

Which directory stores log les and administrative les A. /etc B. /dev C. /lib D. /var E. /bin

c

Which of the following command will display all active swap partitions? A. swapoff B. mkfs C. swapon -s D. fdisk -l

d

Which of the following uses the bash shell as the command interpreter in a script? A. /bin/bash B. #/bin/bash C. !/bin/bash D. #!/bin/bash

e

Which one of the following will delete directory /test1 and les stored in it? A. rmdir ~/test1 B. rm ~/test1 C. rmdir -p ~/test1 D. rm -r ~/test1 E. rm -r /test1

a

Which one of the two pathnames will work regardless of the current directory the user is in. A. absolute path B. relative path

c

Which operator is used when you want the second command to execute only when the preceeding command succeeds? A. ; B. && C. || D. >>

a

Which symbol is used to indicate the beginning of a comment in a shell script. A. # B. $ C. ! D. > E. <

a

ln -s oldfilename slinkname creates a A. symbolic link (soft link) to a le B. hard link to a le C. lists the directory structure in short form D. removes the link from old le and places it in slinkname

b

ls -l log.03052015 gives the following output. -rw-r--r-- 1 user2 faculty 0 Mar 5 19:59 log.03052015 What is the output of the following command echo "$(ls -l log.03052015 | cut -d" " -f4)" A. user2 B. faculty C. 0 D. Mar E. The command will give a syntax error


Set pelajaran terkait

Chapter 3: Texas in the Federal System

View Set

Music 118B (Chapter 9 - Chapter 16)

View Set

Khan Academy Unit Questions (3?)

View Set

Ch 18 PrepU Beta-Lactam Antibacterial Agents

View Set

business law 4320 fiu chapter 3 courts and alternative disputes

View Set

Chapter 3: Settling the Northern Colonies

View Set

MOR 331 - Funeral Home Management 5.4 - Financial Statements and Analysis - DMACC

View Set

ART History Mid term quiz questions

View Set