Appendix B. TEST YOUR KNOWLEDGE ANSWERS

Part One: Fundamentals of UNIX Systems

Chapter 1: Getting Started with UNIX

1:

The system startup file for a UNIX shell is invoked:

A1:

C. The system startup file for the /etc/profile shell is invoked when a user logs into the system.

2:

The default POSIX shell prompt for a common user is:

A2:

C.

3:

When a user logs into HP-UX, the initial directory is:

A3:

B.

4:

What is the difference between intrinsic and extrinsic UNIX commands?

A4:

A.

5:

What is true about the superuser?

A5:

C. Any user having user ID 0 is a superuser. Creating more than one user with the same user ID is another way of giving the same rights to multiple users in a system.

6:

The default shell for HP-UX users is:

A6:

C.

7:

To log out of the HP-UX session, you use command:

A7:

B. There is no logout command.

Chapter 2: Working with Files and Directories

1:

The cat command is used to:

A1:

C. This command can be used for both creating and displaying a file.

2:

The maximum length of a file name may be:

A2:

C. A file name in HP-UX may be 256 characters long.

3:

The more command is used to:

A3:

A. This command is used to display text files, one page at a time.

4:

What is the function of the following command

grep "Mark Black" /etc/passwd

A4:

A. Words enclosed in quotation marks are considered as one string. The find command can't be used to find text within a file.

5:

Consider a directory with five files in it. The file names are pg.c, pg1.c, pg2.c, pg3.cpp, and pg10.c. We use the command ls pg?.?. The files displayed are:

A5:

A. The question mark is used to match only one character.

6:

How can you tell the number of user accounts on a UNIX system?

A6:

D. Each user name is listed in one line in the /etc/passwd file. There is no number command in HP-UX.

7:

You are currently in the /home/bootadirectory. Which command will bring you the to /etc directory?

A7:

D. Option A is not correct as it will move you to /home/boota/etc (if this exists). Option B is correct as you will go back two steps to the root directory and then go to etc directory. Option C is also correct as you have specified an absolute path.

Chapter 3: Environment Variables

1:

Just after login, you issue the command echo HOME. What will be the output of this command?

A1:

C. Option A is not correct because to display the value of a variable you have to use a dollar sign with the variable name. Option B is not correct because the HOME variable is set when you log in. Since you have not used a dollar sign, the command will simply display the word “HOME”, so option C is correct.

2:

What is not true about the PATH variable?

A2:

A. The PATH variable does not show anything about the current directory.

3:

You have a variable “ABC” with value “Alphabets”. You use the following command to change its value.

ABC='All $ABC'

What will be the new value of the variable?

A3:

A. Any string specified with single quotation marks is taken as-is by HP-UX commands.

4:

To assign the output of a command to a variable, we use:

A4:

D.

5:

The value of the PS2 variable on your system is “>” (greater-than symbol). You issue an incomplete command. What will be the shell's response?

A5:

D. The shell displays the value of the PS2 variable as prompt when you issue an incomplete command.

6:

What is wrong with the shell variable name 3Xyab2?

A6:

A. Ahell variable name can't be started with a digit.

Chapter 4: Input/Output Redirection and Pipes

1:

What is the file descriptor used for stderr?

A1:

C.

2:

The symbol used to append to a file when redirecting stdout to that file is:

A2:

B. Option A overwrites the existing file. Option C is used for input redirection. Option D is used for stderr redirection.

3:

When you redirect both stdout and stderr to the same location, you use:

A3:

C.

4:

A pipe is used to:

A4:

A.

5:

Which is not true?

A5:

B. A pipe can be used in a command where the stdin is redirected.

Chapter 5: Using the vi Editor

1:

You have made changes to a file and want to quit vi without saving these changes. What command will you use?

A1:

C. Option A will save the changes and then quit. Option B will save the file and then quit. Option D will force saving the file.

2:

You want to replace cat with dog in your file at all locations in the vi editor. You use:

A2:

C.

3:

While in command mode you press “a”; what happens?

A3:

B.

Chapter 6: Regular Expressions

1:

The purpose of the command grep ^Test$ is:

A1:

D.

2:

Square brackets in pattern matching are used for:

A2:

C.

3:

A regular expression <join matches:

A3:

A.

4:

