Unit 4 and 5 Review Flashcards
Jamie keyed "Interger" instead of "Integer". What type of error resulted? A. run-time error B. dynamic error C. syntax error D. logic error
C. syntax error
Which is an example of a try…catch?
A. Try
intNum = Convert.ToInt32(txtNum. Text)
Catch ex As Exception
MessageBox.Show(“Enter a numeric value”)
End Try
B. Try
intNum = Convert.ToInt32(txtNum.Text)
Catch ex As Exception
MessageBox.Show(“Enter a numeric value”)
End
C. Try
intNum = Convert. ToInt32(txtNum.Text)
Catch Exception
MessageBox.Show(“Enter a numeric value”)
End Try
D. Try Exception
intNum = Convert.ToInt32(txtNum.Text)
Catch ex As Exception
MessageBox.Show(“Enter a numeric value”)
End
A. Try
intNum = Convert.ToInt32(txtNum. Text)
Catch ex As Exception
MessageBox.Show(“Enter a numeric value”)
End Try
A Boolean variable can contain:
A. True and false.
B. On and off.
C. Positive and negative.
D. Long and short.
A. True and false.
Susan declares a variable within an If statement. What is the scope of this variable? A. Local B. Procedural C. Global D. Non-Local
B. Procedural
Which data type is appropriate to store the number five (5)? A. Char B. Integer C. String D. Boolean
B. Integer
In what type of loop are the conditions evaluated before the instructions are processed? A. Pretest B. Infinite C. Finite D. Posttest
A. Pretest
Given the following code segment, what is the value of intNumber that displays in the Label? Dim intCount, intNumber As Integerint Count = 0 intNumber = 0 Do intNumber = intNumber + 2 intCount = intCount + 1 Loop Until intCount > 3 lblAnswer.Text = intNumber A. 6 B. 8 C. 4 D. 2 Response Feedback: 5.05
B. 8
Which button would be clicked before START in order to run an application using the menu bar? A. Build B. Project C. Debug D. View
C. Debug
Grades are based on the scale below. Using this scale, which condition(s) would be used to identify students who made a "D" or an "F"? A 93-100 B 85-92 C 78-84 D 70-77 F 0-69 A. dblScore >= 0 And dblScore = 80 C. dblScore 0 D. dblScore = 78
A. dblScore >= 0 And dblScore
Which data type is used to declare a variable that will store the value 0.113? A. String B. Double C. Char D. Boolean
B. Double
Variable names: A. Must begin with a letter B. Can contain spaces C. Must contain a digit D. Can be a keyword
A. Must begin with a letter
Which statement correctly assigns the value 5 to the variable intNum? A. intNum (5) B. 5 = intNum C. intNum = 5 D. intNum 5
C. intNum = 5
North Carolina allows a teenager to have a learner’s permit if they are 15 and have had driver’s education training. Consider the intAge and blnHasHadDrivEd variables. Which of the following If conditions would allow alearner’s permit?
A. intAge = 15 Or blnHasHadDrivEd = True
B. intAge > 14 Or blnHasHadDrivEd = True
C. intAge = 15 And blnHasHadDrivEd = True
D. intAge
C. intAge = 15 And blnHasHadDrivEd = True
Sara thought her program would calculate grade point averages, but the program listed the highest grade instead.What type of error is this? A. dynamic error B. logic error C. run-time error D. syntax error
B. logic error
Alice wrote a program that executed but did not produce the expected output. What is the BEST method for Aliceto find the error?
A. Hover over the variables in the code to change the output.
B. Add try catch.
C. Debug the program.
D. Add break-points and step through the code while watching the variable output.
D. Add break-points and step through the code while watching the variable output.
Which statement correctly displays a messagebox with the message “Programming is awesome!”?
A. MessageBox.Show(“Programming is awesome!”)
B. MessageBox.Text = “Programming is awesome!”
C. MessageBox.Show = (“Programming is awesome!”)
D. MessageBox.Show = “Programming is awesome!”
A. MessageBox.Show(“Programming is awesome!”)
Given the following statements: Dim intExperience As Integer = 10 If intExperience > 5 Then lblMessage.Text="Sufficient Experience" Else lblMessage.Text="Inexperienced" End If What is displayed when the statements execute?
A. Sufficient Experience
B. Inexperienced
C. Sufficient Experience on one line and inexperience on the other
D. Nothing would be displayed
A. Sufficient Experience
Examine the code below. What value is stored in intResult after the loop executes? Dim intCount As Integer Dim intResult As Integer For intCount= 0 to 11 Step 2 intResult = intResult + 1 Next A. 10 B. 12 C. 11 D. 6
D. 6
Typically, accumulators and counters are initialized to this value A. nothing B. 0 C. 2 D. 1
B. 0
In the following code, how many times does the program count through the loop structure? For intCounter as integer = 1 To 5 A. 0 B. 1 C. 5 D. The loop will not start
C. 5
Which type of error produces undesired or unexpected results? A. Run-time error B. Syntax error C. Logic error D. Dynamic error
C. Logic error
Given the following statements: If intGuess=intSelected Then lblMessage.Text="Correct" Else lblMessage.Text="Incorrect" End If What is displayed when intGuess is 8 and intSelected is 9? A. Correct on one line and Incorrect on the next line B. Nothing would be displayed C. Correct D. Incorrect
D. Incorrect
What is a purpose of the WATCH window? A. To display online help B. To switch to the Code window C. To display the application interface D. To examine values during the execution of a program
D. To examine values during the execution of a program
The loop structure is also referred to as a(n) A. Case B. Block C. Repetition D. Decision
C. Repetition