Вы находитесь на странице: 1из 13

SENECA COLLEGE OF APPLIED TECHNOLOGY

SCHOOL OF COMPUTER STUDIES

FINAL EXAMINATION

SUMMER 2002 OPERATING SYSTEMS - UNIX UNX122

STUDENT NAME : ________________________________________

STUDENT NUMBER: _____________________________

SECTION: _______________________________________

DATE: MONDAY AUGUST 12, 2002

TIME ALLOWED: 2 HOURS

QUESTIONS
PART A MULTIPLE CHOICE 20 MARKS
PART B XWINDOWS / KDE 15 MARKS
PART C UNIX COMMANDS 20 MARKS
PART D SHORT ANSWERS 10 MARKS
PART E FILE MANAGEMENT 15 MARKS

TOTAL MARKS 80

PROFESSOR (S): Jim Chow / Murray Saul, Gordon Ma / David Ward

SPECIAL INSTRUCTIONS:

1. AIDS: ONE 8 ½ x 11 INCH REFERENCE SHEET


(HAND-WRITTEN,BOTH SIDES)
2. ANSWER ALL QUESTIONS ON THE EXAM PAPER.

SECTION 8.9 OF SENECA COLLEGE ACADEMIC POLICY:


CHEATING: is an offence, which will not be tolerated by the College. Such offences
occur when a student violates the procedures governing the administration of
examinations, tests or other means of evaluating student achievement in a subject or
program.

APPROVED BY: ______________________________


VAL FREEMAN, CHAIR

UNX122v1 Page 1 of 13 pages


1
PART A – MULTIPLE CHOICE 20 MARKS
Choose by circling the best answer for each question (circle only 1 answer).
One point will be awarded for each correct answer.

1. If your telnet session in Matrix is not working properly, you should set the terminal emulation
setting to:

a) xterm
b) ascii
c) vt100
d) vt52

2. To search for short descriptions and manual names for the Unix command containing the
keyword “chat”, you issue the Unix command:

a) man chat
b) man –k chat
c) man –s chat
d) man –f chat

3. Which of the following Unix commands will provide information regarding a process that
you wish to terminate?

a) ps
b) process
c) <CTRL><c>
d) kill -9

4. Which of the following are features of the Unix OS?

a) Allow more that one person to communication with the computer.


b) Allow users to share or restrict access to their files.
c) Allow a routine series of Unix commands to be run automatically as shell scripts.
d) All of the above are features of the Unix OS.

5. Assuming that the user is currently in their home directory, which of the following Unix
commands will copy the entire contents of the user’s home directory (including subdirectory
contents) to a directory called ~/backup?

a) copy ~ ~/backup
b) cp –r ~ ~/backup
c) cp . ~backup
d) Both a and b

UNX122v1 Page 2 of 13 pages


2
PART A – MULTIPLE CHOICE 20 MARKS
6. Which of the following Unix commands will change permissions for all files contained in the
directory pathname ~/unx122/samples to allow full permissions for the user, read and execute
permissions for group and others?

a) chmod 711 ~/unx122/samples