The grep command can use:

A4:

A.

5:

Which of these is NOT a meta character?

A5:

D.

Chapter 7: File Permissions

1:

A file has rwxr-xr-- permissions. It is owned by a user mark belonging to a group users. You are logged in as user jim belonging to group users. What permissions do you have for this file?

A1:

C. All group members have read and execute permissions.

2:

You are logged in as user jim and create a file myfile and want to give it to a user mark by changing its ownership. The command for this is:

A2:

B.

3:

The id command without any argument lists:

A3:

C.

4:

You want to change your group ID temporarily. Which command will you use?

A4:

A. The chgrp command changes the group ownership of a file. The id command is used to display the user and group IDs.

5:

The system administrator wants a command to be executed with superuser permissions no matter which user executes it. He or she will set:

A5:

A.

6:

A file myfile already exists. You use command touch myfile. What will be the effect of this command?

A6:

C.

7:

You are logged in as user boota belonging to group users. When you list files using the ll command, you see the following list.

-rwxrw-r--   1 jim   class    0 Sep  8 18:06 myfile

What operations can you perform on this file?

A7:

C. You are neither the owner of the file nor a group member of the owner.

8:

You use the command chmod 764 myfile. It provides:

A8:

D.

Chapter 8: UNIX File System Hierarchy

1:

What can be determined about file name /etc/named.boot?

A1:

B. The /etc directory contains most of the configuration files.

2:

The HP-UX file system hierarchy is based on:

A2:

B.

3:

Mail files are kept in which directory?

A3:

D.

4:

What is true about the lost+found directory?

A4:

B.

5:

To find a command in the search path, we use the command:

A5:

B.

6:

Which directory contains programs needed at boot time?

A6:

A.

7:

The HP-UX kernel is located in:

A7:

D.

Chapter 9: Working with the POSIX Shell and Job Control

1:

The default HP-UX shell is:

A1:

C.

2:

You are in a directory having three files, file1, file2, and afile. You type a command ls f and then press the Chapter 9: Working with the POSIX Shell and Job Control key followed by the Chapter 9: Working with the POSIX Shell and Job Control key. What happens?

A2:

D.

3:

You use the date command to see the current system time. Just after that, you press the Chapter 9: Working with the POSIX Shell and Job Control key followed by the Chapter 9: Working with the POSIX Shell and Job Control key. What happens?

A3:

D. This key combination is used to go to the next command in the command history. Since there is no next command, nothing will happen.

4:

What does the command r 3 do?

A4:

D.

5:

For what purpose is the stty command used?

A5:

D. The stty command is used for terminal related settings.

6:

Your home directory is /home/boota. You moved from your home directory to the /etc directory. How can you go back to your home directory?

A6:

B. Choices A and C seem to be correct but the $ symbol is missing in the variable name with both of the choices.

7:

A job running in the foreground can be suspended by:

A7:

C. No command can be used while a job is running in the foreground, so choices A, B, and D are incorrect.

8:

Background jobs are always in:

A8:

D. A background job may be in any state.

Chapter 10: Introduction to Shell Programming

1:

You create a shell program and save it into a file with name “more”. Your current directory name is included in the PATH variable at the end. When you run this program by typing “more”, nothing happens and the cursor just stops at the next line. What may be the problem?

A1:

C. The more command is a standard UNIX command that expects an input from stdin. Since your current directory is at the end of the PATH variable, the standard more command gets executed instead of your own program. Choice A is incorrect because, in the case of an unrecognized command, you will get an error message. Choice B is incorrect because you will get an error message if the program is not executable.

2:

What is true about variables used in shell programs?

A2:

D.

3:

You use the echo $? command. The result is 2. What do you conclude from this?

A3:

B. The command prints the return code of the last command. Any return code other than 0 shows that the execution of the last command was not successful.

4:

You used shift 3 in your shell program. What will be its effect?

A4:

C. The shift command shifts all command line arguments to the left.

5:

What does the echo "a" command do?

A5:

D. This is an escape character used for an alert sound.

6:

What is wrong with the command [ "ABC" -eq "ABC" ]?

A6:

A. To test string equality you use the equal sign (=).

7:

A shell script with the name myscript does not have the execution bit set. How can you execute it?

A7:

B.

8:

How can you list all command line arguments?

