Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
This Crediting code from other sources in comments worksheet is part of the VCE Applied Computing U1O2 Programming: Legal requirements and emerging trends journey. Print it as a booklet?
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1# Source: https://example.com/sort-tutorial | A# Source: Real Python, author: A. Lee, licence: CC BY 4.0 def bubble_sort(items): | |
| 2# Author: J. Chen | Licence: MIT | BThe credit comment is placed below the reused code instead of above it, so it is easy to miss which lines it refers to. | |
| 3Credit reused code by placing a comment above it naming the source, author and licence | CA comment that records the URL where the reused code was found, so the original source can be traced. | |
| 4Mark which lines are not your own so your work is clearly separated from borrowed code | D# --- Start of code reused from library docs --- # --- End of reused code --- | |
| 5# Found this online total = sum(prices) | EThe comment does not name the source, the author or the licence, so the original work is not properly credited. | |
| 6def area(r): return 3.14 * r * r # Source: https://example.com/area (Ms Wu, CC0) | FA comment that names the person who wrote the reused code and the licence that allows you to use it. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
# Source: — A comment placed above code you reused that names the source (such as a URL), the author and the licence, so the original work is credited and your own lines are clear.# Source: https://example.com/sort# Source: https://example.com/sort# Source: https://example.com/sort
# Author: Sam Lee
# Licence: MIT# Reused code: start
total = sum(nums)
# Reused code: end# Source: https://example.com/sort
# Author: Sam Lee
# Licence: MIT