b) chmod 755 ~/unx122/samples
c) chmod 755 ~/unx122/samples/*
d) chmod 766 ~/unx122/samples

7. Which of the following Unix commands will display lines 3 to 7 of a 10 line file called fun
that is contained in your current directory?

a) head –7 fun | tail -5


b) tail –8 fun | head -5
c) both b and c
d) cat fun | head -5

8. What will happen if the following Unix command is issued:

sort | tail +25 > abc

a) The last 25 lines (sorted in alphabetical order) will be stored in file abc (overwriting
previous contents.
b) The last 25 lines (sorted in alphabetical order) will be appended to file abc.
c) Lines 25 to the bottom of the file will be appended to file abc.
d) Nothing will immediately happen.

9. The octal number 7325 represents ______________ as a binary number.

a) 111011010101
b) 111001010100
c) 111111010110
d) 111000110111

10. Assume that the following Unix commands have just been issued:

umask 127
touch myfile

What are the permissions for the file myfile that was just created?

a) r – x r – x - - x
b) r - - r - - - - -
c) r w x r – x - - -
d) r w – r - - - - -

UNX122v1 Page 3 of 13 pages


3
PART A – MULTIPLE CHOICE 20 MARKS

11.Assuming that you are in the vi editor in command mode, which of the following commands
will abort the current editing session?

a) Q
b) :q
c) ZZ
d) :q!

12. Which of the following Unix commands will display all lines in the file called report that
begin with 3 numbers?

a) egrep “$[0-9][0-9][0-9]” report


b) egrep “[1-9][1-9][1-9]$” report
c) egrep “^[0-9][0-9][0-9]” report
d) egrep “^[^a-zA-Z][^a-zA-Z][^a-zA-Z]” report

13. Which of the following key-combinations will open a run dialog box within KDE?

a) <ALT><r>
b) <ALT><F3>
c) <ALT><F2>
d) <CTRL><ESC>

14. Which of the following key-combinations will move to the next virtual desktop (in
descending order)?

a) <SHIFT><CTRL><TAB>
b) <CTRL><TAB>
c) <CTRL><f>
d) <CTRL<F1>

15. A Window manager in X-Windows:

a) Provides a method to send information via TCP/IP


b) Can run without the X-Windows environment running.
c) Can be used to support a Desktop Manager
d) All of the above

16. Which of the following Linux applications can incorporate text and graphics?

a) Dia
b) Abiword
c) vi
d) both a and b

UNX122v1 Page 4 of 13 pages


4
PART A – MULTIPLE CHOICE 20 MARKS

17. Which of the following operations use bit-wise operations?

a) Changing directory and file permissions.


b) Setting up the user mask.
c) Performing mathematical calculations.
d) All of the above.

18. Which of the following Linux applications allow you to manipulate graphics?

a) Windows Explorer
b) K-edit
c) Konqueror
d) GIMP

19. What does the term “globbing” mean?

a) To erase all contents of a user’s account.


b) Replace or expand wildcard symbols with matched files or directories.
c) Remove all non-empty directories.
d) To break into another user’s account.

20. A shell script can perform the following task(s):

a) Is used to automatically run routine Unix commands.


b) Can be used to configure a user’s environment upon login.
c) Is a file that contains Unix commands to achieve a task.
d) All of the above are tasks performed by a shell script.

UNX122v1 Page 5 of 13 pages


5
PART B – XWINDOWS / KDE 15 MARKS

1. For each of the following questions, fill in the blank with the appropriate term or
description. (4 marks)

1. ______________________________ 3. ______________________________

2. ______________________________ 4. ______________________________

2. Fill in the chart with the KDE shortcut key to perform the given operations.
(4 marks)

Operation KDE Shortcut Key


Display K menu

Switch among windows

Change virtual desktops


(descending order)
Abort X windows session

UNX122v1 Page 6 of 13 pages


6
PART B – XWINDOWS / KDE 15 MARKS
3. For each of the following questions, match the letter in the spaces provided to complete
the following tasks. The listing of letters must be in the correct sequence. If you have
completed your task, leave the remaining spaces blank.

Tasks:
a. Copy the value on the calculator application List of Actions:
to the K-edit text editor. You can assume that
the calculator and the K-edit applications a. Press <CTRL><x>.
are already open. (2 marks) b. Point and click the application icon.
c. Press <ALT><F3>.
1. _________ d. Select the execute tab.
e. Press <ALT><F2>.
2. _________ f. Replace the filename with scores.html
in the name dialog box.
g. Enter the command ~/a.out in the
3. _________
command textbox.
h. Type ren grades.html scores.html.
4. _________ i. Point and click the value contained in
the calculator window.
b. Create an icon on the KDE desktop that will j. Move cursor to desired location within
run the program ~/a.out (3 marks) K-edit document and press
<CTRL><v>.
1. _________ k. Point and right-click on the file named
index.html.
2. _________ l. Point and click on OK.
m. Select rename from the context menu.
3. _________ n. Highlight the value in the calculator
window and press <CTRL><c>.
o. Select link to application from the
4. _________
context menu.
p. Press <ALT><TAB> until the K-edit
c. Rename the file grades.html to scores.html. application window is active.
You can assume that both of these files are q. Press <CTRL><p>.
contained in your current directory. (2 marks) r. Press <ALT><F1>.
s. Point and right-click on the desktop.
1. _________

2. _________

3. _________

4. _________

UNX122v1 Page 7 of 13 pages


7
PART C – UNIX COMMANDS 20 MARKS

Use the information displayed below to answer questions 1 to 4:

cat cars

chevy novass 79 60
ford mustang 65 45
volvo gl 78 102
ford ltd 83 15
chevy nova 80 50
honda accord 81 30
ford thundbd 84 10
chevy impala 65 85
ford bronco 83 25

Show the exact output (what is displayed) by each of the following Unix commands. Assume the
file cars is located in your current directory.

1. tail +6 cars (2 marks)

2. egrep “s{2,}” cars (2 marks)

3. grep chevy cars | sort –u (2 marks)

4. sort –nk3 cars (2 marks)

UNX122v1 Page 8 of 13 pages


8
PART C – UNIX COMMANDS 20 MARKS

For questions 5 to 11, each question must be answered with a single Unix command, without
making use of the command separator character ; (semicolon). You can assume that all files are
contained in your current directory.

5. Write a single Unix command to save the current date and time into a file called current_date.
This file should only contain the current date and time. (1 mark)

6. Write a single Unix pipeline command to display a sorted list of all unique lines in a file
called phone_numbers.txt. (2 marks)

7. Write a single Unix pipeline command to display the total number of files begining with a
number, but not ending with two numbers. (2 marks)

8. Write a single Unix pipeline command to display only the file-type information for file types
called ascii (either uppercase or lowercase – 2 marks)

9. Write a single Unix pipeline command to display the number of times that you are logged
into the current server (make certain to use one environment variable - 2 marks)

10. Write a single Unix pipeline command to display only lines 7 to 14 for a file called “input”
contained in your current directory (2 marks)

11. Write a single Unix command to display all pathnames containing the utility grep or all
pathnames containing manual pages for the grep utility. (1 mark)

UNX122v1 Page 9 of 13 pages


9
PART D – SHORT ANSWER 10 MARKS

You are required to answer only 2 out of the following 4 questions. Your instructor will answer the
questions in order of appearance (including partially answered questions).

1. Complete the following conversion table (show your work). (5 marks)

Octal Hexadecimal Binary


257

2. In point form, briefly describe the development of the Unix operating system and how it led
to the development of the Linux operating system. (5 marks)

UNX122v1 Page 10 of 13 pages


10
PART D – SHORT ANSWER 10 MARKS
3. Explain step by step in terms of stdin and stdout what the following Unix command does:

ls –F | grep / | tail +5 >> stuff

4. List and explain 3 features of Unix that makes it different than MS-Windows.
(5 marks)

UNX122v1 Page 11 of 13 pages


11
PART E – FILE MANAGEMENT 15 MARKS
All answers are based on the following tree diagram displayed below. You can assume that
your Matrix username is called skywalkr and you will be currently located in the directory
called /home/skywalker for each of the following questions. Assume all questions are
independent of one another. skywalker and obiwan belong to different groups.

/home Additional Information:


|- skywalkr
| |-- jedi_manual.txt Directories are: home,
| |-- rebel.TXT skywalkr, HOMEWORK1,
| |-- create_force1.TXT HOMEWORK2,
| |-- create_force2.c POD_RACER, schedule,
obiwan, and TRAINING.
| |-- HOMEWORK1
| |-- HOMEWORK2
| |-- POD_RACER
| |-- op_manual.txt
| |-- schedule
| |-- june.txt
| |-- august.txt
|- obiwan
| |-- create_force1.TXT
| |-- light_saber.txt
| |-- pointers.c
| |-- TRAINING
| |-- jedi_mind_trick.txt

1. Write a single Unix command to add the following directory path starting from the
POD_RACER directory. (1 mark)

POD_RACER
|-- MANUALS
|-- PARTS
|-- FUSION

2. Write a single Unix command to allow the user obiwan to at least read the files in your
schedule directory. You can assume you have pass-through permissions in your home and
POD_RACER directories. (2 marks)

3. Write a single Unix command to copy all text files (i.e. files that end with an uppercase or
lowercase .txt ) in obiwan’s home directory to your home directory. Make certain that you do
not accidentally overwrite any of your files. (2 marks)

UNX122v1 Page 12 of 13 pages


12
PART E – FILE MANAGEMENT 15 MARKS
4. Write a single Unix command to remove all files and directories in your POD_RACER
directory. Make certain to have the system prompt you prior to removing files or directories.
(2 marks)

5. Write a single Unix command to create a file in your home directory called
pointers_obiwan.c that is a link to the file called pointers.c in obiwan’s home directory.
(2 marks)

6. Write a single Unix command to change the file called june.txt to july.txt. (1 mark)

7. Write a Unix pipeline command to display only directory filenames in your current directory.
(2 marks)

8. Write a single Unix command to list only directories contained in your home directory that
begin and end with two letters (either uppercase or lowercase – 2 marks).

9. Write a single Unix command to display the filenames in your current directory with a
description of the file type. (1 mark)

UNX122v1 Page 13 of 13 pages


13

Вам также может понравиться