NEW
Font size
WorksheetsInscoe - CPI 5.01-5.04
Total questions: 36
Worksheet time: 18mins
In the code shown, determine the value of intJ displayed in the MessageBox .
50
10
MessageBox will not display due to a runtime error.
Program will not compile due to a syntax error.
Jamie keyed “Interger” instead of “Integer”. What type of error resulted?
Dynamic error
Logic error
Runtime error
Syntax error
Misspelling a keyword is an example of a:
dynamic error.
logic error.
syntax error.
run-time error.
Programming errors are classified into one of three categories. Which one is not a standard category?
Infinite
Run-time
Logic
Syntax
Which type of error produces undesired or unexpected results?
Dynamic error
Logic error
Run-time error
Syntax error
Sara thought her program would calculate grade point averages, but the program listed the highest grade instead. What type of error is this?
Dynamic error
Logic error
Runtime error
Syntax error
Using the code shown, determine the value of intJ displayed in the MessageBox.
10
50
MessageBox will not display due to a runtime error.
Program will not compile due to a syntax error.
John’s computer program stopped executing and displayed an error message. What type of error is this?
Dynamic error
Logic error
Run-time error
Syntax error
Which type of error halts the program when a statement cannot be executed?
Dynamic error
Logic error
Runtime error
Syntax error
The reason to use a breakpoint is to:
evaluate the user interface.
examine variables and check logic.
set the tab order for controls.
verify code syntax.
In the code shown, if the user enters 5 into the TextBox1 , the MessageBox will display:
0.
10.
50.
Sorry, not allowed!
Evaluate the code shown. If intX is 1 and intY is 0, what is displayed in the MessageBox ?
False
True
Unknown
Both False and True
In the code shown, if the user enters thirty-seven into the TextBox1, the MessageBox will display:
No MessageBox will be displayed.
Sorry, that is not a valid number, try again!
37.
38.
In the code shown, if the user enters zero (0) into the TextBox1 , the MessageBox will display:
0.
10.
50.
Sorry, not allowed.
Alice wrote a program that executed but did not produce the expected output. What is the best method for Alice to use to find the error?
Add break-points and step through the code while watching the variable output
Add try catch
Debug the program
Hover over the variables in the code to change the output
If defaults are set to show the Watch window, which data would be shown in the Watch window?
variable names only
variable values only
variable: code statements
variable: values
What is a purpose of the Watch window?
To examine values during the execution of a program
To display online help
To display the application interface
To switch to the Code window
When the code is completely written but will not execute, what is the appropriate action?
Code another program to correct the program just completed.
Give the program to another programmer for review and correction.
Perform programmer debugging and/or program debugging.
Rewrite all the lines of code.
Grades are based on the scale below. Using this scale, which condition(s) would be used to identify students who made an “A” or a “B”?
A 93–100
B 85–92
C 78–84
D 70–77
F 0–69
dblScore < 85 And dblScore > = 93
dblScore = 85 Or dblScore > 93
dblScore > 85 And dblScore > = 90
dblScore > = 85
If 5 and 2 are entered in txtNumber1 and txtNumber2 , respectively, what will the following code display?
Dim intNumber1 As Integer = Convert.ToInt32(txtNumber1.Text)
Dim intNumber2 As Integer = Convert.ToIn32(txtNumber2.Text)
Dim intResult As Integer
intResult = intNumber1 Mod intNumber2
lblAnswer.Text= intResult.ToString()
1
2
3
5
Grades are based on the scale below. Using this scale, which condition(s) would be used to identify students who made a “B”?
A 93–100
B 85–92
C 78–84
D 70–77
F 0–69
dblScore = 85 Or dblScore < 93
dblScore > 85 And dblScore < = 93
dblScore > = 85 And dblScore < 93
dblScore < 85 And dblScore > = 93
North Carolina allows a teenager to have a learner’s permit if he/she is 15 and has had driver’s education training. Consider the intAge and blnHasHadDrivEd variables. Which of the following If conditions would allow a learner’s permit?
intAge = 15 And blnHasHadDrivEd = True
intAge < 16 And blnHasHadDrivEd = True
intAge > 14 Or blnHasHadDrivEd = True
intAge = 15 Or blnHasHadDrivEd = True
Which logical condition will determine if the AccountBalance is not less than CreditLimit ?
AccountBalance <= CreditLimit
AccountBalance <> CreditLimit
AccountBalance = CreditLimit
AccountBalance >= CreditLimit
Which case condition is correct?
Case To 10
Case Is 10
Case 10
Case = 10
In the code shown, if the Button1 is repeatedly clicked, how often will MessageBox.Show display the string Only 0 and 3 ?
0% of the time
25% of the time
50% of the time
75% of the time
If the 7 weekdays are numbered 1 through 7, which statement generates a random whole number to represent one of the days, given the following code?
Dim gen As New System.Random()
gen.Next(1, 6)
gen.Next(7)
gen.Next(1,7)
gen.Next(1,8)
Given the statements shown, what is displayed when the statements execute?
Inexperienced
Nothing would be displayed
Sufficient experience
Sufficient experience on one line and inexperience on the other
Which condition is correct?
Case 2 And 5
Case 2, 5
Case 2 - 5
Case 2 Or 5
Given the statements shown, What is displayed when intGuess is 11 and intSelected is 15?
Correct
Correct on one line and Incorrect on the next line
Incorrect
Nothing would be displayed
A meat packer grades meat “P” for Prime, “C” for Choice, “S” for Standard, and “G” for Good. Which case expression will represent ChoiceMeat ?
Case "CGSP"
Case "P", "S"
Case "C"
Case Else
If the user clicks on btn1 in the code shown:
the button may become invisible.
the MessageBox will display 0.
the MessageBox will display 1.
the program will terminate.
In the code shown, which suit will never be selected?
Clubs
Hearts
Spades
Diamonds
If there are 6 sides on a die, which statement generates a random whole number to represent one of the sides, given the following code?
Dim gen As New System.Random()
gen.Next(1, 6)
gen.Next(0,7)
gen.Next(1, 7)
gen.Next(6)
If the 12 months are numbered 1 through 12, which statement generates a random whole number to represent one of the months, given the following code?
Dim gen As New System.Random()
gen.Next(1, 13)
gen.Next(1,12)
gen.Next(1,11)
. gen.Next(12)
Which statement generates random whole numbers greater than or equal to 10 and less than 51, given the following code?
Dim gen As New System.Random()
gen.Next(10, 50)
gen.Next(10, 51)
gen.Next(9, 50)
gen.Next(9, 51)
In the code shown, if the Button1 is repeatedly clicked, how often will MessageBox.Show display the string a 1 or 2 ?
about half the time
Never
Impossible to predict
About 1 time in 7
