Software licences and open-source code

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Software licences and open-source code

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. What does a software licence state?
A How fast the code will run on your computer
B How you may use, change and share the code
2. Open-source code can be reused if you follow the licence terms.
A False
B True
3. Which is a typical condition of an open-source licence?
A Give credit (attribution) to the original author
B Pay the author a fee every time you run the code
4. A student finds open-source code online. What should they do first?
A Read the licence to see what is allowed
B Assume they can do anything with it
5. Which describes a proprietary licence?
A The owner keeps tight control over how the software is used and shared
B Anyone may freely change and share the code with no limits

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1# License: MIT - keep copyright notice AOpen-source code still has a licence. Many licences require attribution, so you must credit the author.
2All rights reserved. No copying. BAn open-source licence that lets you reuse and change the code if you keep the author's copyright notice
3A licence condition such as attribution means you must credit the original author when you reuse their code C# Code by A. Lee, used under MIT licence
4Open-source code can be reused only if you follow the terms in its licence file DA proprietary licence that does not let you copy, change or share the code without permission
5# Open source, so no credit needed ERead LICENSE.txt before reusing code
6# Copied from a paid app, it is free to share FCode under a proprietary licence cannot be shared without the owner's permission, so this breaks the licence.

Definitions

software licence

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
# Licence type: ___________ - no copying
2.
# Licence type: ___________ - reuse allowed
3.
# Condition: ___________ - credit the author
4.
# You may use, change and _____ this code
5.
licence = "open-source" __ licence == "open-source": print("Credit the author")

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A licence = 'MIT
B must_credit = True
C if must_credit:
D print('Give credit')
Question 2
A licence = 'GPL'
B open_source = False
C if open_source:
D print('Check the terms')
Question 3
A licence = 'proprietary'
B can_copy = False
C if not can_copy
D print('Ask the owner')
Question 4
A author = 'Sam Lee'
B credit = 'Code by ' - author
C print(credit)
Question 5
A licence = 'CC BY'
B needs_credit = True
C if needs_credit:
D print('Add attribution'

Answer Key

Software licences and open-source code
Section A: Quick Questions
Q1
B — How you may use, change and share the code
Q2
B — True
Q3
A — Give credit (attribution) to the original author
Q4
A — Read the licence to see what is allowed
Q5
A — The owner keeps tight control over how the software is used and shared
Section B: Match the Pairs
Q1
# License: MIT - keep copyright notice → An open-source licence that lets you reuse and change the code if you keep the author's copyright notice
Q2
All rights reserved. No copying. → A proprietary licence that does not let you copy, change or share the code without permission
Q3
A licence condition such as attribution means you must credit the original author when you reuse their code → # Code by A. Lee, used under MIT licence
Q4
Open-source code can be reused only if you follow the terms in its licence file → Read LICENSE.txt before reusing code
Q5
# Open source, so no credit needed → Open-source code still has a licence. Many licences require attribution, so you must credit the author.
Q6
# Copied from a paid app, it is free to share → Code under a proprietary licence cannot be shared without the owner's permission, so this breaks the licence.
Section C: Definitions
Q1
software licence — A legal agreement stating how you may use, change and share code. Open-source licences allow reuse if you follow their terms, such as giving credit to the author.
Section D: Fill in the Blanks
Q1
# Licence type: proprietary - no copying
Q2
# Licence type: open-source - reuse allowed
Q3
# Condition: attribution - credit the author
Q4
# You may use, change and share this code
Q5
licence = "open-source" if licence == "open-source": print("Credit the author")
Section E: Spot the Error
Q1
A — The string is missing its closing quote, which causes a syntax error. It should be licence = 'MIT'.
Q2
B — The GPL is an open-source licence, so open_source should be True. Setting it to False gives the wrong result.
Q3
C — An if statement needs a colon at the end of the line. It should be if not can_copy:
Q4
B — Strings are joined with +, not -. Subtracting a string causes an error. It should be + author.
Q5
D — The print call is missing its closing bracket. It should be print('Add attribution').