1. Homepage
  2. Programming
  3. [2022] COMP(2041|9044) 22T2 Software Construction — Week 05 Weekly Test Questions

[2022] COMP(2041|9044) 22T2 Software Construction — Week 05 Weekly Test Questions

Engage in a Conversation
COMP2041COMP9044Softeware ConstructionWeekly Test QuestionsUNSW

Week 05 Weekly Test Questions CourseNana.COM

Test Conditions CourseNana.COM

·      These questions must be completed under self-administered exam-like conditions. CourseNana.COM

·      You must time the test yourself and ensure youcomply with the conditions below. CourseNana.COM

·      You may complete this test in CSE labs or elsewhere using your own machine. CourseNana.COM

·      You may complete this test at any time before CourseNana.COM

·      Week 7 Thursday 18:00:00 CourseNana.COM

·      Weekly tests are designed to act like a past paper - to give you an idea of how well you are progressing in the course, and whatyou need to work on. Many of the questions in weekly tests are from past final exams. CourseNana.COM

·      Once the first hour has finished, you must submit all questions you've worked on. CourseNana.COM

·      You should then take note of how far you got, which parts you didn't understand. CourseNana.COM

·      You may choose then to keep working and submit test question anytime up to Week 7 Thursday 18:00:00 CourseNana.COM

·      However the maximum mark for any question you submit after the first hour will be 50% CourseNana.COM

  CourseNana.COM

Getting Started CourseNana.COM

Set up for the test bcreating a new directory called test05 and changing to this directory. CourseNana.COM

1   $ mkdir test05 CourseNana.COM

2   $ cd test05 CourseNana.COM

There are some provided files for this test which you can fetch with this command: CourseNana.COM

3   $ 2041 fetch test05 CourseNana.COM

If you're not working at CSE, you can download the provided files as a zip fileor a tar file CourseNana.COM

  CourseNana.COM

  CourseNana.COM

WEEKLY TEST QUESTION: CourseNana.COM

Hello Files CourseNana.COM

  CourseNana.COM

Write a POSIX-compatible shell script, hello_files.sh which takes 2 arguments. CourseNana.COM

The first argument will be positive integer,n. CourseNana.COM

The second argument will be a string,name. CourseNana.COM

Your program should create n files. CourseNana.COM

The names of these files should be hello1.txt ..hello n.txt. CourseNana.COM

Each file should have the same contents, a single line: hello name CourseNana.COM

For example: CourseNana.COM

1   $ ls hello*.txt CourseNana.COM

2   ls: cannot access 'hello*.txt': No such file or directory CourseNana.COM

3   $ ./hello_files.sh 3 Andrew CourseNana.COM

4   $ ls hello*.txt CourseNana.COM

5   hello1.txt hello2.txt hello3.txt CourseNana.COM

6   $ wc hello*.txt CourseNana.COM

7   1 2 13 hello1.txt CourseNana.COM

8   1 2 13 hello2.txt CourseNana.COM

9   1 2 13 hello3.txt CourseNana.COM

10 3 6 39 total CourseNana.COM

11 $ cat hello1.txt CourseNana.COM

12 hello Andrew CourseNana.COM

13 $ cat hello2.txt CourseNana.COM

14 hello Andrew CourseNana.COM

15 $ cat hello3.txt CourseNana.COM

16 hello Andrew CourseNana.COM

17 $ ./hello_files.sh 100 Brittany CourseNana.COM

18 $ ls hello*.txt|wc -l CourseNana.COM

19 100 CourseNana.COM

20 $ cat hello100.txt CourseNana.COM

21 hello Brittany CourseNana.COM

22 $ cat hello42.txt CourseNana.COM

23 hello Brittany CourseNana.COM

24 $ cat hello1.txt CourseNana.COM

25 hello Brittany CourseNana.COM

You can assume the files do not exist already. CourseNana.COM

  CourseNana.COM

  CourseNana.COM

WEEKLY TEST QUESTION: CourseNana.COM

Print the file with most lines CourseNana.COM

  CourseNana.COM

We what to know which of a set of files has the most lines. CourseNana.COM

Write a POSIX-compatible shell script most_lines.shwhich given one of more filenames as argument, prints which file has themost lines. CourseNana.COM

For example CourseNana.COM

1   $ seq 1 5 >five_lines.txt CourseNana.COM

2   $ cat five_lines.txt CourseNana.COM

3   1 CourseNana.COM

4   2 CourseNana.COM

5   3 CourseNana.COM

6   4 CourseNana.COM

7   5 CourseNana.COM

8   $ seq 1 10 >ten_lines.txt CourseNana.COM

9   $ seq 1 100 >hundred_lines.txt CourseNana.COM

10 $ ./most_lines.sh ten_lines.txt hundred_lines.txt five_lines.txt CourseNana.COM

11 hundred_lines.txt CourseNana.COM

  CourseNana.COM

  CourseNana.COM

WEEKLY TEST QUESTION: CourseNana.COM

  CourseNana.COM

List Identical Files in Shell CourseNana.COM

Write a POSIX-compatible shell script,ls_identical.sh CourseNana.COM

which takes the pathnames of 2 directories as argument. CourseNana.COM

It should print in alphabetical order the names of all files which occur in both directories, CourseNana.COM

and have exactly the same contents in bothdirectories. CourseNana.COM

Files must have the same name in both directories and the same contents for their name to be printed. CourseNana.COM

Do not print the names of files with same contents but different names in both directories. CourseNana.COM

For example: CourseNana.COM

1   $unzip directory.zip CourseNana.COM

2   Archive: directory.zip CourseNana.COM

3   creating: directory1/ CourseNana.COM

4   creating: directory2/ CourseNana.COM

5   $ls_identical.sh directory1 directory2 CourseNana.COM

6   empty.txt CourseNana.COM

7   same.txt CourseNana.COM

Get in Touch with Our Experts

WeChat WeChat
Whatsapp WhatsApp
COMP2041代写,COMP9044代写,Softeware Construction代写,Weekly Test Questions代写,UNSW代写,COMP2041代编,COMP9044代编,Softeware Construction代编,Weekly Test Questions代编,UNSW代编,COMP2041代考,COMP9044代考,Softeware Construction代考,Weekly Test Questions代考,UNSW代考,COMP2041help,COMP9044help,Softeware Constructionhelp,Weekly Test Questionshelp,UNSWhelp,COMP2041作业代写,COMP9044作业代写,Softeware Construction作业代写,Weekly Test Questions作业代写,UNSW作业代写,COMP2041编程代写,COMP9044编程代写,Softeware Construction编程代写,Weekly Test Questions编程代写,UNSW编程代写,COMP2041programming help,COMP9044programming help,Softeware Constructionprogramming help,Weekly Test Questionsprogramming help,UNSWprogramming help,COMP2041assignment help,COMP9044assignment help,Softeware Constructionassignment help,Weekly Test Questionsassignment help,UNSWassignment help,COMP2041solution,COMP9044solution,Softeware Constructionsolution,Weekly Test Questionssolution,UNSWsolution,