Programming Concepts
Given that Jamie worked 50 hours (Hours = 50) last week and earns $10.00 an hour (Rate = 10), how much did Jamie earn last week, before taxes (TotalPay)? If (Rate >=10) OR (Hours <=40) Then TotalPay = Hours * Rate Else TotalPay = (Hours x Rate)+(Hours-40) x Rate x 1.5 End If
$500
If Number = 4, what possible numbers can result from Floor (Random * 10) + Number
4, 5, 6, 7, 8, 9, 10, 11, 12, 13
If Number = 7, what will be displayed after code corresponding to the following pseudocode is run? For (Count = 5; Count <= Number; Count++) Write Count, Count * 2 End For
5 10 6 12 7 14
If Apples = 6, what will be displayed after code corresponding to the following pseudocode is run? While Apples < 0 Write "You can't eat "+ Apples+"at one time!" End While Write "Goodbye, apple lover."
Goodbye, apple lover.
What does the following program segment do? Declare Count As Integer Declare Sum As Integer Set Sum = 0 For (Count = 1; Count < 50; Count++) Set Sum = Sum + Count End For
It sums all the integers from 1 through 49
What is the output of code corresponding to the following program segment if Age = 18? If Age >= 18 Then Write "You are eligible to vote." Else Set Vote = Age - 18 Write "You can vote in " + Vote + "years." End If
You are eligible to vote.
The type of control structure that causes a branch forward at some point, causing a portion of the program to be skipped, is:
a selection structure
A multiple-alternative structure cannot be implemented by using which of the following:
a single If-Then statement
Which of the following are normally used to write a program in a high-level language? a text editor a debugger a compiler or interpreter all of the above are needed
all of the above are needed
A counter must be:
an integer
Which is the first step in the program development cycle?
analyze the problem
A list of related data of the same data type which is referred to by a single variable name with an index number to identify each item is a(n):
array
If Number = 4, what possible numbers can result from Floor (Random* Number)?
0, 1, 2, 3
What is displayed when code corresponding to the following pseudocode is executed? Declare Numbers[12] As Integer Set K = 0 While K <= 2 Set Numbers[3 * K] = K + 1 Write Numbers[3 * K] Set K = K + 1 End While
1 2 3
If MyNumber = 6.8, what is the value of Int(MyNumber * 4^2)?
108
What is the output code corresponding to the pseudocode shown? Declare G As Integer Declare H As Integer Set G = 7 While G <= 8 Set H = 6 While H <= 7 Write G + H Set H + H + 1 End While (H) Set G = G + 1 End While (G)
13 14 14 15
What is the value of Number, given the following: A = 4.2, B = 6, C = 1.5
14
What is the value of the following expression: 22 % 5
2
Given: Count = 23, what is the value of Count after the following statement is executed: Count = Count + 2
25
If A = 5 and B = 3, what will de displayed when code corresponding to the following pseudocode is run?
25 16 9
What is the output of the code corresponding to the following pseudocode? Declare Y As Integer Declare X As Integer For (Y = 1; Y <=2; Y++) For (X = 3; X <= 4; X++) Write Y * X End For(X) End For(Y)
3 4 6 8
What is the output of the code corresponding to the following pseudocode? Declare X, Y As Integer For (X = 1; X <=2; X++) For (Y = 3; Y <= 4; Y++) Write X x Y End For(Y) End For(X)
3 4 6 8
The fourth element of an array named Colors is identified as:
Colors[3]
Which is the correct way to load an array named WorkHours with the number of hours that five employees worked last week?
Declare WorkHours[5] As Float Declare J As Integer For (J = 0; J<=4; J++) Write "Input number hours worked for employees" + J+! Input WorkHours[J] End For
What will be displayed after code corresponding to the following pseudocode is run?
Loops are fun! Hooray! Hooray!
Which of the following is not part of the analysis phase of the program development cycle?
determine the names of all the variables to be used
When a programmer breaks tasks down into smaller pieces, this is called:
modular programming
Two arrays of the same size in which elements with the same subscript are related are:
parallel arrays
One of the most important inventions of the 20th Century which subsequently allowed for the rapid increase in types and uses of computers was the:
transistor