44-141Functions Word Scramble
|
Embed Code - If you would like this activity on your web page, copy the script below and paste it into your web page.
Normal Size Small Size show me how
Normal Size Small Size show me how
Question | Answer |
a named sequence of instructions that are grouped together to perform a task | function |
A function is useful because it allows the programmer to organize their code by breaking it down into smaller pieces? | True |
When a function is called, additional information may be needed called a(n) | argument |
A function that returns a value is called a | value returning function |
A function that does not return a value is called a | non-value retruning function |
In the following code what is the name of the function: def addName(name: str) -> None: | addName |
In the following code what is the parameter: def addName(name: str) -> None: | name |
In the following code what is returned by the function: def addName(name: str) -> None: | nothing (None) |
In the following code, how many parameters are there: def findMin(num1: int, num2: int, num3: int) -> int: | 3 (num1, num2, num3) |
In the following code what data type is parameter 1: def findMin(num1: int, num2: int, num3: int) -> int: | int |
In the following code, what is returned by the function: def findMin(num1: int, num2: int, num3: int) -> int: | int |
What is the keyword used to define a function? | def |
What contains information about how a function will work and be called? | function header |
What receives and argument when the function is called? | parameter |
A function can have more then one return statement? | True (as long as only one return statement can be reached, such as an if/else structure) |
A function can return more then one value? | False |
The function header consists of the function identifier and arguments? | False |
The functions signature consists of the function identifier and arguments. | True |
The function header consists of the function identifier, list or formal parameters, and return type if denoted. | True |
In the following code what is the argument: addName("Jane") | Jane |
Write a function called averagePay that will return the average pay of type float of an employee over a number of weeks. The function should have 2 parameters totalPay of type float and numOfWeeks of type int. Include function annotations in your answer. | def averagePay(totalPay: float, numOfWeeks: int) -> float: return totalPay / numOfWeeks |
What is the function signature of the following function: def maxValue(pay1: float, pay2: float) -> float: | maxValue(float, float) |
What is the function signature of the following code: def sayHello() -> None: | sayHello() |
What are the function parameters of the following code: def sayHello() -> None: | no parameters |
Created by:
dianarNW
Popular Computers sets