Exam 2 Comp Logic
what would display if following statements are coded and executed? Declare Integer scores[3]= 76, 94, 83 Declare String names[3] = "Joe", "Amy", "Pat" Display names[1] Display "Your test score is: " Display scores[2]
Amy Your test score is:83
Checking that input data is reasonable is programmatically impossible.
False
Given an integer variable, number. The only possible values for number that could result from the following statement are 1 and 2.
False
If a user is asked to enter the number of widgets he or she wants to buy and enters "two", the program will automatically change the entry to an integer.
False
If an array, names, consists of a list of usernames, then names[1] holds the value of the first username in the list.
False
In a For loop the programmer must know the exact number of iterations the loop must perform before writing the code.
False
The OR operator will evaluate to True only if both subexpressions are also True
False
The following pseudocode is for a loop that will perform three iterations. For start = 6 To 2 Step -3 Do something
False
The term parallel array is a synonym for a two-dimensional array.
False
string variable, name has the value "Anne Marie", then the following statement would return 9: Set number = length(name)
False
An If-Then-Else statement must be used to write a single alternative decision structure.
Flase
In many languages the == operator determines whether one variable has the same value as another variable
True
Many programming languages let you assign an integer value to a real variable without causing an error.
True
The Do-While loop is a posttest loop.
True
The following pseudocode would display Hello, friend.
True
The function body follows the function header in a function definition.
True
What do computer programmers say about the fact that computers can't tell the difference between good and bad data?
garbage in, garbage out
Two-dimensional arrays can be thought of as containing __________.
rows and columns
A nested decision structure can be used to test more than one condition
True
If a user is asked to enter the number of widgets he or she wants to buy, the isInteger function can be used to validate this input.
True
of the following statements is true about this array declaration? Declare Integer numbers[5] = 123,456,789,321,654
This is an array declaration and initialization.
Which type of loop uses a Boolean expression to control the number of times a loop repeats?
condition-controlled
The following is an example of a(n) __________ loop. While x < 10 Set sum = sum + x Set x = x + 1
count-controlled
Which function could be used to validate an entry for a user's chosen name that must be between 4 and 12 characters?
length