WorksheetsInscoe - CPI 6.01-6.03
Total questions: 20
Worksheet time: 10mins
Which statement will correctly exit an application?
Application.Close()
Application.Exit()
Stop()
Exit()
Given the output image in the figure shown, what event procedure was executed?
Private Sub mnuGoodbye_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuGoodbye.Click
Private Sub mnuHello_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuHello.Click
Private Sub mnuProgram_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuProgram.Click
Private Sub mnuClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuClose.Click
Given the output image in the figure shown, what event procedure was executed?
Private Sub mnuGoodbye_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuGoodbye.Click
Private Sub mnuHello_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuHello.Click
Private Sub mnuProgram_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuProgram.Click
Private Sub mnuClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuClose.Click
Which statement will correctly close a form?
Application.Close()
Application.Exit()
Close()
Me.Close()
Which event should be used with a MenuStrip?
.Changed
.Selected
.Click
.CheckChanged
Using the code segment below, what is the SelectedIndexvalue of Apple?
lstItems.Items.Add("Apple")
lstItems.Items.Add("Banana")
lstItems.Items.Add("Pear")
0
1
2
3
In the figure shown, "Hello", "Goodbye", and "Close" are each an example of:
a button.
a menu tool strip item.
a toolbar.
a label.
Using the code segment below, what is the SelectedIndexvalue of Pear?
lstItems.Items.Add("Apple")
lstItems.Items.Add("Banana")
lstItems.Items.Add("Pear")
0
1
2
3
Which statement would be best to read input in from an InputBox into the numeric variable?
dblNumerator= Convert.ToDouble(InputBox("Enter a numerator", "Numerator"))
dblNumerator= InputBox("Enter a numerator", "Numerator")
dblNumerator= Convert.ToInt32(InputBox("Enter a numerator", "Numerator"))
Convert.ToDouble(InputBox("Enter a numerator", "Numerator"))= intNumerator
The following statement displays a message box during run-time. Which of the arguments controls the title that displays on the top portion of the message box?
MessageBox.Show("Chloe did this correctly.", "Action correct?",MessageBoxButtons.OK, MessageBoxIcon.Question)
Chloe did this correctly.
Action correct?
MessageBoxButtons.OK
MessageBoxIcon.Question
Which statement would correctly read input in from an InputBox into the string variable?
strNumerator= InputBox("Enter a numerator", "Numerator")
intNumerator= InputBox("Enter a numerator", "Numerator")
strNumerator InputBox("Enter a numerator", "Numerator")
InputBox("Enter a numerator", "Numerator")= strNumerator
Which statement will return True if the user selects the Yes button of a Message Box?
If MessageBox.Show("Would you like to continue?", "Continue", MessageBoxButt ons.YesNo) = DialogResult.Yes
If MessageBox.Show("Would you like to continue?", "Continue", MessageBoxButt ons.YesNo = OK)
If MessageBox.Show("Would you like to continue?", "Continue", MessageBoxButt ons.YesNo) = Result.Yes
If MessageBox.Show("Would you like to continue?", "Continue", MessageBoxButt ons.YesNo) = DialogResult.No
Which TryParse is written correctly if an integer is to be entered from the TextBox called txtNumber into the variable intNumber ?
blnAnswer= Int32(txtNumber.Text, intNumber)
blnAnswer= Int.TryParse(txtNumber.Text, intNumber)
blnAnswer= Int32.TryParse(txtNumber, intNumber)
blnAnswer= Int32.TryParse(txtNumber.Text, intNumber)
Which code segment will try to convert a string to an integer and return true or false if the conversion is successful?
blnAnswer= Int32.Parse(intRate, strInput)
blnAnswer= Int32.Parse(strInput, dblRate)
blnAnswer= Int32.TryParse(strInput, intRate)
blnAnswer= Int32.TryParse(intRate, strInput)
Given the following block of code, what is the output if the value “two” is entered?
If Int16.TryParse( txtNum.Text, intNum) Then
intNum = Convert.ToInt16(txtNum.Text) MessageBox.Show("Your number is: " & intNum.ToString)
Else MessageBox.Show("Enter numeric values.")
End If
Two
2
0
Enter numeric values.
What is the result of the following code?
strNumEntered= "15"
Result= Int32.TryParse(strNumEntered, intTest)
Result= True, intTest= 15
Result= False, intTest= 15
Result= False, intTest= 0
Result= True, intTest= 0
What is the result of the following code?
strNumEntered= "Five"
Result= Int16.TryParse(strNumEntered, intTest)
Result= True, intTest= 5
Result= False, intTest= 5
Result= False, intTest= 0
Result= True, intTest= 0
Given the following block of code, what is the output if the value “.05” is entered?
If Int32.TryParse( txtRate.Text, intRate) Then MessageBox.Show("Your rate is: " & intRate.ToString("##.0%"))
MessageBox.Show("Enter numeric values.")
End If
5
5.0%
0.05
Enter numeric values.
Given the following block of code, what is the output if the value “.05” is entered?
If Double.TryParse(txtRate.Text, dblRate) Then MessageBox.Show("Your rate is: " & dblRate.ToString("##.0%"))
Else MessageBox.Show("Enter numeric values.")
End If
5
5.0%
0.05
Enter numeric values.
Which segment of code will correctly test a Boolean expression to see if input from a TextBox can be converted to a double?
If Double.TryParse(txtInput.Text, dblNum) Then
If TryParse. Double(dblNum, txtInput) Then
If TryParse. Double(txtInput.Text, dblNum) Then
If TryParse(txtInput.Text, dblNum) Then
