CSCI 131 Techniques of Programming--Spring 2014

    Home | | Schedule | | Assignments | | Lectures | | Resources

    Solution to Lab 1

    Lab 1 Grade Sheet (25 points)

    The Linux Operating System and GNU Compiler

    (3 pt) Question 1 Describe briefly what the cal, factor, and ping commands do.

    cal displays a calendar, factor computes the factorization of a number, and ping measures the time it takes for messages to reach an Internet site.

    (4 pt) Question 2 Describe briefly how the -l and -R options affect the results of the ls command.

    The -l option causes it to print a longer, more detailed file listing, showing dates, times, sizes, etc. The -R option causes it to print a listing both for the directory itself, and for each directory contained within the directory, and so on, somewhat like a "find all files beneath a given folder" command.

    (2 pt) Question 3 How many files are in the ~/labs/lab1/practice directory? Don't count directories. (hint: look at the first character in each line when you do the ls -l command.)

    8

    (2 pt) Question 4 What is printed to the screen when you run the hello program?

    Hello, World!

    (3 pt) Question 5 What command, or sequence of commands, could you use to move the honor.txt and welcome.txt files from your lab1 directory to a new directory called messages within your lab1 directory?

    mkdir ~/labs/lab1/messages
    cp ~/labs/lab1/honor.txt ~/labs/lab1/messages/
    cp ~/labs/lab1/welcome.txt ~/labs/lab1/messages/

    (5 pt) hello.cc - Typed exactly, with correct indents and whitespace.

    (6 pt) greeting.cc - Typed exactly, with correct indents and whitespace.


    Home | | Schedule | | Assignments | | Lectures | | Resources



    CSCI 131: Techniques of Programming
    Last Modified: January 26, 2014
    Page Expires: September 1, 2014