Programming Ch. 6
The variable r would contain the value ________ after the execution of the following statement. Declare Integer j = 12 Declare Real r Set r = toReal (1) 12 1.2 12.0 0.12
12.0
Random numbers are commonly used in which type of program? Games Simulations Statistical analysis Data encryption All of these
All of these
Which of the following statements is true after the execution of the following statement? Set needANumber = random(5, 10) A random number is generated between 5 and 10 The random number is assigned to the variable needANumber The numbers 5 and 10 are the arguments of the random number function All of these None of these
All of these
The term ________ is used to describe any mechanism that accepts input, performs some operation that cannot be seen on the input, and produces output. While box Black box White cube Black cube None of these
Black box
The function ________ comprises one or more statements that are executed when the function is called. Definition Header Body Datatype None of these
Body
Which function accepts two strings as arguments, returns "True" if the first string contains the second string, and otherwise returns "False"? Append Concatenate Contains Substring None of these
Contains
Programming languages have not yet started to support localization. True or False
False
The input column in the IPO chart describes the process the function performs on the input data. True or False
False
The library functions in every programming language have the same function names and accept the same arguments, but their behaviors might differ slightly. True or False
False
The number of arguments that can be passed to a function are limited in most programming languages. True or False
False
The toInteger function accepts a real number as its argument and preserves any fractional part in the returned number. True or False
False
A ________ is a module that returns a value back to the part of the program that called it. Function For Loop While None of these
Function
The function ________ specifies the return data type, name of the function, and the parameter variable(s). Definition Body Header Statement None of these
Header
In the IPO chart, the ________ column describes the data that is passed to the function as arguments. Output Function Process Input None of these
Input
What is the data type of the value returned by the random library function? String Integer Boolean Real None of these
Integer
Which of the following is optional when writing a function definition? Function header Function body Data type Return statement None of these
None of these
Examine the following piece of code and determine the data type of the function's return value. Function Real sum (integer num1, integer num 2) Declare Integer result Set result = num1 + num2 Return result End Function Real Integer Sum result None of these
Real
What term is used in the ending terminal symbol of a function flowchart? Return End Function End Function Return None of these
Return
Which function returns a string within a string? Append Concatenate Contains Substring None of these
Substring
Library functions are built into the programming language, and can be called any time they are needed. True or False
True
Most programming languages let you assign an integer value to a real variable without causing an error. True or False
True
Random numbers are useful in simulation programs where the computer must randomly decide how an object will behave. True or False
True
The function body follows the function header in a function definition. True or False
True
The parameter list that accepts arguments is optional in a function definition. True or False
True
The value that is returned from a function can be used just like any other value. True or False
True
When a function finishes, it returns a value back to the part of the program that called it. True or False
True
Which of the following errors occur when a real value is attempted to be assigned to an integer variable? Integer value Type mismatch Conversion Assignment None of these
Type mismatch
Which of the following statements is true after the execution of the following statement? y = abs(x) y contains the absolute value of x x contains the absolute value of y x contains the absolute value of the value in y y contains the absolute value of the value in x None of these
Y contains the absolute value of the value in x
The ________ function does the same thing as using the mathematical ∧ operator. cos pow round abs sqrt
pow
Examine the following piece of code and state the return value of the function. Function Integer product (integer num1, integer num 2) Declare Real result Set result = num1 + num2 Return result End Function Real Integer product result None of these
result