A8:

A.

9:

The true return value of the test command is:

A9:

C. It returns a positive integer including zero.

10:

You have a shell script as shown here. What will be the result when it is executed?

#!/usr/bin/sh
ABC=aac
case $ABC in
  a)     echo "First"
         ;;
[aa]c)   echo "Second"
         ;;
a*)      echo "Third"
         ;;
*)       echo "Last"
         ;;
esac

A10:

C. The only matching choice is a*.

Chapter 11: Advanced Shell Programming

1:

Which command will you use to add the values of two variables VAR1 and VAR2, and store the result in VAR3?

A1:

D.

2:

You want to wait for 10 seconds at the end of the loop in each loop cycle. Which command will you use?

A2:

A. There is no pause command. The wait command is used to wait for a child process to terminate.

3:

Consider the following code segment. How many times does the loop execute?

A=1
until [ $A < 10 ]
do
   echo $A
   (( $A=$A+1))
done

A3:

A.

4:

What will be the output of the program shown here?

#!/usr/bin/sh
A=1
while [ $A -lt 10 ]
do
   B=1
   while [ $B -lt 10 ]
   do
      break 2
      echo "Inner loop"
   done
   echo "Outer Loop"
done

A4:

D. The break command terminates both loops before anything is printed.

5:

While writing a program, you meet a situation where you want to break the normal execution and shift control to the beginning of the loop, skipping the remaining commands in the loop. Which command will you use?

A5:

B.

Part Two: HP-UX System Administration

Chapter 12: The System Administration Manager

1:

SAM can't be used for:

A1:

B.

2:

The SAM builder is used to:

A2:

C.

3:

The SAM log file is:

A3:

C.

4:

The utility for viewing the SAM log file is:

A4:

A.

Chapter 13: Installing HP-UX

1:

The length of the HP-UX host name may be:

A1:

D.

2:

The HP-UX host name may contain:

A2:

C.

3:

Which command is used for initial configuration of the system?

A3:

B.

4:

Which statement is true?

A4:

B.

5:

How can you change the primary boot path?

A5:

A. PDC decides from which path the system should be booted.

6:

Which command do you use in PDC to find the device name for a CD-ROM drive?

A6:

C.

7:

You use the search command, and a list of devices is displayed as shown below. Which command will you use to boot from the CD-ROM?

Path Number  Device Path (dec)  Device Type
-----------  -----------------  -----------
P0           10/0/6             Random Access Media
P1           10/0/5             Random Access Media
P2           10/0/4             Random Access Media
P3           10/0/3             Random Access Media
P4           10/0/2             Random Access Media
P5           10/0/1             Random Access Media
P6           10/4/4.2           Toshiba CD-ROM Device
P7           10/4/4.1           Sequential Access Media

A7:

D.

Chapter 14: System Startup and Shutdown

1:

All HP-9000 systems have processor dependent code (PDC). What is true about it?

A1:

D.

2:

The autoboot information is stored in:

A2:

D.

3:

What can be used to boot HP-UX in single-user mode?

A3:

C.

4:

What is the function of the secondary loader?

A4:

B.

5:

The boot area of the primary system disk contains:

A5:

D.

6:

The search command in PDC is used to:

A6:

B.

7:

What is the order of execution of scripts becheckrc, ioinitrc, and rc?

A7:

B.

8:

What information is present in stable storage?

A8:

D.

9:

What is true about the lifls command?

A9:

A.

10:

The ID field in /etc/inittab file shows:

A10:

C.

11:

What happens if the runlevel for a program is not specified in the /etc/inittab file?

A11:

B.

12:

Which runlevel can be used for multiuser operation?

A12:

D.

13:

What command is used to check the current runlevel?

A13:

B.

Chapter 15: Software and Patch Management

1:

What is not true about a fileset?

A1:

B. A fileset may belong to many products.

2:

What is the default location of software on your disk?

A2:

A.

3:

When the swlist command is used without any arguments, it lists:

A3:

D.

4:

When using the swinstall command in the text menu, you can activate the menus using the:

A4:

A.

5:

In which runlevel is the SD-UX software daemon started?

A5:

B.

6:

What is the use of the freedisk command?

A6:

B.

7:

Which SD-UX command is used to install software?

A7:

A.

