Department
of Computer Science CS403
Quiz - Sample
Directions: Follow instructions
carefully. Write your name in the upper right hand corner. Read each question
carefully and select the best answer
by circling the corresponding letter next to it. Be sure you have all 4 pages
of the quiz before you start. There are 15 questions and 20 points total – the
last question is worth 6 points. Notice the extra credit question at
the end of the quiz.
a)
UNIX is a widely used mail system.
b) UNIX is case sensitive.
c) UNIX has a graphical user interface.
d) All of the above are true.
e) None of the above is true.
a) % ls
b) % ls –a
c) % ls –l
d) % more –al
e) All of the above will work.
Which of the following will change the permissions so
that the file can be viewed on the WWW?
a) % chmod og+x mypage.html
b) % chmod og+x ~
c) % chmod og+r index.html
d) % chmod og+r mypage.html
e) None of the above will work
a)
The default
permissions are: r w x - - - - - -
b) You must be in your home directory.
c) You use the pico Unix
command to create a directory
d) The directory
name must end in _html
e) All of the
above are true.
5.
The file assign4.html has permissions set as r w x r w x r w x
This means that:
a) The file is really a directory and was named
incorrectly.
b) It is impossible for an html file to have permissions
set that way.
c) Everyone can read, write, and execute the file.
d) The file can not be viewed on the WWW.
e) All of the above are true.
6. Which command is used to create the image
file mypicture.jpg?
a) % mkdir mypicture.jpg
b) % more mypicture.jpg
c) % pico mypicture.jpg
d) % cd mypicture.jpg
e) None of the above will work.
7.
What does the
following command do?
% pico
README
a)
Creates a
directory called README
b)
Creates a file
called README.html
c)
Opens the Pine
mail program to read mail
d)
Edits an existing
file called README
e)
None of the above
are true.
8.
Which of the
following commands displays the full pathname of the directory you are positioned in?
a)
% man pwd
b)
% cd
c)
% cd ~
d)
% pwd
e)
% ls
9.
Which command
always puts you in your home directory?
a)
% home
b)
% cd
c)
% cd . .
d)
% pwd
e)
% cd public_html
10.
Which command is
used to make changes to your homepage?
a)
% cd public_html
b)
% chmod og+x public_html
c)
% pico homepage.html
d)
% more index.html
e)
% pico index.html
11.
What will the
following command do?
% chmod og+r *.jpg
a)
Change the
permissions on the file *.jpg so that it is readable.
b)
Change the
permissions on all image files so that they can be displayed on the WWW.
c)
Change the
permissions on any file that ends in .jpg in the current directory so that it
is viewable on the WWW.
d)
Change
permissions on the directory so that image files can be saved in it.
e)
It is not a valid
command because the file name contains a *.
12.
To rename the
file a.html to b.html, which command do you use?
a)
% cp -i b.html a.html
b)
% mv -i b.html
a.html
c)
% cp -i a.html b.html
d)
% rename
-i
a.html b.html
e)
% mv -i a.html
b.html
13.
To delete a file
called mynotes.txt, which command do you use?
a) %
b) % rmdir mynotes.txt
c) % pico mynotes.txt
d) % rm -i mynotes.txt
e) None of the above commands
will work.
14.
All of the
following conditions are necessary to view your homepage on the WWW here at UNH
except:
a)
The html file
needs to reside in a sub-directory of your home directory called public.html
b)
The permissions
on the html file need to be set so that it is world-readable.
c)
The permissions
on your home directory and public_html need to be set
so that they are world-executable.
d)
The html file
name needs be index.html.
e)
All of the
conditions above are necessary.
15.
(6 points) The student whose username is
agoodstudent currently has a homepage here at UNH that is
viewable on the WWW.
a)
What is the url of his homepage? (There are two that will work,
either will do…)
________________________________________________________________
b)
He executes the following series of commands
(correctly). Draw the Unix directory tree that
represents what his Unix directory structure will look like; start by putting
his username at the top of the tree. Use the space next to the commands to draw the tree.
Commands executed:
% cd
% cd public_html
% mkdir CS403
% chmod 711
CS403
% cd CS403
% pico assign1.html
% chmod 644
assign1.html
% mkdir IMAGES
% chmod 711
IMAGES
% cd
% cd public_html
% pico
mypage.html
% chmod 644
mypage.html
c)
The next day he
emails the file mypic.jpg as an attachment to his cisunix account and saves the image by specifying the
following pathname before the image file name when prompted to do so:
public_html/CS403/IMAGES
Add this file to your directory tree
structure above.
d)
EXTRA CREDIT:
List the Unix
commands to change the permissions on the file mypic.jpg
so that it can be viewed on the WWW: