Homework on Functions - Questions

1. Describe what a function does in your own words
Function is a computation, calculates input to output with various possible conditions

2. Calculate the output of the following function
* *f(x) = {**x^2 if x is even* *x+10 if x is odd* *}* *
** a) f(2)* = 4
** b) f(7)* = 17
** c) f(0)* = 0

3. Write the definition of a function f that takes an input x, divides it by four and then outputs that result subtracted by 5.
*f(x) = {(x/4)-5}

1 Like
  1. A FUNCTION IS WHEN YOU PLACE INPUTS AND GET OUTPUTS.

2)a) 4
B) 17
C ) 0
3) f(x)=(x/4)-5

1 Like
  1. a function takes an input, performs a mathematical operation to generate an output.

a. f(2)=4
b. f(7)=17
c. f(0)=0

  1. f(x)=(x/4)-5
1 Like

1: Takes Input in a predefined algorithm and gives a computed output

2: 4, 17, 0

3: f(x)=(x/4)-5

1 Like
  1. Describe what a function does in your own words
    • A function receive parameters (inputs), process it or them with instruction, mathematic formulas or other call to subfunctions to generate an output that is returned to the caller. It’s a way to capture the business logic of a specific action so that it can be replicated and automated in smart contract.

  1. Calculate the output of the following function
f(x) = {
x^2 if x is even
x+10 if x is odd
}

What will be the output for the following inputs?

  • a) f(2) => 4
  • b) f(7) => 17
  • c) f(0) => 0

  1. Write the definition of a function f that takes an input x, divides it by four and then outputs that result subtracted by 5.

f(x) = { return (x / 4) - 5; }

1 Like
  1. Describe what a function does in your own words

A function converts one value into a new value or it can take a value and modify the input values. A function can standalone and has minimal dependencies typically just depends on the underlying programming language constructs.

  1. Calculate the output of the following function
f(x) = {

x^2 if x is even

x+10 if x is odd

}

What will be the output for the following inputs?

  • a) f(2)

4 – 2 is even - 2^2 is 4

  • b) f(7)

17 – 7 is odd - 7+10 is 17

  • c) f(0)

0 = 0 is even - 0^2 is 0

  1. Write the definition of a function f that takes an input x, divides it by four and then outputs that result subtracted by 5.
f(x) {
 return (x/4)-5
}
1 Like
  1. A function is a computation that receives input and gives output.

2a. 4
2b. 17
2c. 0

  1. f(x) = x/4 - 5
1 Like

Takes an input, applies a formula to it
2.
a) 4
b) 17
c) 0

1 Like
  1. A function is a piece of code that makes some math calculation with variables as an Input to get an Output

a) 4
b) 17
c) 0

  1. F(x) = (x/4)-5
1 Like
  1. Describe what a function does in your own words
    A. A function provides an output for a given input.

  2. Calculate the output of the following function

f(x) = {

x^2 if x is even

x+10 if x is odd

}

What will be the output for the following inputs?

  • a) f(2) = 4
  • b) f(7) = 17
  • c) f(0) = 0
  1. Write the definition of a function f that takes an input x, divides it by four and then outputs that result subtracted by 5.
    A. f(x)=(x/4)-5
1 Like
  1. A function it is like a command where you have the input and generate the output .
    2.f(2)=4 ; f(7)= 17 ; f(0) = 0
    3.f(x) = (x/4)-5
1 Like

1. Describe what a function does in your own words

A function is a mathematical operation that applies a predetermined operation to a equation altering the input and creating a different output.

2. Calculate the output of the following function

  • a) f(2) = 4
  • b) f(7) = 17
  • c) f(0) = 0

3. Write the definition of a function f that takes an input x, divides it by four and then outputs that result subtracted by 5.

f(x) = (x/4)-5

1 Like
  1. A function is a mathematical computation or process that a person uses to feed in an ‘input’ and the function converts it to an ‘output’.

2a. 4
2b. 17
2c. 0

  1. f(x) = (x/4) - 5
1 Like

1.Describe what a function does in your own words

A function is a computation which calculates an input to give you an output.

2.Calculate the output of the following function
f(x) = {

x^2 if x is even

x+10 if x is odd

}
What will be the output for the following inputs?

a) f(2) = 4

b) f(7) = 17

c) f(0) = 0

3.Write the definition of a function f that takes an input x, divides it by four and then outputs that result subtracted by 5.

f(x) = (x/4)-5

1 Like
  1. Describe what a function does in your own words

A function is a relation between a set of inputs to a set of possible outputs.

  1. Calculate the output of the following function
f(x) = {

x^2 if x is even

x+10 if x is odd

}

What will be the output for the following inputs?

  • a) f(2)
    f(2) = 2^2 = 4 (x=2, 2 is even)

  • b) f(7)
    f(7) = 7+10= 17 (x=7, 7 is odd)

  • c) f(0)
    f(0) = 0^2 = 0 (x=0, 0 is even)

  1. Write the definition of a function f that takes an input x, divides it by four and then outputs that result subtracted by 5.

f(x) = x/4 - 5

1 Like
  1. A function is a computation that turns an input into an output.

  2. f ( x ) = x^2
    a) f ( 2 ) = 4

f ( x ) = x + 10
b) f ( 7 ) = 17

c) f ( 0 )

  1. f ( x ) = (x/4)-5
1 Like
  1. A function is a mathematic operation in which the output is the result of several inputs.
  2. a) 4
    b) 17
    c)0
  3. f(x) = (x/4)-5
1 Like
  1. Describe what a function does in your own words
    A function takes an input, goes through its instructions (we can see it as a black box), then gives back the output.
  2. Calculate the output of the following function

f(x) = {

x^2 if x is even

x+10 if x is odd

}

What will be the output for the following inputs?

  • a) f(2) = 4
  • b) f(7) = 17
  • c) f(0) = 0
  1. Write the definition of a function f that takes an input x, divides it by four and then outputs that result subtracted by 5.
    f(x) = x/4 - 5
1 Like
  1. Describe what a function does in your own words

A function can be a mathematical formula that receive one input and give one output. Or can be a programing code that receive one or more inputs then make some calculations and, in the end, give one or more outputs.

  1. Calculate the output of the following function

f(x) = {

x^2 if x is even

x+10 if x is odd

}

What will be the output for the following inputs?

  • a) f(2) = 4
  • b) f(7) = 17
  • c) f(0) = 0
  1. Write the definition of a function f that takes an input x, divides it by four and then outputs that result subtracted by 5.

f(x) = (x/4)-5

1 Like
  1. Describe what a function does in your own words
  • A function takes in an input (Ex. x) and returns an output
  1. Calculate the output of the following function

f(x) = {

x^2 if x is even

x+10 if x is odd

}

What will be the output for the following inputs?

  • a) f(2) = 4
  • b) f(7) = 17
  • c) f(0) = 0
  1. Write the definition of a function f that takes an input x, divides it by four and then outputs that result subtracted by 5.
  • f(x) = (x/4)-5
1 Like