Deck 6: Functions

Full screen (f)
exit full mode
Question
Which of the following statements is true after the execution of the following statement?
Y = abs(x)

A)y contains the absolute value of x
B)x contains the absolute value of y
C)x contains the absolute value of the value in y
D)y contains the absolute value of the value in x
E)None of the above
Use Space or
up arrow
down arrow
to flip the card.
Question
Random numbers are commonly used in which type of program?

A)Games
B)Simulations
C)Statistical analysis
D)Data encryption
E)All of the above
Question
Examine the following piece of code and state the return value of the function.
Function Integer product (Integer num1,Integer num2)
Declare Real result
Set result = num1 + num2
Return result
End Function

A)Real
B)Integer
C)product
D)result
E)None of the above
Question
Which of the following is optional when writing a function definition?

A)Function header
B)Function body
C)Data type
D)Return statement
E)None of the above
Question
What is the data type of the value returned by the random library function?

A)String
B)Integer
C)Boolean
D)Real
E)None of the above
Question
What term is used in the ending terminal symbol of a function flowchart?

A)Return
B)End
C)Function End
D)Function Return
E)None of the above
Question
The term ________________ is used to describe any mechanism that accepts input,performs some operation that cannot be seen on the input,and produces output.

A)White box
B)Black box
C)White cube
D)Black cube
E)None of the above
Question
A __________ is a module that returns a value back to the part of the program that called it.

A)Function
B)For
C)Loop
D)While
E)None of the above
Question
Which of the following errors occur when a real value is attempted to be assigned to an integer variable?

A)Integer value
B)Type mismatch
C)Conversion
D)Assignment
E)None of the above
Question
Library functions are built into the programming language,and can be called any time they are needed.
Question
The function ______ specifies the return data type,name of the function,and the parameter variable(s).

A)Definition
B)Body
C)Header
D)statement
E)None of the above
Question
The variable r would contain the value ________ after the execution of the following statement.
Declare Integer i = 12
Declare Real r
Set r = toReal (i)

A)12
B)1.2
C)12.0
D)0.12
E)None of the above
Question
Which of the following statements is true after the execution of the following statement?
Set needANumber = random(5,10)

A)A random number is generated between 5 and 10.
B)The random number is assigned to the variable needANumber.
C)The numbers 5 and 10 are the arguments of the random number function.
D)All of the above
E)None of the above
Question
The function _________ comprises one or more statements that are executed when the function is called.

A)Definition
B)Header
C)Body
D)Datatype
E)None of the above
Question
Which function returns a string within a string?

A)Append
B)Concatenate
C)Contains
D)Substring
E)None of the above
Question
Examine the following piece of code and determine the data type of the function's return value.
Function Real sum (Integer num1,Integer num2)
Declare Integer result
Set result = num1 + num2
Return result
End Function

A)Real
B)Integer
C)Sum
D)result
E)None of the above
Question
In the IPO chart,the _______ column describes the data that is passed to the function as arguments.

A)Output
B)Function
C)Process
D)Input
E)None of the above
Question
The ________ function does the same thing as using the mathematical ^ operator.

A)cos
B)abs
C)sqrt
D)round
E)pow
Question
The parameter list that accepts arguments is optional in a function definition.
Question
Which function accepts two strings as arguments,returns "True" if the first string contains the second string,and otherwise returns "False"?

A)Append
B)Concatenate
C)Contains
D)Substring
E)None of the above
Question
A function is a group of _________ that perform a specific task.
Question
The process of appending one string to the end of another string is called _________________.
Question
When a function is called,it is ___________.
Question
The value that is returned from a function can be used just like any other value.
Question
The function body follows the function header in a function definition.
Question
The library functions in every programming language have the same function names and accept the same arguments,but their behaviors might differ slightly.
Question
Most programming languages let you assign an integer value to a real variable without causing an error.
Question
The ________ function accepts two strings as arguments and returns a third string that is created by appending the second string to the end of the first string.
Question
When a function finishes,it returns a value back to the part of the program that called it.
Question
The number of arguments that can be passed to a function are limited in most programming languages.
Question
The ________ chart is a tool that programmers use when designing functions.
Question
The __________ column describes the data that is returned from the function in an IPO chart.
Question
The toInteger function accepts a real number as its argument and preserves any fractional part in the returned number.
Question
The input column in the IPO chart describes the process the function performs on the input data.
Question
Random numbers are useful in simulation programs where the computer must randomly decide how an object will behave.
Question
There can be only _______ return value from a function to the called module.
Question
Programming languages have not yet started to support localization.
Question
The ______ function accepts an argument and returns the square root of the argument.
Question
A ___________ statement specifies the value that is returned from the function when the function ends.
Question
In a flowchart of a function,the starting terminal symbol states the name of the function,along with any _________ that the function has.
Question
The _________ function can be used to determine whether a string can be converted to an integer.
Question
The ___________ function accepts a string as its argument and returns the number of characters in the string.
Question
_______________ is the process where a program can be configured for a specific country.
Question
In programming,the characters in a string are each identified by its position number,and the first character is in position number ________.
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/44
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 6: Functions
1
Which of the following statements is true after the execution of the following statement?
Y = abs(x)

