Home
Explore
Exams
Search for anything
Login
Get started
Home
Engineering
Computer Science
3.2 Subroutines
0.0
(0)
Rate it
Studied by 0 people
Learn
Practice Test
Spaced Repetition
Match
Flashcards
Card Sorting
1/5
Earn XP
Description and Tags
Computer Science
Add tags
Study Analytics
All
Learn
Practice Test
Matching
Spaced Repetition
Name
Mastery
Learn
Test
Matching
Spaced
No study sessions yet.
6 Terms
View all (6)
Star these 6
1
New cards
Define a subroutine
A set of instructions which execute a commonly used task.
2
New cards
What is the difference between a procedure and a function?
A function returns a value but a procedure does not
3
New cards
How do you write a subroutine in pseudo-code?(add a and b)
SUBROUTINE add(a, b)
result ← a + b
OUTPUT result
ENDSUBROUTINE
#this is a procedure
4
New cards
Write a subroutine with a return value in python. (area)
def area(l, w):
area = l * w
return area
print(area(5, 6)
#prints out 30
5
New cards
How do you call subroutine without a return value? (PC, PY)
add(3, 4) #it is the same for both
6
New cards
How do you call a subroutine with a return value?
answer ← area(l, w)
answer = area(l, w)