Description
22T2 Final Exam
12 questions — 100 marks
10 minutes reading; 3 hours working
Examination Information Examination Instructions and Conditions
For students with approved examination extensions from UNSW Equitable Learning Services, you should continue working until your extended working time expires.
You must not communicate with any person during the examination except for COMP(2041|9044) staff via cs2041.exam@cse.unsw.edu.au.
You are not permitted to talk, email, telephone, message , … anyone except for COMP(2041|9044) staff. — You must not get help from anyone during this exam, except for COMP(2041|9044) staff.
You must not communicate (email, message, post, …) your exam answers to anyone, until 24 hours after the exam.
Some students have extended time to complete the exam.
You must ensure that, during and after the examination, no other person can access your work.
You must not place your examination work in a location accessible to any other person, whether they be a student in the course or otherwise. This includes file-sharing services such as Dropbox or GitHub.
You must not use code-synthesis tools, such as GitHub Copilot, during this exam.
Your zPass should not be disclosed to any other person. If you have disclosed your zPass, you should change it immediately.
This is a closed-book examination.
You are not permitted to access papers or books.
You are not permitted to access files on your computer or other computers, except:
Deliberate violation of exam conditions is academic misconduct, and will be referred to the UNSW Student Conduct and Integrity Unit.
Examination Structure
This examination has 12 questions, worth a total of 100 marks. Questions are not worth equal marks.
All 12 questions are practical questions.
You must answer each question in a separate file. Each question specifies the name of the file to use. Make sure you use exactly this file name.
You can verify what submissions you have made with 2041 classrun -check final_q<N>
Available Resources: Language Documentation
manual entries, via the man command.
Texinfo pages, via the info command.
Bash documentation, via the help build-in.
Python documentation, via the python3 -c ‘help()’ command.
Shell/Regex quick reference Python quick reference full Python 3.9 documentation
Troubleshooting
If you are having issues working on the exam at CSE, please try the following:
<https://www.cse.unsw.edu.au/~learn/homecomputing/ssh/> or <https://taggi.cse.unsw.edu.au/FAQ/Logging_In_With_SSH/>; if you are using SSH: try logging out and logging back in. If the problem persists, try using VLAB instead: instructions at
<https://www.cse.unsw.edu.au/~learn/homecomputing/vlab/> if you are using VSCode: try disconnecting and reconnecting; or try changing servers from vscode.cse.unsw.edu.au to vscode2.cse.unsw.edu.au.
Special Consideration
You must also contact course staff via cs2041.exam@cse.unsw.edu.au as soon as it is clear the issue cannot be fixed.
Fit-to-Sit
This exam is covered by UNSW’s Fit-to-Sit policy. That means that, by sitting this exam, you are declaring yourself well enough to do so. You will be unable to apply for special consideration after the exam for circumstances affecting you before it began.
If you have questions, or you feel unable to complete the exam, contact cs2041.exam@cse.unsw.edu.au.
Getting Started
Set up for the exam by creating a new directory called exam_final , changing to this directory, and fetching the provided code by running these commands:
$ mkdir -m 700 exam_final
$ cd exam_final
$ 2041 fetch exam_final
Or you can download the provided code as a zip file or a tar file.
If you make a mistake and need a new copy of a particular file, you can do the following:
$ rm broken-file
$ 2041 fetch exam_final
Only files that don’t exist will be recreated. All other files will remain untouched.
You have been given the file awards.psv
This file contains information about Nobel Prize, Turing Award and Fields Medal winners Each line in the file contains the following six fields:
. Award Name
. Award Year
. Winner Name
. Winner Gender
. Winner Country
. Winner Birth Year
Each field is separated from the next field by a pipe character ( | ).
Your task is to write four grep commands which will print specified lines from this file.
You have been given the file final_q1.txt .
In final_q1.txt add answers to the four questions.
Add each answer in the specified location.
Do not add, remove, or change any other text in the file.
The autotest depends on the exact format of the file.
Each question should be answered with a single grep command.
. Question 1
Write a grep command that will print the lines in awards.psv that contain awards won by an Australian.
. Question 2
Write a grep command that will print the lines in awards.psv that contain a female ACM Turing Award winner.
. Question 3
Write a grep command that will print the lines in awards.psv that contain Nobel Prizes won by a person born between 1990 and 1999 (inclusive).
. Question 4
Write a grep command that will print the lines in awards.psv that contain awards won by a person with first name, last name, and middle initial starting with the same letter.
Your example to each question will be a single grep command.
You can test the command by running it.
For example, if you think the answer to question 1 is grep -E ‘Andrew’ awards.psv , you can test it:
$ grep -E ‘Andrew’ awards.psv
ACM Turing Award|2000|Andrew Chi-Chih Yao|Male|China|1946
Nobel Prize for medicine|1963|Andrew F. Huxley|Male|United Kingdom|1917 Nobel Prize for medicine|2006|Andrew Z. Fire|Male|United States|1959
Nobel Prize for medicine|1977|Andrew V. Schally|Male|United States|1926
ACM Turing Award|2017|David Andrew Patterson|Male|United States|1947
g | | | | |
Then add it to final_q1.txt .
Autotest will extract your answers from final_q1.txt and do a simple test.
When you think your program is working, you can run some simple automated tests:
$ 2041 autotest final_q1
When you are finished working on this activity, you must submit your work by running give:
$ give cs2041 final_q1 final_q1.txt
To verify your submissions for this activity:
$ 2041 classrun -check final_q1
We have student enrolment data in this familiar format:
$ cat enrollments.txt
COMP1511|3360379|Costner, Kevin Augustus |3978/1|M
COMP1511|3364562|Carey, Mary |3711/1|M
COMP3311|3383025|Thorpe, Ian Augustus |3978/3|M
COMP4920|3860448|Steenburgen, Mary Nell |3978/3|F
COMP1521|3360582|Neeson, Liam |3711/2|M
COMP3141|3383025|Thorpe, Ian Augustus |3978/3|M
COMP3331|3383025|Thorpe, Ian Augustus |3978/3|M
COMP2041|3860448|Steenburgen, Mary Nell |3978/3|F
COMP2041|3360582|Neeson, Liam |3711/2|M
COMP3311|3711611|Klum, Mary |3978/3|F
COMP3311|3371161|Thorpe, Ian Fredrick |3711/3|M
COMP3331|5122456|Wang, Wei |3978/2|M
COMP3331|5456732|Wang, Wei |3648/3|M
COMP4920|5456732|Wang, Wei |3648/3|M
You should find a copy of the above data in the provided file enrollments.txt.
In final_q2.sh, write a shell pipeline that, given student enrollment data in the above format, will output the surnames (family names) of male students.
Each surname should be printed only once
For example, given the above data, your pipeline should output this:
$ ./final_q2.sh < enrollments.txt
Carey
Costner Neeson
Thorpe
Wang
Using the additional data file provided, your pipeline should output this:
$ ./final_q2.sh < more_enrollments.txt
Bai
Bian
Cai
Cui
Guo
Islam
Kumar
Li
Long
Lu
Luong
Luu
Murray
Ngo
Saha
Tran
Trinh
Wu
Xia
Xiao
Yao Ye
Yip
Yong
Zeng
When you think your program is working, you can run some simple automated tests:
$ 2041 autotest final_q2
When you are finished working on this activity, you must submit your work by running give:
$ give cs2041 final_q2 final_q2.sh
To verify your submissions for this activity:
$ 2041 classrun -check final_q2
Write a Python program final_q3.py that performs the same task as the Shell pipeline in the previous question.
In other words: given data in the same format as the last question on standard input, output the surnames (family names) of male students.
Each surname should be printed only once
The surnames should be printed in alphabetical order.
For example:
$ ./final_q3.py < enrollments.txt
Carey
Costner Neeson
Thorpe
Wang
When you think your program is working, you can run some simple automated tests:
$ 2041 autotest final_q3
When you are finished working on this activity, you must submit your work by running give:
$ give cs2041 final_q3 final_q3.py
To verify your submissions for this activity:
$ 2041 classrun -check final_q3
Write a POSIX-compatible shell script ./final_q4.sh that takes a single command-line argument, a filename.
The file will contain an unordered list of positive integers, one per line, from n to m, with possibly one integer missing.
Your shell script should print the missing integer, if there is a missing integer.
If there is no missing integer your script should print nothing.
No integer will occur twice.
At most one integer will be missing.
The missing integer will not be n or m.
For example, ./final_q4.sh should output this:
$ cat numbers_1.txt
39
45
40
44
41
43
$ ./final_q4.sh numbers_1.txt
42
$ cat numbers_2.txt
6
8
9
1
7
2
3
10
11
12
5
$ ./final_q4.sh numbers_2.txt 4
$ ./final_q4.sh numbers_3.txt 1005
$ ./final_q4.sh numbers_4.txt
$
When you think your program is working, you can run some simple automated tests:
$ 2041 autotest final_q4
When you are finished working on this activity, you must submit your work by running give:
$ give cs2041 final_q4 final_q4.sh
To verify your submissions for this activity:
$ 2041 classrun -check final_q4
In question1 you were given the file awards.psv
containing information about Nobel Prizes, Turing Awards and Fields Medal winners
This time we are interested in the years particular awards were not given, between when it was first offered and when it was last offered.
Write a POSIX-compatible Shell script final_q5.sh that prints all years that an award was not given in.
final_q5.sh will be given two command-line arguments, a regular expression and a file name, final_q5.sh should print in sorted order the years that no award whose entirename matches the regex given.
The entire name must match the regex not just a substring.
For example if the regex is Nobel Prize , then awards for Nobel Prize for physics should not match. But if the regex is Nobel Prize.* , then awards for Nobel Prize for physics should match.
You should not hard code the name of this file in your script, the name of the data file will be given as the second command-line argument.
If there are no awards that match the regex, then final_q5.sh should print an message to stdout as below.
$ ./final_q5.sh ‘Nobel Prize for physics’ awards.psv
1916
1931
1934
1940
1941
1942
More example output:
$ ./final_q5.sh ‘Nobel Prize for (chemistry|physics)’ awards.psv
1916
1940
1941
1942
$ ./final_q5.sh ‘Nobel Prize for.*’ awards.psv
1940
1941
1942
$ ./final_q5.sh ‘COMP2041 Distinguished Achievers’ awards.psv
No award matching ‘COMP2041 Distinguished Achievers’
When you think your program is working, you can run some simple automated tests:
$ 2041 autotest final_q5
When you are finished working on this activity, you must submit your work by running give:
$ give cs2041 final_q5 final_q5.sh
To verify your submissions for this activity:
$ 2041 classrun -check final_q5
Two files are mirrored if they contain the same lines but in the reverse order to each other. Write a Python program final_q6.py that given two filenames checks if the two files are mirrored. final_q6.py should always produce one line of output.
If the two files are mirrored final_q6.py should print a message indicating this.
If the two files are not mirrored final_q6.py should print a message indicating why not.
Match the example output below exactly:
If the two files contain a different number of lines, final_q6.py should print a single line indicating this, including the number of lines in each file.
This message should be printed in exactly the format below.
$ echo hello >file1
$ echo Andrew >>file1
$ echo Dylan >file2
$ cat file1 hello
Andrew
$ cat file2
Dylan
$ ./final_q6.py file1 file2
Not mirrored: different number of lines: 2 versus 1 $ ./final_q6.py file2 file1
Not mirrored: different number of lines: 1 versus 2
If the files contain the same number of lines but a line in the first file is not the same as the corresponding line in the second file in reverse order, final_q6.py should print a single line indicating this.
The message should indicate the line number in the first file (only).
The message should be printed in exactly the format below.
$ echo hello >>file2
$ cat file1 hello
Andrew
$ cat file2 Dylan hello
$ ./final_q6.py file1 file2
Not mirrored: line 2 different $ ./final_q6.py file2 file1
Not mirrored: line 1 different
Note, message should only be for the first line which is different. The example below shows files where multiple lines are different.
$ sed -i s/hello/hi/ file1
$ cat file1 hi Andrew
$ cat file2 Dylan hello
$ ./final_q6.py file1 file2
Not mirrored: line 1 different $ ./final_q6.py file2 file1
Not mirrored: line 1 different
The example below shows mirrored files.
$ echo hello >file3
$ echo Dylan >>file3
$ cat file3 hello Dylan
$ cat file2 Dylan hello
$ ./final_q6.py file2 file3
Mirrored
$ seq 1 5 >a
$ seq 5 -1 1 >b
$ cat a
1
2
3
4
5
$ cat b
5
4
3
2
1
$ ./final_q6.py a b
Mirrored
When you think your program is working, you can run some simple automated tests:
$ 2041 autotest final_q6
When you are finished working on this activity, you must submit your work by running give:
$ give cs2041 final_q6 final_q6.py
To verify your submissions for this activity:
$ 2041 classrun -check final_q6
We have many executable scripts which we want to rename with an extension if possible.
Reminder, a filename extension is a suffix on the end of a filename that indicates the file contents. For example, an extension of .sh can be used to indicate a file contains a shell script.
Write a POSIX-compatible Shell script final_q7.sh which given one or more filenames as command-line arguments, prints shell commands to add extensions to the filenames.
We need to check the commands before executing them, so final_q7.sh should print the commands, not execute them.
For each filename, final_q7.sh should print one line of output to stdout , matching the example output below exactly.
If the filename already has an extension (contains a ‘.’), print a line indicating this.
If the file does not start with #!, print a line indicating this.
If the #! line does not contain any of the strings, perl, python or sh, print a line indicating this.
If a file already exists with the new filename created by adding the appropriate extension, print a line indicating this.
Otherwise, final_q7.sh should print a line containing a command to rename the file.
The line printed for each filename should match the example output below exactly. For example:
$ touch script.rs
$ ./final_q7.sh script.rs
# script.rs already has an extension
$ ./final_q7.sh script1
# script1 does not have a #! line
$ ./final_q7.sh script2
# script2 no extension for #! line
$ final_q7.sh script3 mv script3 script3.py $ ./final_q7.sh script*
# script1 does not have a #! line # script2 no extension for #! line mv script3 script3.py mv script4 script4.pl mv script5 script5.sh $ touch script4.pl
$ ./final_q7.sh script4
# script4.pl already exists
When you think your program is working, you can run some simple automated tests:
$ 2041 autotest final_q7
When you are finished working on this activity, you must submit your work by running give:
$ give cs2041 final_q7 final_q7.sh
To verify your submissions for this activity:
$ 2041 classrun -check final_q7
We wish to save disk space by replacing identical copies of files with symbolic links.
Write a POSIX-compatible shell script final_q8.sh , which takes 0 or more names of files as arguments, and prints commands to replace some of the files with symbolic links.
We need to check the commands before executing them, so final_q8.sh should print the commands, not execute them.
For each file specified as an argument, if the file has identical contents (bytes) to any previous file specified as an argument, final_q8.sh should print a ln command which would replace the file with a symbolic link to the previous file. final_q8.sh should just print the ln command, it should not execute the ln command.
If none of the files can be replaced by symbolic links, final_q8.sh should print a message exactly as shown in the last example below.
Your script must work when executed with /bin/dash on a CSE system, and must only use the external programs listed below.
Make your program produce exactly the output indicated by the example below
Make your program produce exactly the output indicated by the example below. For example, here is how your program should behave:
$ ./final_q8.sh file0.txt file1.txt file2.txt file3.txt file4.txt file5.txt file6.txt file7.txt file8.txt ln -s file0.txt file3.txt ln -s file1.txt file6.txt ln -s file2.txt file5.txt ln -s file2.txt file7.txt
$ ./final_q8.sh file6.txt file4.txt file1.txt file2.txt file3.txt file5.txt file7.txt file8.txt file0.txt ln -s file6.txt file1.txt ln -s file2.txt file5.txt ln -s file2.txt file7.txt ln -s file3.txt file0.txt
$ ./final_q8.sh file8.txt file7.txt file6.txt file5.txt file4.txt file3.txt file2.txt file1.txt file0.txt ln -s file7.txt file5.txt ln -s file7.txt file2.txt ln -s file6.txt file1.txt ln -s file3.txt file0.txt
$ ./final_q8.sh file1.txt file2.txt file3.txt file4.txt file5.txt file6.txt ln -s file1.txt file6.txt ln -s file2.txt file5.txt
$ ./final_q8.sh file0.txt file1.txt file2.txt file3.txt file4.txt ln -s file0.txt file3.txt $ ./final_q8.sh file3.txt file0.txt ln -s file3.txt file0.txt
$ ./final_q8.sh file3.txt file0.txt file3.txt file0.txt file3.txt file0.txt file3.txt file0.txt ln -s file3.txt file0.txt
$ ./final_q8.sh file1.txt file2.txt file3.txt file4.txt
No files can be replaced by symbolic links
$
When you think your program is working, you can run some simple automated tests:
$ 2041 autotest final_q8
When you are finished working on this activity, you must submit your work by running give:
$ give cs2041 final_q8 final_q8.sh
To verify your submissions for this activity:
$ 2041 classrun -check final_q8
Write a Python program, final_q9.py , which takes two command line argument, a positive integer n and the name of a file. the single positive integer, n, indicating a maximum desired line length.
Your program should change the file in the following way:
Lines containing n characters or less, not including the new line, should not be changed.
Lines not containing a space character (‘ ‘) should not be changed.
Lines containing more than n characters with a space in the first n characters, should have the last space in the first n characters changed to a newline character (‘ ‘).
Lines containing more than n characters without a space in the first n characters, should have the first space on the line changed to a newline character (‘ ‘).
The above rules should also be applied to new lines as they are created.
Your program should not print anything to stdout. The only thing it should do is change the file.
For example:
$ echo hello there how are you today >hello.txt
$ ./final_q9.py 80 hello.txt
$ cat hello.txt hello there how are you today
$ ./final_q9.py 23 hello.txt
$ cat hello.txt hello there how are you today
$ ./final_q9.py 12 hello.txt
$ cat hello.txt hello there how are you today
$ ./final_q9.py 6 hello.txt
$ cat hello.txt hello there how are you today
$ cp frost.txt f.txt
$ cat f.txt
I shall be telling this with a sigh Somewhere ages and ages hence:
Two roads diverged in a wood, and I —
I took the one less traveled by,
And that has made all the difference.
$ ./final_q9.py 20 f.txt
$ cat f.txt I shall be telling this with a sigh Somewhere ages and ages hence: Two roads diverged in a wood, and I — I took the one less traveled by, And that has made all the difference. $ ./final_q9.py 10 f.txt
$ cat f.txt I shall be telling this with a sigh Somewhere ages and ages hence: Two roads diverged in a wood, and I — I took the one less traveled by, And that has made all the difference.
Note final_q9.py printed nothing – it changed the file it was given as argument.
Make sure your program does this.
Your program can assume it is given one argument which is the name of a file.
Your program can assume the file exists.
When you think your program is working, you can run some simple automated tests:
$ 2041 autotest final_q9
When you are finished working on this activity, you must submit your work by running give:
$ give cs2041 final_q9 final_q9.py
To verify your submissions for this activity:
$ 2041 classrun -check final_q9
Write a Python program, final_q10.py , that reads lines of text from its standard input and prints them to its standard output with the words which are not balanced removed.
A word is balanced if every character in the word occurs exactly n times (for some value of n). Case should be ignored when considering whether a word is balanced.
For example: Gaga is balanced because ‘g’ occurs twice and ‘a’ occurs twice.
For example: gauge is not balanced because ‘g’ occurs twice but ‘u’, ‘a’, and ‘e’ occur once.
Assume that a word is any sequence of non-whitespace characters. For example, tock-tock is considered a single word.
You should print the words separated by a single space character.
Match the example output below exactly. For example:
$ cat frost.txt
I shall be telling this with a sigh Somewhere ages and ages hence:
Two roads diverged in a wood, and I —
I took the one less traveled by,
And that has made all the difference.
$ ./final_q10.py < frost.txt I be this with a sigh ages and ages
Two roads in a and I —
I the one by,
And has made the
$ cat interesting_words.txt
1 duck bulbul Gaga tocktocktock wwwwweeeee
2 goose baboon bonobo Guage tock-tock wwwwweee
3 xerophytic Deeded sestettes zZz teammate horseshoer happenchance
4 elephant decorator agaga teammates horseshoe
$ ./final_q10.py < interesting_words.txt 1 duck bulbul Gaga tocktocktock wwwwweeeee
2
3 xerophytic Deeded sestettes zZz teammate horseshoer happenchance 4
$ ./final_q10.py < story.txt | head
THE LEAP-FROG
A Flea, a and a Leap-frog once wanted to could jump and they the whole world, and who chose to come to the festival. famous jumpers they, as would say, when they met in the
“I give my daughter to him who jumps the King; “for it is not so amusing
$ ./final_q10.py < story.txt | tail
The Flea then went into foreign it is said, he was
When you think your program is working, you can run some simple automated tests:
$ 2041 autotest final_q10
When you are finished working on this activity, you must submit your work by running give:
$ give cs2041 final_q10 final_q10.py
To verify your submissions for this activity:
$ 2041 classrun -check final_q10
We need a program to check if the same files are present in two directory trees.
Write a POSIX-compatible Shell script, final_q11.sh , which is given either 2 arguments which are the pathnames of directories.
final_q11.sh should print a single line of output containing 4 integers:
number of files that are present at the same position in both directory trees and are the same size. number of files that are present at the same position in both directory trees but are different sizes. number of files that are present only in the first directory tree.
number of files that are present only in the second directory tree.
Note, a file needs to be present in both directory trees at the same relative pathname to be counted.
For example, if we are comparing the directory trees dir1 and dir2. and the file dir1/2041/lab09/answer.py exists in the first directory tree,
We consider it present in the second directory tree only if the file dir2/2041/lab09/answer.py exists.
Other files named answer.py elsewhere in the second directory tree, e.g. dir2/2521/lab05/answer.py are not counted.
When a file is present at the same relative pathname in both directory trees final_q11.sh does not have to check if it contains the same contents (bytes), just whether both files are the same size (same number of bytes).
For example: these commands create 2 directory trees named d1 and d2 containing 3 files of the same name.
$ mkdir -p d1/b/c
$ echo hello andrew > d1/file1
$ echo bye andrew > d1/b/file2
$ echo 1 > d1/b/c/one
$ mkdir -p d2/b/c
$ echo HELLO andrew > d2/file1
$ echo Bye Andrew > d2/b/file2
$ echo 2 > d2/b/c/one
The contents of the 3 files are different but their sizes are the same. final_q11.sh reports 3 files present in both tree of the same size:
$ ./final_q11.sh d1 d2
3 0 0 0
If we change the size of file1 in the first directory tree final_q11.sh reports 2 files present in both trees of the same size. and 1 file present in both trees but of a different size:
$ echo hello everyone >d1/file1
$ ./final_q11.sh d1 d2
2 1 0 0
If we add a file to the second directory tree:
$ echo 3 > d2/b/c/three
$ ./final_q11.sh d1 d2
2 1 0 1
If we add a different file to the first directory tree:
$ echo 3 > d1/b/three
$ ./final_q11.sh d1 d2 2 1 1 1
Note, the first directory tree contains a file named b/three and the second tree contains a file named b/c/three.
This is not considered as the file being present in both directory trees, as the relative pathname of each file is different.
When you think your program is working, you can run some simple automated tests:
$ 2041 autotest final_q11
When you are finished working on this activity, you must submit your work by running give:
$ give cs2041 final_q11 final_q11.sh
To verify your submissions for this activity:
$ 2041 classrun -check final_q11
Write a POSIX-compatible Shell script final_q12.sh which given a square on the chessboard. prints in successives lines the squares that can be reached by a knight.
A chessboard is an 8×8 square matrix. We label each square as below:
a8 b8 c8 d8 e8 f8 g8 h8 a7 b7 c7 d7 e7 f7 g7 h7 a6 b6 c6 d6 e6 f6 g6 h6 a5 b5 c5 d5 e5 f5 g5 h5 a4 b4 c4 d4 e4 f4 g4 h4 a3 b3 c3 d3 e3 f3 g3 h3 a2 b2 c2 d2 e2 f2 g2 h2 a1 b1 c1 d1 e1 f1 g1 h1
A knight makes an L-shaped move. It moves either two squares horizontally and one square vertically or two squares vertically and one square horizontally.
For example, a knight at d4 can move to one of eight squares: c2, e2, b3, b5, c6, e6, f3 or f5.
A move can not take a knight off the chessboard. Hence, a knight on square near the edge of the board will have fewer possible moves.
For example, a knight at a1 can move only to c2 and b3.
Your program should take one argument: a starting square.
It should print a sequence of lines.
The first line should contain only the starting square
The second line should contain squares a knight can move to from the starting square.
The third line should contain new squares a knight can move to from squares listed on the second line.
The fourth line should contain new squares a knight can move to from squares listed on the third line.
You program should stop when no new squares can be reached.
The squares on each line should be printed in sorted order, separated by a single space.
Match the output format below EXACTLY.
For example:
$ ./final_q12.sh a1 a1 b3 c2 a3 a5 b4 c1 c5 d2 d4 e1 e3 a2 a4 a6 b1 b5 b7 c4 c6 d1 d3 d5 d7 e2 e4 e6 f1 f3 f5 g2 g4 a7 b2 b6 b8 c3 c7 d6 d8 e5 e7 f2 f4 f6 f8 g1 g3 g5 g7 h2 h4 h6 a8 c8 e8 f7 g6 g8 h1 h3 h5 h7 h8
$ ./final_q12.sh d4 d4 b3 b5 c2 c6 e2 e6 f3 f5 a1 a3 a5 a7 b4 b8 c1 c3 c5 c7 d2 d6 d8 e1 e3 e5 e7 f4 f8 g1 g3 g5 g7 h2 h4 h6 a2 a4 a6 a8 b1 b7 c4 c8 d1 d3 d5 d7 e4 e8 f1 f7 g2 g4 g6 g8 h1 h3 h5 h7 b2 b6 f2 f6 h8 $ ./final_q12.sh g2 g2 e1 e3 f4 h4 c2 c4 d1 d3 d5 e2 e6 f1 f3 f5 g4 g6 h3 h5 a1 a3 a5 b2 b4 b6 c1 c3 c5 c7 d2 d4 d6 d8 e5 e7 f2 f6 f8 g1 g3 g5 g7 h2 h6 h8 a2 a4 a6 a8 b1 b3 b5 b7 c6 c8 d7 e4 e8 f7 g8 h1 h7 a7 b8
When you think your program is working, you can run some simple automated tests:
$ 2041 autotest final_q12
When you are finished working on this activity, you must submit your work by running give:
$ give cs2041 final_q12 final_q12.sh
To verify your submissions for this activity:
$ 2041 classrun -check final_q12
When you are finished working on a question, submit your work by running give.
You can run give multiple times. Only your last submission will be marked.
Don’t submit any questions you haven’t attempted.
You can check if you have made a submission with 2041 classrun -check final_q<N>:
$ 2041 classrun -check final_q1
$ 2041 classrun -check final_q2 …
$ 2041 classrun -check final_q12
Do your own testing, as well as running autotest.
— END OF EXAMINATION. —
For all enquiries, please email the class account at cs2041@cse.unsw.edu.au
CRICOS Provider 00098G
Reviews
There are no reviews yet.