A)y contains the absolute value of x
B)x contains the absolute value of y
C)x contains the absolute value of the value in y
D)y contains the absolute value of the value in x
E)None of the above
D
2
Random numbers are commonly used in which type of program?

A)Games
B)Simulations
C)Statistical analysis
D)Data encryption
E)All of the above
E
3
Examine the following piece of code and state the return value of the function.
Function Integer product (Integer num1,Integer num2)
Declare Real result
Set result = num1 + num2
Return result
End Function

A)Real
B)Integer
C)product
D)result
E)None of the above
D
4
Which of the following is optional when writing a function definition?

A)Function header
B)Function body
C)Data type
D)Return statement
E)None of the above
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
5
What is the data type of the value returned by the random library function?

A)String
B)Integer
C)Boolean
D)Real
E)None of the above
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
6
What term is used in the ending terminal symbol of a function flowchart?

A)Return
B)End
C)Function End
D)Function Return
E)None of the above
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
7
The term ________________ is used to describe any mechanism that accepts input,performs some operation that cannot be seen on the input,and produces output.

A)White box
B)Black box
C)White cube
D)Black cube
E)None of the above
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
8
A __________ is a module that returns a value back to the part of the program that called it.

A)Function
B)For
C)Loop
D)While
E)None of the above
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
9
Which of the following errors occur when a real value is attempted to be assigned to an integer variable?

A)Integer value
B)Type mismatch
C)Conversion
D)Assignment
E)None of the above
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
10
Library functions are built into the programming language,and can be called any time they are needed.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
11
The function ______ specifies the return data type,name of the function,and the parameter variable(s).

A)Definition
B)Body
C)Header
D)statement
E)None of the above
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
12
The variable r would contain the value ________ after the execution of the following statement.
Declare Integer i = 12
Declare Real r
Set r = toReal (i)

A)12
B)1.2
C)12.0
D)0.12
E)None of the above
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
13
Which of the following statements is true after the execution of the following statement?
Set needANumber = random(5,10)

A)A random number is generated between 5 and 10.
B)The random number is assigned to the variable needANumber.
C)The numbers 5 and 10 are the arguments of the random number function.
D)All of the above
E)None of the above
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
14
The function _________ comprises one or more statements that are executed when the function is called.

A)Definition
B)Header
C)Body
D)Datatype
E)None of the above
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
15
Which function returns a string within a string?

A)Append
B)Concatenate
C)Contains
D)Substring
E)None of the above
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
16
Examine the following piece of code and determine the data type of the function's return value.
Function Real sum (Integer num1,Integer num2)
Declare Integer result
Set result = num1 + num2
Return result
End Function

A)Real
B)Integer
C)Sum
D)result
E)None of the above
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
17
In the IPO chart,the _______ column describes the data that is passed to the function as arguments.

A)Output
B)Function
C)Process
D)Input
E)None of the above
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
18
The ________ function does the same thing as using the mathematical ^ operator.

A)cos
B)abs
C)sqrt
D)round
E)pow
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
19
The parameter list that accepts arguments is optional in a function definition.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
20
Which function accepts two strings as arguments,returns "True" if the first string contains the second string,and otherwise returns "False"?

A)Append
B)Concatenate
C)Contains
D)Substring
E)None of the above
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
21
A function is a group of _________ that perform a specific task.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
22
The process of appending one string to the end of another string is called _________________.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
23
When a function is called,it is ___________.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
24
The value that is returned from a function can be used just like any other value.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
25
The function body follows the function header in a function definition.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
26
The library functions in every programming language have the same function names and accept the same arguments,but their behaviors might differ slightly.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
27
Most programming languages let you assign an integer value to a real variable without causing an error.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
28
The ________ function accepts two strings as arguments and returns a third string that is created by appending the second string to the end of the first string.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
29
When a function finishes,it returns a value back to the part of the program that called it.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
30
The number of arguments that can be passed to a function are limited in most programming languages.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
31
The ________ chart is a tool that programmers use when designing functions.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
32
The __________ column describes the data that is returned from the function in an IPO chart.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
33
The toInteger function accepts a real number as its argument and preserves any fractional part in the returned number.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
34
The input column in the IPO chart describes the process the function performs on the input data.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
35
Random numbers are useful in simulation programs where the computer must randomly decide how an object will behave.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
36
There can be only _______ return value from a function to the called module.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
37
Programming languages have not yet started to support localization.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
38
The ______ function accepts an argument and returns the square root of the argument.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
39
A ___________ statement specifies the value that is returned from the function when the function ends.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
40
In a flowchart of a function,the starting terminal symbol states the name of the function,along with any _________ that the function has.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
41
The _________ function can be used to determine whether a string can be converted to an integer.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
42
The ___________ function accepts a string as its argument and returns the number of characters in the string.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
43
_______________ is the process where a program can be configured for a specific country.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
44
In programming,the characters in a string are each identified by its position number,and the first character is in position number ________.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 44 flashcards in this deck.