Home
Explore
Exams
Login
Get started
Home
Engineering
Computer Science
3.2 Subroutines
0.0
(0)
Rate it
Studied by 0 people
Call Kai
Locked
Learn
Practice Test
Spaced Repetition
Match
Flashcards
Knowt Play
Card Sorting
1/5
Earn XP
Description and Tags
Computer Science
All Modes
Learn
Practice Test
Matching
Spaced Repetition
Call with Kai
Chats
Last updated 3:47 PM on 11/30/22
Update
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat
No analytics yet
Send a link to your students to track their progress
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)