8:

For what purpose are patches not used?

A8:

C.

9:

Every patch is a shar file when you download it from the Hewlett-Packard Internet site. How many files are created when you unshar it?

A9:

A.

Chapter 16: Reconfiguring the HP-UX Kernel

1:

The default HP-UX kernel is:

A1:

C.

2:

The HP-UX kernel is:

A2:

A.

3:

If you don't back up the old kernel:

A3:

B. The only implication on not saving the old kernel is that you may not recover from a bad new kernel.

4:

A new kernel is rebuilt whenever you:

A4:

B.

5:

For a proper memory dump, the size of the swap space must be larger than:

A5:

B.

6:

What does the sysdef command show?

A6:

B.

7:

The maxswapchunks kernel parameter shows the value of maximum swap space:

A7:

A.

Chapter 17: Peripheral Devices

1:

What is the usual or default target address of an SCSI controller card?

A1:

C.

2:

What is the interface card instance number of disk 8/6.5.0?

A2:

B.

3:

What is the device file name for disk 7/3.4.0 attached to a card having instance number 1?

A3:

B.

4:

Which command can't be used for creating a device file?

A4:

B.

5:

The device class disk includes:

A5:

B.

6:

A terminal is represented by how many files in the /dev directory?

A6:

A.

7:

What information is necessary for the mknod command on the command line?

A7:

D.

8:

Which command is executed automatically for new devices at boot time?

A8:

C.

Chapter 18: HP-UX File Systems and Logical Volume Manager

1:

What is the name used for the root volume group?

A1:

A.

2:

Which statement is not true?

A2:

D. The name of a logical volume may start with other characters.

3:

The default physical extent size is:

A3:

A.

4:

The pvdisplay command uses:

A4:

B.

5:

What is true about space allocation to a logical volume?

A5:

B.

6:

By default, how many logical volumes can be created in a volume group?

A6:

C.

7:

Which command can be used to create a physical volume?

A7:

A. The pvcreate command always works on raw devices.

8:

Which command would you use to create a logical volume of 200-MByte size with the name myvol in volume group vg02?

A8:

C.

9:

Which statement is true?

A9:

C.

10:

What is not true about the JFS file system?

A10:

C.

11:

You use the pvcreate, vgextend, lvextend, and extendfs commands to increase the size of a file system. In which sequence would you use these?

A11:

C.

12:

Which command can you use to list the mounted file systems?

A12:

C.

Chapter 19: User and Group Management

1:

To change a group ID temporarily, which command is used?

A1:

B.

2:

What information is a must when you use the useradd command?

A2:

A.

3:

How many fields are present in the /etc/passwd file?

A3:

C.

4:

In which directory are stored the default configuration files for a user?

A4:

B.

5:

What is wrong with the following /etc/passwd entry?

boota:OV81GT8LCiRO.:1225:20::/home/boota:/sbin/sh:

A5:

B.

6:

Which command would you use to change a user ID?

A6:

C.

7:

For what purpose is a restricted shell used?

A7:

D.

Chapter 20: Dealing with HP-UX Processes

1:

Which kernel tunable parameter determines the maximum size of a process table?

A1:

B.

2:

Which signal is sent by the kill command by default?

A2:

C.

3:

The default nice level is 20. You start a new process in the background using the “&” symbol. What will be its nice level?

A3:

C. The nice level is increased by 4 for background processes.

4:

A process is in a sleep state while waiting for a resource that is currently busy. It receives a stop signal (SIGSTOP) and goes into a stopped state. After some time it receives a continue signal (SIGCONT). To which state will it go?

A4:

B. After receiving the SIGCONT signal, the process goes into its previous state.

5:

You are logged in as user boota and want to change the nice level of the init process to 15. Which of the following commands will you use? Remember the PID for the init process is 1.

A5:

D. The root user can change the nice value for the init process.

Chapter 21: Printing on HP-UX

1:

What is the result of the lp -dLJ4 /etc/profile command?

A1:

C.

2:

How are local print jobs scheduled?

A2:

B.

3:

How can the print priority of a job be increased when this job is waiting in the print queue?

A3:

B.

4:

What do you need to do to set up a remote printer, assuming DNS or NIS is not used?

A4:

D.

5:

What happens after you issue the following command?

