Functions Flashcards

1
Q

What is a function in programming?

A

A module that groups statements to perform a task and can return a value.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How can a returned value from a function be used?

A

Like any other value in the program.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are library functions?

A

Built-in functions provided by a programming language.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What three things must be known to use a library function?

A

Its purpose, required arguments, and returned data type.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What does defining a function create?

A

A module that can be reused.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What does a function header specify?

A

Return type, function name, and parameter variables.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What does the function body contain?

A

Statements executed when called, including a return statement.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the purpose of a return statement?

A

To send a value back to the caller.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How does a flowchart represent a function?

A

It starts with a terminal symbol and includes the function name and parameters.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What can the return statement return besides a single value?

A

An expression.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is an IPO chart?

A

A tool to organize function inputs, processing steps, and outputs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What does “IPO” stand for in an IPO chart?

A

Input, Processing, Output.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the purpose of an IPO chart in function design?

A

What is the purpose of an IPO chart in function design?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is a function parameter?

A

A variable listed in the function header that receives input.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How do functions improve code structure?

A

By modularizing tasks, reducing redundancy, and enhancing readability.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly