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

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

Engage in a Conversation
COMP2041COMP9044Softeware ConstructionWeekly Test QuestionsUNSW澳洲PythonExam

Week 09 Weekly Test Questions CourseNana.COM

Test Conditions CourseNana.COM

These questions must be completed under self-administered exam-like conditions. You must time the test yourself and ensure you comply 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 Week 10 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 what you 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 10 Thursday 18:00:00
However the maximum mark for any question you submit after the first hour will be 50%
CourseNana.COM

You may access this language documentation while attempting this test: CourseNana.COM

·       manual entries, via the man command. CourseNana.COM

·       Texinfo pages, via the info command. CourseNana.COM

·       Bash documentation via the help command. CourseNana.COM

·       Shell/Regex quick reference CourseNana.COM

·       Python documentation via the python3 -c 'help()' command. CourseNana.COM

·       Python quick reference CourseNana.COM

·       full Python 3.9 documentation CourseNana.COM

Any violation of the test conditions will results in a mark of zero for the entire weekly test component. CourseNana.COM

Getting Started CourseNana.COM

Set up for the test by creating a new directory called test09 and changing to this directory. $ mkdir test09 CourseNana.COM

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

$ 2041 fetch test09
If you're not working at CSE, you can download the provided files as a zip file or a tar file. CourseNana.COM

WEEKLY TEST QUESTION: CourseNana.COM

Statistical Analysis of Command Line Arguments CourseNana.COM

Write a Python program describe_numbers.py that numbers as command line arguments prints: CourseNana.COM

·      The count of how many numbers CourseNana.COM

·      The count of how many unique numbers CourseNana.COM

·       The minimum number CourseNana.COM

·      The maximum number CourseNana.COM

·      The mean of the numbers CourseNana.COM

·      The median of the numbers CourseNana.COM

·      The mode of the numbers

CourseNana.COM

·      The sum of the numbers CourseNana.COM

·      The product of the numbers CourseNana.COM

For example: CourseNana.COM

$ ./describe_numbers.py 1 333 42 count=3
unique=3
minimum=1
CourseNana.COM

maximum=333
mean=125.33333333333333
median=42
mode=1
sum=376
product=13986
$ ./describe_numbers.py 3 4 2 -1 7 -6 5 count=7
unique=7
minimum=-6
maximum=7
mean=2
median=3
mode=3
sum=14
product=5040
$ ./describe_numbers.py 15 -15 8 -11 8 CourseNana.COM

When you think your program is working you can autotest to run some simple automated tests: $ 2041 autotest describe_numbers CourseNana.COM

When you are finished working on this exercise you must submit your work by running give: $ give cs2041 test09_describe_numbers describe_numbers.py CourseNana.COM

WEEKLY TEST QUESTION: CourseNana.COM

N Distinct lines CourseNana.COM

Write a Python program distinct_lines.py which given a single argument N as a command-line argument, reads lines from standard input until N different lines have been read. CourseNana.COM

It should then print a message (exactly as below) indicating how many lines were read. It should then stop, and not read any futher input. CourseNana.COM

If end-of-input is reached before n different lines it should print a message indicating how many lines were read. Your program should ignore case and white-space when comparing lines. CourseNana.COM

1      $ ./distinct_lines.py 3 hi CourseNana.COM

2      hello world CourseNana.COM

3      hi CourseNana.COM

4   hello world CourseNana.COM

5   hello world CourseNana.COM

6   bye CourseNana.COM

7   3 distinct lines seen after 6 lines read. CourseNana.COM

8      $ ./distinct_lines.py 3 hi CourseNana.COM

9      hello world CourseNana.COM

10    hi CourseNana.COM

11 hello        world CourseNana.COM

12    HELLO  world CourseNana.COM

13 bye CourseNana.COM

14 3 distinct lines seen after 6 lines read. CourseNana.COM

15   $ ./distinct_lines.py 4 CourseNana.COM

16   how CourseNana.COM

17   are CourseNana.COM

18   you CourseNana.COM

19 are CourseNana.COM

20 how CourseNana.COM

21 are CourseNana.COM

22 well CourseNana.COM

23 4 distinct lines seen after 7 lines read. CourseNana.COM

24   $ ./distinct_lines.py 3 CourseNana.COM

25   how CourseNana.COM

26   are CourseNana.COM