disable -r "Printer disabled" laserjet3

A5:

B.

6:

What is the result of the following command?

lpfence laserjet3 5

A6:

A.

Chapter 22: Memory and Swap Space Management

1:

Which swap area must be available at system bootup time?

A1:

A.

2:

Where can you create a device swap?

A2:

D.

3:

You have three identical disk drives. How would you like to use these for swap and file systems for the best swap performance?

A3:

A.

4:

You have three different swap areas in LVM. These are:

/dev/vg03/lvol2
/dev/vg03/lvol8
/dev/vg03/lvol9

You want to stop using /dev/vg03/lvol2 as swap space. How can you do it?

A4:

C.

5:

What information is not displayed by the swapinfo command by default?

A5:

D.

Chapter 23: System Backup and Recovery

1:

You are using incremental backup in two levels. The levels used are 1 and 5. When restoring data, in what order will you restore the backup?

A1:

A.

2:

You used the tar command to back up your system. Which command will you use to restore it?

A2:

A.

3:

You are using files larger than 2 GBytes on your system. Which utility will you prefer to use to back up the system?

A3:

A.

4:

While creating incremental backup at level 2, you used the following command.

fbackup -v -g gfile -2 -f /dev/rmt/0m

The next day you performed backup at level 3 using the following command.

fbackup -v -g gfile -u -3 -f /dev/rmt/0m

Which files will be backed up?

A4:

A. Since you did not use the -u option with the first backup, the new backup will contain all files listed in the graph file.

5:

Which backup level is always a full backup, no matter how the previous backup has been performed?

A5:

A.

6:

Which tar command is used to restore data?

A6:

A.

7:

Why is a recovery tape made with the make_recovery command important?

A7:

C.

8:

Which statement is true?

A8:

B.

9:

What information is present in Backup Scope when using SAM?

A9:

B.

Chapter 24: Automating Jobs

1:

At what run level is the cron daemon started?

A1:

B.

2:

On your system, file cron.allow exists and is empty. File cron.deny is also present and contains the login name of user boota. Who is allowed to use cron?

A2:

C.

3:

A crontab entry is shown below. At what time will the trimlog command be executed?

0  *  1,6  1   *   /home/root/trimlog

A3:

C.

4:

It is exactly 12:00 noon. You want to execute a command at the same time the next day. Which of the following commands will you use?

A4:

D.

Part Three: HP-UX Network Administration

Chapter 26: Basic Network Concepts

1:

The order of the top four OSI layers from top to bottom is:

A1:

B.

2:

What is the function of the network layer?

A2:

A.

3:

Peer protocols are used between:

A3:

C.

4:

Which OSI layer is divided into Logical Link Control (LLC) and Medium Access Control (MAC)?

A4:

D.

5:

What is not true about the OSI model?

A5:

C.

Chapter 27: Network Components and Topologies

1:

Which cable is used in 100BASE-T networks?

A1:

D.

2:

What is not true about a bridge?

A2:

B.

3:

Which of the following is not a physical layer device?

A3:

D.

4:

Terminators are used in:

A4:

A.

5:

CSMA/CD is not used in:

A5:

D.

6:

The maximum length of a 10BASE-2 cable segment is:

A6:

C.

7:

What is the maximum number of repeaters that can be used in an Ethernet network?

A7:

B.

8:

Which statement is true?

A8:

C.

Chapter 28: Introduction to TCP/IP Protocol

1:

The application layer of the OSI model covers which three layers?

A1:

B.

2:

What is the starting bit pattern of a class C IP address?

A2:

D.

3:

The maximum number of hosts in a class C network are:

A3:

C.

4:

A host on an IP network has an IP address 192.168.3.65 with a netmask 255.255.255.224. What is the broadcast address?

A4:

C.

5:

Given a netmask of 255.255.255.240, how many hosts can be placed in the network?

A5:

A.

6:

In an IP network, 18 bits are used in the network address. What is the value of the netmask?

A6:

A.

7:

Address resolution protocol is used to:

A7:

A.

8:

Which statement is true with reference to an IP address and a socket address?

A8:

B.

9:

Which file on HP-UX contains standard port numbers assigned to different applications?

A9:

B.

Chapter 29: Configuring LAN Interface Adapters

1:

