Date post: | 05-Jul-2018 |
Category: |
Documents |
Upload: | alwaysastudent |
View: | 222 times |
Download: | 0 times |
8/16/2019 Software Development Tools 2015 Questions USQ
http://slidepdf.com/reader/full/software-development-tools-2015-questions-usq 1/19
CSC2408
Software Development Tools
Introductory BookSemester 2, 2015
8/16/2019 Software Development Tools 2015 Questions USQ
http://slidepdf.com/reader/full/software-development-tools-2015-questions-usq 2/19
Published by
The University of Southern QueenslandToowoomba, Queensland 4350Australia
http://www.usq.edu.au
c University of Southern Queensland, 2015.2
Copyrighted materials reproduced herein are used under the provisions of the Copyright Act 1968 as amended, or as a result of application to thecopyright owner.
No part of this publication may be reproduced, stored in a retrieval sys-tem or transmitted in any form or by any means electronic, mechanical,photocopying, recording or otherwise without prior permission.
8/16/2019 Software Development Tools 2015 Questions USQ
http://slidepdf.com/reader/full/software-development-tools-2015-questions-usq 3/19
Contents
Getting started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Course Organization . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Resource Materials . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Study Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Text book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Assessment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Course Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Study Desk . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Study Schedule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Assignment 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Assignment 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Assignment 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3
8/16/2019 Software Development Tools 2015 Questions USQ
http://slidepdf.com/reader/full/software-development-tools-2015-questions-usq 4/19
4 CSC2408—Software Development Tools
Getting startedThe Current Students website <http://www.usq.edu.au/current-students>
provides links to essential information which will assist you in your studiesat USQ. Use this site as a reference point to find information on:
• getting started
• organising enrolment
• assignment
• learning support
• student services
• student support
• opportunities
• graduation and beyond
IntroductionWelcome to the course CSC2408, Software Development Tools. The aim of this course is to give you a sound basic knowledge of the most important toolsavailable under the Unix operating system. This is particularly importantas many of the courses which you will undertake require use of Unix, andappropriate use of the tools provided will make your practical work mucheasier to complete.
Although the focus of this course is on Unix tools, many of the tools thatyou will use are generic. That is, tools of very similar functionality, thoughmost likely with a different interface, exist under other operating systems.
Hence Unix-specific knowledge gained in this course can be transferred laterto other operating environments.
A look at the table of contents of the Study Book will indicate the topicscovered. Note that installing Linux is not an assessable part of the course —we assume that you have used the materials available on the DepartmentalDVD-ROM set to install Linux.
This course is user-focused; we concentrate entirely on tools used by thegeneral user, rather than the system administrator. System administrationis covered by another course by name of System and Security Admin-istration.
cUniversity of Southern Queensland
8/16/2019 Software Development Tools 2015 Questions USQ
http://slidepdf.com/reader/full/software-development-tools-2015-questions-usq 5/19
CSC2408—Software Development Tools 5
Course OrganizationThe Study Book together with the Study Schedule on page 10 of this bookare your main guides to completing this course. You should work throughthe Study Guide at the rate described in the Study Schedule. Many of theexercises in the Study Book must be completed and handed in for assess-ment. It is strongly recommended that you attempt all exercises , whetheror not they are assessable. Be aware that skills and knowledge gained fromcompleting non-assessable exercises may still be examined in the examina-tion.
Resource Materials
Study Book
This is your primary reference. It contains some original material which willbe needed to complete exercises, but most of the study material is derivedfrom the textbook. The Study Book contains a large number of exercises;many of these must be completed and handed in for assessment.
Text book
There are a number of excellent texts about the Unix operating system.Some are brief introductions, while others are much wider in scope. Sometexts also include some programming guidance. We have chosen the A Prac-
tical Guide to Linux Commands, Editors, and Shell Programming by Sobell.This is an excellent book. It is perhaps less tutorial in style than someother books, but it contains a wealth of detailed, well organized informa-tion. While it is not the appropriate choice for someone wanting a quick
introduction to Unix, it is ideal as a long term companion.
You may choose to use or consult other Unix texts rather than the recom-mended text. This is acceptable and as long as you are able to complete theexercises and can cover the conceptual material contained in chapters 2, 3and 4.
Readings
These are supporting documentation not covered by the textbook. Alsoincluded for your convenience are copies of some Unix man pages. The
cUniversity of Southern Queensland
8/16/2019 Software Development Tools 2015 Questions USQ
http://slidepdf.com/reader/full/software-development-tools-2015-questions-usq 6/19
6 CSC2408—Software Development Tools
largest part of the Readings is the complete GNU Make manual , which youshould find useful in many other courses.
Course DVD-ROM
The course DVD-ROM contains a complete pre-installed Virtual Debiansystem created from the Department’s Debian/GNU Linux Distribution.
This DVD-ROM is for emergency use only. It is for students having troubleinstalling Debian Linux on their computer—they will have access to a Linux
distribution that will allow them to do the exercises and assignments withoutfalling behind—while they sort out the problems of their installation.
A virtual operating system is no substitute for an installed operating system—remember this is not the only course you will do that will require access toa Linux operating system—it is far better to install the Operating Systemrather than rely on a virtual system.
WWW
All course material is available from the Course Home Page accessible via
the USQStudyDesk
This is important!
The course webpage described above is your primary point of
contact with the university for this course. You can submit as-
signments via this site, and also retrieve results and feedback.
AssessmentYou are required to complete three (3) assignments and an examination.Details of due dates and weighting appear in the Table below and in theassignment specifications later in this book. The course specification can beaccessed via the course home page.
As there are three(3) assignments you must complete them in a timely man-ner. In particular, you must ensure that you install Linux early in thesemester so that you can proceed with the assignments.
cUniversity of Southern Queensland
8/16/2019 Software Development Tools 2015 Questions USQ
http://slidepdf.com/reader/full/software-development-tools-2015-questions-usq 7/19
8/16/2019 Software Development Tools 2015 Questions USQ
http://slidepdf.com/reader/full/software-development-tools-2015-questions-usq 8/19
8 CSC2408—Software Development Tools
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++inode is a data structure that contains information about a file.
An inode for a file contains the file’s length, the times the file
was last accessed and modified, ......
It is vitally important that your assignment is clearly laid out. It mustbe a straightforward matter for the examiner to determine that you havecompleted each question satisfactorily. We want quality not quantity, northe amount of time you sent on it. Poorly organized submissions will berejected.
Assignment Results and Feedback
Assignment results will be posted on your StudyDesk. It is your responsi-bility to check the assignment link regularly to determine your result.
cUniversity of Southern Queensland
8/16/2019 Software Development Tools 2015 Questions USQ
http://slidepdf.com/reader/full/software-development-tools-2015-questions-usq 9/19
CSC2408—Software Development Tools 9
Course SupportSupport for this course is available for all enrolled students. The mainavenues for help, in order, are
• The discussion forums on the course web pages. Any query postedto the course forums should be answered by anyone who can. It isnot just to be a forum for the lecturer of the course but as a generalcommunication forum for all the students in the course.
• If you need to communicate to the examiner of the course then send
email via message facility available on the course web pages.
• You can also communicate to the lecturer of the course via Ask USQ– from the homepage: UConnect > UAsk > Ask USQ.
• If you have a specific Linux question you can contact the lecturer orsend email to [email protected]
Study Desk
Your StudyDesk in UConnect gives access to a home page for every course
in which you are currently enrolled. Content available from the course homepage will vary according to the teaching requirements of the course, but mayinclude:
• course materials and resources,
• electronic discussion facilities,
• access to past examination papers.
As each course has specific learning requirements, availability of these fea-
tures will vary between courses.
Links
UConnect gives access to the Library and the Academic Learning Supportsite, as well as the Quick Links list of University sections and services.
cUniversity of Southern Queensland
8/16/2019 Software Development Tools 2015 Questions USQ
http://slidepdf.com/reader/full/software-development-tools-2015-questions-usq 10/19
8/16/2019 Software Development Tools 2015 Questions USQ
http://slidepdf.com/reader/full/software-development-tools-2015-questions-usq 11/19
CSC2408—Software Development Tools11
Assignment 1Weight 15%
Due Date See course specification
1. It is compulsory to use either vi or emacs to edit the assignmentfile, in which the answer to all questions must be included.
2. The file must be compressed by either use tar or zip before
submission.
Question 1. (10 marks)
Assume that a file’s permissions give you read and write access.
• What is the difference between ls -l and ls -ld?
• If a directory has “r” only access, can you change into the directory?
• If a directory has “x” only access, can you list the content of thatdirectory?
• What operations can you perform on the file if it is in a directorywhich has “r” (read) only access?
• What operations can you perform on the file if it is in a directorywhich has “x” (execute) only access?
Question 2. (10 marks)
Answer the following questions about regular expression, give an example if necessary.
• what is the difference between ab.cd and ab*cd?
• what is the difference between ab.*cd and abb*cd ?
• what is the difference between ^abc and ^abc$?
• what is the difference between [abc]d and [^abc]d?
• What is the difference between [A-Z][_a-zA-Z0-9]* and [A-Z_][a-zA-Z0-9]*?
(Note the regular expression “x*$” could be described as a line has “zero ormore x at the end of the line”.)
cUniversity of Southern Queensland
8/16/2019 Software Development Tools 2015 Questions USQ
http://slidepdf.com/reader/full/software-development-tools-2015-questions-usq 12/19
12 CSC2408—Software Development Tools
Question 3. (10 marks)• Give the command-line of using find to list all the files having specific
username in the current directory
• Give the command-line of using find to list all the subdirectories inthe current directory
• Use find to produce a long ls listing of all files in /usr/bin that aremore than 750Kb long. Give all the arguments and options in thefollowing command-line
find ..... -exec ls -l {} \;
Note that pay special attention to the arguments or options. Thesemicolon must be escaped, but not the {}.
Question 4. (10 marks)
Create a big file (If you don’t know how to create a big file, try ls -l
/usr/bin > bigfile). Create two copies of it using cp, and call them
big1 and big2.
• Give the command-line of compressing big1 using gzip (should pro-duce big1.gz).
• Compress big2 using bzip2(should produce big2.bz2).
• Give the command-line of comparing the sizes of the compressed files(big1.gz and big2.bz2) and the original (bigfile) using ls -l
• Give the command-line of checking the file type of compressed filesand the original.
• Give the command-line of displaying the contents of big1.gz usingzcat and big2.bz2 but using bzcat without uncompress them. (Youmay pipe the output to head -10 to avoid lots of output).
Question 5. (10 marks)
• Use tar to create an archive (don’t use the z or j option) of all thefiles in the current directory.
• Compress the tar file with gzip.
cUniversity of Southern Queensland
8/16/2019 Software Development Tools 2015 Questions USQ
http://slidepdf.com/reader/full/software-development-tools-2015-questions-usq 13/19
CSC2408—Software Development Tools13
• View the contents of archive withgunzip -c gzipped-tar-file | tar tfv -
• View without using gunzip but use the tar instead. (Hint: find theright option to use from the man page).
• Create a subdirectory of the current directory.
• Use tar to unpack the archive into that directory at the current di-rectory.
Question 6. (10 marks)Assume you have a text file called file. Explain the following command-lines.
1. sed "s/the/a/g" file
2. sed -n "s/[A-Z]/&/gp" file
3. sed "32,45 s/[()]//g" file
4. sed "/^$/d" file
5. sed "s/\([0-9]\)-\([0-9]\)/\1\2/g" file
6. sed "80q" file
For example, sed ’s/fox/ox/g’ file will replace all occurance of fox withox and not the just the first one in file.
cUniversity of Southern Queensland
8/16/2019 Software Development Tools 2015 Questions USQ
http://slidepdf.com/reader/full/software-development-tools-2015-questions-usq 14/19
14 CSC2408—Software Development Tools
Assignment 2Weight 15%
Due Date See course specification
Instructions:
All LATEX files are edited by using vi (or emacs) editor. Yoursubmission include the following three items in a compressed file.
• A PDF file for Question 1.
• A LATEX text file for Question 2, 3, 4.
• One PDF file generated from the above LATEX file.
Question 1. (5 marks)
Create a LATEX document, which should be in 11point font
• It contains at least one section and subsection. Include some text intypewriter font, italics , SMALL CAPS and bold.
• Expand the document as follows.
1. Add a title with your name and the date
2. Include at least two forms of list
3. Include a piece of verbatim text – this might be a program or aprogram fragment.
4. Experiment with font size: try out all (at least 4) the availablefont sizes and include the results in your document.
• Expand the document further
1. Add a table of contents
2. Create a floating table with caption. It should look just likethe one in Table 1, except that the table number will be differ-ent(Don’t have to use the multirow package).
3. Typeset the following formulae and add them to the document
x = −b ±√
b2 − 4ac
2a
cUniversity of Southern Queensland
8/16/2019 Software Development Tools 2015 Questions USQ
http://slidepdf.com/reader/full/software-development-tools-2015-questions-usq 15/19
CSC2408—Software Development Tools15
Category ToolCommand Description
Editor emacs Emacs extensible text editorvi Visual editor
Scripting bash GNU Bourne-Again SHellperl Practical Extraction and Report Language
Document rcs Revision Control SystemManagement LATEX Document Typesetting Package
make Managing Project Utility
Table 1: Some Unix Utilities
4. Typeset the following mathematical formula (1).
∆(x) =
1 if x > 0−1 if x < 00 otherwise
(1)
Question 2. (20 marks)
Write a well structured Bash script to delete comments from a C program. InBash script, you may use sed commands or other Linux utilities. The stan-
dard comment or commentline in C programs starts with the two-characterstoken (/*) and ends with the two-character token (*/). Assume that eachcomment line contains the start and end tokens without any other state-ments before and after. You need to pay attention to the following cases:
/* a comment line in a C program */
printf("It is /* NOT a comment line */\n");
x = 5; /* This is an assignment, not a comment line */
[TAB][SPACE] /* another empty comment line here */
You can test your Bash script on a C program containing all above four
lines. The expected output should look like
printf("It is /* NOT a comment line */\n");
x = 5; /* This is an assignment, not a comment line */
where TAB and SPACE stands for the Tab key strokes or white spaces.
Question 3. (15 marks)
Write a short script that tells you whether the permissions for two files,whose names are given as arguments to the script, are identical. If the
cUniversity of Southern Queensland
8/16/2019 Software Development Tools 2015 Questions USQ
http://slidepdf.com/reader/full/software-development-tools-2015-questions-usq 16/19
16 CSC2408—Software Development Tools
permissions for the two files are identical, output the common permissionfield. Otherwise, output each filename followed by its permission field.
Note that you should
1. Add comments where needed and appropriate.
2. Verify the total number of arguments in the command line.
3. Try using the cut utility.
Question 4. (20 marks)
Write a short but well structured Bash script that, given the name of a fileas an argument, reads the file name and creates a new file containing onlythose lines which have one word in it. Here is an example of the input file.
This is a special text file
There
are 20 students in the class.
[TAB][SPACE] Nearly
half of them are enrolled in FoS. The rest are in
Faculty-Of-ES.
The output file from the script should look like
There
[TAB][SPACE] Nearly
Faculty-Of-ES.
Ensure the script has error and robustness checking.
cUniversity of Southern Queensland
8/16/2019 Software Development Tools 2015 Questions USQ
http://slidepdf.com/reader/full/software-development-tools-2015-questions-usq 17/19
CSC2408—Software Development Tools17
Assignment 3Weight 10%
Due Date See course specification
Instructions:
• use vi (or emacs) to edit the answer for each question in a LATEXdocument.
• apply latex, dvips, pstopdf(or just pdflatex if installed) to produce aPDF file.
The submission should be a compressed file, in which a PDF fileis included.
Question 1. (15 marks)
Suppose there are two C source (transaction.c and reports.c) and two header
files (trans.h and reps.h). Write explicit rules for a Makefile/makefile thatreflects the following relationships:
1. The C source files transaction.c and reports.c are compiled toproduce an executable accts.
2. transaction.c and reports.c include a header file accts.h
3. The header file accts.h is composed of two other header files: trans.h
and reps.h.
(Note that any Linux commands or utilities can be used as the constructioncommand of the makefile if necessary)
Question 2. (15 marks)
Read the makefile below which has some implicit rules.
COBJECTS = menu.o users.o resellers.o propspects.o
HFILES = menu.h
leads: $(COBJECTS)
cUniversity of Southern Queensland
8/16/2019 Software Development Tools 2015 Questions USQ
http://slidepdf.com/reader/full/software-development-tools-2015-questions-usq 18/19
18 CSC2408—Software Development Tools
gcc -o leads $(COBJECTS)
menu.o users.o resellers.o prospects.o: $(HFILES)
1. first identify:
• all of targets
• all of construction commands
• all of dependencies; and
• all macros
2. Then rewrite the makefile by replacing the implicit rules with theexplicit rules.
Question 3. (10 marks)
Use a small text file to experiment with the RCS system. Note that RCStreats all ASCII file the same way; the files do not necessarily be programs,though usually are programs. Specially you should
• Place a $Log$ keyword in the file
• Complete a set of check in operations which result in the RCS filestructure depicted in Figure 1.
2.1
1.2
2.2
2.1.1.1
1.2.2.1
1.2.1.1
1.2.1.2
1.2.1.1.1.1
1.1
Figure 1:
You will need to make small changes to the source file between checkin operations.
cUniversity of Southern Queensland
8/16/2019 Software Development Tools 2015 Questions USQ
http://slidepdf.com/reader/full/software-development-tools-2015-questions-usq 19/19
CSC2408—Software Development Tools19
• Associate a symbolic name with revision 2.1.1.1
• Make the branch containing revision 2.1.1.1 the default branch
• Use rlog to verify the RCS structure.
Give all the command or command lines used in each step of activities, alongwith a brief description.
cUniversity of Southern Queensland