Unit 4 and 5 Review Flashcards

1
Q
Jamie keyed "Interger" instead of "Integer". What type of error resulted?
A. run-time error
B. dynamic error  
C. syntax error
D. logic error
A

C. syntax error

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

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

A. Try
intNum = Convert.ToInt32(txtNum. Text)
Catch ex As Exception
MessageBox.Show(“Enter a numeric value”)
End Try

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

A Boolean variable can contain:

A. True and false.
B. On and off.
C. Positive and negative.
D. Long and short.

A

A. True and false.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q
Susan declares a variable within an If statement. What is the scope of this variable?
A. Local
B. Procedural
C. Global
D. Non-Local
A

B. Procedural

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q
Which data type is appropriate to store the number five (5)?
A. Char
B. Integer
C. String
D. Boolean
A

B. Integer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q
In what type of loop are the conditions evaluated before the instructions are processed? 
A. Pretest
B. Infinite
C. Finite
D. Posttest
A

A. Pretest

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q
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
A

B. 8

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q
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
A

C. Debug

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q
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

A. dblScore >= 0 And dblScore

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q
Which data type is used to declare a variable that will store the value 0.113?
A. String
B. Double
C. Char
D. Boolean
A

B. Double

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q
Variable names: 
A. Must begin with a letter
B. Can contain spaces
C. Must contain a digit
D. Can be a keyword
A

A. Must begin with a letter

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q
Which statement correctly assigns the value 5 to the variable intNum? 
A. intNum (5) 
B. 5 = intNum 
C. intNum = 5
D. intNum 5
A

C. intNum = 5

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

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

A

C. intAge = 15 And blnHasHadDrivEd = True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q
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
A

B. logic error

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

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.

A

D. Add break-points and step through the code while watching the variable output.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

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

A. MessageBox.Show(“Programming is awesome!”)

17
Q
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

A. Sufficient Experience

18
Q
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
A

D. 6

19
Q
Typically, accumulators and counters are initialized to this value
A. nothing
B. 0
C. 2
D. 1
A

B. 0

20
Q
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
A

C. 5

21
Q
Which type of error produces undesired or unexpected results?
A. Run-time error
B. Syntax error
C. Logic error
D. Dynamic error
A

C. Logic error

22
Q
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
A

D. Incorrect

23
Q
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
A

D. To examine values during the execution of a program

24
Q
The loop structure is also referred to as a(n)
A. Case
B. Block
C. Repetition
D. Decision
A

C. Repetition

25
Q
The reason to use a breakpoint is to:	  
A. Examine variables and check logic.
B. Verify code syntax.
C. Evaluate the user interface.
D. Set the tab order for controls.
A

A. Examine variables and check logic.

26
Q

How do you declare a variable whose value cannot be changed after assignment?
A. Replace Dim with Static
B. Declare the variable as a global variable
C. Add Const after Dim
D. Replace Dim with Const

A

D. Replace Dim with Const

27
Q

Use a For..Next loop when theloop is to repeat the instructions how many times?

A. Fixed
B. Unrestricted
C. Infinite
D. Unlimited

A

A. Fixed

28
Q
Given the following statements:
Dim intNum As Integer = 0
Do
   IntNum = intNum + 1
Loop While intNum
A

C. 5

29
Q
A meat packer grades meat "P" for Prime, "C" for Choice, "S" for Standard, and "G" for Good. Which Caseexpression will represent ChoiceMeat?
A. Case "P", "S"
B. Case "CGSP"
C. Case "C"
D. Case Else
A

B. Case “CGSP”

C. Case “C”

30
Q
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
A. dblScore = 93
B. dblScore = 85 Or dblScore > 93
C. dblScore >= 85
D. dblScore > 85 And dblScore >= 90
A

C. dblScore >= 85

31
Q

Which statement generates random whole numbers greater than or equal to 10 and less than 51, given thefollowing code?
Dim gen As New System.Random()

A. gen.Next(10, 51)
B. gen.Next(10, 50)
C. gen.Next(9, 51)
D. gen.Next(9, 50)

A

A. gen.Next(10, 51)

32
Q
Which condition below is keyed correctly?	
A. Case 2 - 5
B. Case 2 And 5
C. Case 2, 5
D. Case 2 Or 5
A

C. Case 2, 5

33
Q
In the following code, how many times does the program count through the loop structure? For intCounter as
integer = 1 To 9 Step 3
A. 9
B. 1
C. 0
D. 3
A

D. 3

34
Q
Which method formats output as currency?
A. dblMoney.ToString = $##.00
B. dblMoney.ToString("$##.00")
C. dblMoney.ToString($##.00)
D. dblMoney.ToString = "$##.00
A

B. dblMoney.ToString(“$##.00”)

35
Q
Kirk wants to delcare a variable that holds its value beyond the normal lifetime. How should he declare it?
A. Dim Static intGrade As Integer
B. Dim intGrade As Integer
C. Static intGrade As Integer
D. Static Dim intGrade As Integer
A

C. Static intGrade As Integer

36
Q

Which condition below is keyed correctly?

A. Case = 11 >

A

B. Case 11 To 33

37
Q
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()
A. gen.Next(6)
B. gen.Next(1, 7)
C. gen.Next(0,7)
D. gen.Next(1, 6)
A

B. gen.Next(1, 7)

38
Q
Which condition below is keyed correctly?
A. Case Is 10
B. Case = 10
C. Case To 10
D. Case 10
A

D. Case 10

39
Q
The words "A Double data type should be always stored as a Double data type!" would be best stored in which one of the following data types?			
A. Double
B. String
C. Integer
D. Decimal
A

B. String