Which command is used to list network drivers configured into the kernel?

A1:

D.

2:

For what purpose is the ifconfig command used?

A2:

D.

3:

The following statements are related to the assignment of IP addresses to network interfaces. Which of these is true?

A3:

B.

4:

For what purpose is the /etc/rc.config.d/netconf file used?

A4:

B.

5:

Which command is used to display a routing table?

A5:

B.

6:

When creating a default route, you see a network unreachable message. What may be the cause?

A6:

B.

7:

Which command is used for listing installed network adapters?

A7:

C.

Chapter 30: Configuring and Managing ARPA/Berkeley Services

1:

What port number is used for telnet service?

A1:

A.

2:

The telnet service is invoked using inetd. The configuration entry for this service contains the keyword nowait. What does it mean?

A2:

D.

3:

What is the server process for the rcp command?

A3:

A.

4:

Which command is used to execute a program on a remote system?

A4:

B.

5:

Which of the following is not a network service?

A5:

C. This is a restricted shell on HP-UX.

6:

An HP-UX server contains a single character + (plus) in the /etc/hosts.equiv file. Which hosts are allowed to use the network services?

A6:

A.

7:

You want to allow a user jeff at host myhp to access your account using the rlogin command. What should be present in the .rhosts file in your home directory?

A7:

C.

Chapter 31: Host Name Resolution and Domain Name Server

1:

A system has the following /etc/hosts file.

192.168.2.1 hp01
192.168.4.5 hp01

You use the ping hp01 command to send an ICMP packet to host hp01. To which IP address will these packets be sent?

A1:

A. The first matching entry in the /etc/hosts file is taken.

2:

Which file determines the order in which different services try to resolve a host name?

A2:

C.

3:

At which run level is named started?

A3:

B.

4:

What is the DNS port number?

A4:

D.

5:

The hosts_to_named command is run on which server?

A5:

A.

6:

Which file on a client machine is used for listing available name servers?

A6:

B.

7:

Which is the configuration file used by named at boot time?

A7:

B.

8:

You have your own domain name and want to create zones and delegate authority of these zones to a departmental name server. Which name server will delegate this authority?

A8:

B.

9:

For what purpose is the NS resource record used in DNS data files?

A9:

A.

Chapter 32: Configuring and Managing NIS

1:

An NIS client can take part in how many NIS domains?

A1:

A.

2:

What is true about an NIS domain name?

A2:

A.

3:

The ypxfr command is used on:

A3:

B.

4:

Which daemon is used for an NIS password change?

A4:

D.

5:

What is true about NIS?

A5:

A.

6:

Which of the following is not an NIS map?

A6:

D.

7:

Which command is used to display the name of an NIS server bound to a host?

A7:

C.

Chapter 33: Configuring and Managing the Network File System

1:

Which NFS version is supported on HP-UX 11.00?

A1:

D.

2:

Which HP-UX command can be used on an NFS server to list remotely mounted file systems by NFS clients?

A2:

D.

3:

How should the rpcbind, nfsd, and inetd daemons be started?

A3:

B.

4:

Which RPC daemon is used on HP-UX 11.00?

A4:

B.

5:

What is not true about NFS?

A5:

C.

6:

What is the advantage of NFS version 3 over version 2?

A6:

D.

7:

Which command is used to manually export file systems for remote mount?

A7:

B.

8:

Which command is used to list registered RPC services on a host?

A8:

A.

Chapter 34: HP-UX Automounter

1:

Which of the following is not an Automounter map?

A1:

B.

2:

When do you need to restart the automount daemon?

A2:

A.

3:

What is the default interval of time after which Automounter unmounts a directory if no reference is made to a mounted file system?

A3:

D.

4:

The master automount map contains the following indirect map entry.

/home            /etc/auto_home

The /etc/auto_home file has one line as shown below.

boota   hp0:/home/boota

Where will the directory /home/boota on an NFS server hp0 be mounted on the local system?

A4:

D.

Chapter 35: Network Time Protocol

1:

What is the most accurate time source for NTP?

A1:

A.

2:

What is the configuration file used by the xntpd daemon?

A2:

B.

3:

Which command is used to synchronize time with one or more NTP servers on the Internet?

A3:

A.

4:

What is the default polling time for a server?

A4:

A.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.139.108.150