27   you CourseNana.COM

28 3 distinct lines seen after 3 lines read. CourseNana.COM

29   $ ./distinct_lines.py 7 hello CourseNana.COM

30   how CourseNana.COM

31   are CourseNana.COM

32   you CourseNana.COM

33   Ctrl-D CourseNana.COM

34   End of input reached after 4 lines read - 7 different lines not seen. CourseNana.COM

When you think your program is working you can autotest to run some simple automated tests: CourseNana.COM

$ 2041 autotest distinct_lines CourseNana.COM

When you are finished working on this exercise you must submit your work by running give: $ give cs2041 test09_distinct_lines distinct_lines.py CourseNana.COM

WEEKLY TEST QUESTION: CourseNana.COM

Simple Grep in Python CourseNana.COM

Write a Python program, python_grep.py implements the basic functionallity of the grep command. Your program will be given two command line arguments: a regular expression and a file.
Your program should print out all the lines in the file that match the regular expression.
CourseNana.COM

$ seq 1 1000 > seq.txt
$ ./python_grep.py '[^2468]5[2468]' seq.txt
152
154
156
158
352
354
356
358
552
554
556
558
752
754
756
758
952
954
956
958
$ ./python_grep.py '^(..).+\1.+\1$' dictionary.txt alkaloidal
antihumanitarian
astasias
endenizen
essentialnesses
esthesises
estimablenesses
CourseNana.COM

When you think your program is working you can autotest to run some simple automated tests: $ 2041 autotest python_grep CourseNana.COM

When you are finished working on this exercise you must submit your work by running give: $ give cs2041 test09_python_grep python_grep.py CourseNana.COM

Submission CourseNana.COM

When you are finished each exercise make sure you submit your work by running give.
You can run give multiple times. Only your last submission will be marked.
Don't submit any exercises you haven't attempted.
If you are working at home, you may find it more convenient to upload your work via
give's web interface. Remember you have until Week 10 Thursday 18:00:00 to complete this test. CourseNana.COM

Automarking will be run by the lecturer several days after the submission deadline for the test, using test cases that you haven't seen: different to the test cases autotest runs for you. CourseNana.COM

Hint: do your own testing as well as running autotest CourseNana.COM

Test Marks CourseNana.COM

After automarking is run by the lecturer you can view it here the resulting mark will also be available via via give's web interface or by running this command on a CSE machine: CourseNana.COM

$ 2041 classrun -sturec
The test exercises for each week are worth in total 1 marks. CourseNana.COM

The best 6 of your 8 test marks for weeks 3-10 will be summed to give you a mark out of 9. CourseNana.COM

Get in Touch with Our Experts

WeChat WeChat
Whatsapp WhatsApp
COMP2041代写,COMP9044代写,Softeware Construction代写,Weekly Test Questions代写,UNSW代写,澳洲代写,Python代写,Exam代写,COMP2041代编,COMP9044代编,Softeware Construction代编,Weekly Test Questions代编,UNSW代编,澳洲代编,Python代编,Exam代编,COMP2041代考,COMP9044代考,Softeware Construction代考,Weekly Test Questions代考,UNSW代考,澳洲代考,Python代考,Exam代考,COMP2041help,COMP9044help,Softeware Constructionhelp,Weekly Test Questionshelp,UNSWhelp,澳洲help,Pythonhelp,Examhelp,COMP2041作业代写,COMP9044作业代写,Softeware Construction作业代写,Weekly Test Questions作业代写,UNSW作业代写,澳洲作业代写,Python作业代写,Exam作业代写,COMP2041编程代写,COMP9044编程代写,Softeware Construction编程代写,Weekly Test Questions编程代写,UNSW编程代写,澳洲编程代写,Python编程代写,Exam编程代写,COMP2041programming help,COMP9044programming help,Softeware Constructionprogramming help,Weekly Test Questionsprogramming help,UNSWprogramming help,澳洲programming help,Pythonprogramming help,Examprogramming help,COMP2041assignment help,COMP9044assignment help,Softeware Constructionassignment help,Weekly Test Questionsassignment help,UNSWassignment help,澳洲assignment help,Pythonassignment help,Examassignment help,COMP2041solution,COMP9044solution,Softeware Constructionsolution,Weekly Test Questionssolution,UNSWsolution,澳洲solution,Pythonsolution,Examsolution,