IS246 Chapter 9
A form contains a button called btnDisplay, and the following code is placed inside btnDisplay's Click event procedure. At run time, which one of the following cannot possibly be displayed in the message box when the user clicks on btnDisplay? Dim rndNum As New Random() Dim num1 As Integer num1 = rndNum.Next(0, 3) MessageBox.Show(CStr(num1)) (A) 3 (B) 2 (C) 1 (D) 0
A
After a ToolTip control has been placed into the component tray of the Form Designer, the setting of what property determines the amount of time required for a tooltip to appear when mouse hovers over a text box? (A) AutomaticDelay (B) AutoPopDelay (C) Duration (D) AutoDelay
A
Give a statement that draws a blue line from the upper-left corner of the picture box to the center of the picture box. (A) gr.DrawLine(Pens.Blue, 0, 0, picOutput.Width/2, picOutput.Height/2) (B) gr.DrawLine(Pens.Blue, picOutput.Height, picOutput.Width, 0, 0) (C) gr.DrawLine(Pens.Blue, 0, 0, picOutput.Height/2, picOutput.Width/2) (D) gr.DrawLine(Pens.Blue, picOutput.Width/2, 0, 0, picOutput.Height/2)
A
The _______ event occurs just before a form closes. (A) FormClosing (B) Closing (C) CloseForm (D) FormEnding
A
The center of the circle drawn by the statement gr.DrawEllipse(Brushes.Red, 10, 20, 40, 40) has coordinates (A) (30, 40). (B) (10, 20). (C) (20, 40). (D) (40, 40).
A
The term modal refers to (A) the user not being allowed to shift the focus to any other form until the displayed modal form is hidden. (B) the BorderStyle property is set to "3-Fixed Double." (C) the ability to reposition a form at run time. (D) the ability to display more than one form at one time.
A
Which of the following controls does not have a DropDownStyle property that must be specified at design time? (A) ListBox (B) Simple ComboBox (C) DropDown ComboBox (D) DropDownList ComboBox
A
Which of the following expressions refers to the contents of the first row of the combo box? (A)cboBox.Items(0) (B) cboBox.Items(1) (C) cboBox.Items.First (D)cboBox.Items(First)
A
24. MenuStrip controls respond to which one of the following events? (A) Change (B) Click (C) Double (D) Load
B
A form contains a text box named txtBox and a button named btnClip. The statement Clipboard.SetText(txtBox.Text) is placed inside btnClip's Click event procedure. At run time, what will be placed into the Clipboard if the user enters the word "Hello" into txtBox and then clicks on btnClip? (A) the word "txtBox" (B) the word "Hello" (C) the Clipboard will be emptied of all contents (D) the word "btnClip"
B
A program contains two forms with the names Form1 and Form2. Form1 contains a button called btnDisplay, and the following code is placed inside btnDisplay's Click event procedure. Form2.ShowDialog() MessageBox.Show("Hello") Which of the following statements is true after the user clicks on btnDisplay at run time? (A) Form2 appears behind Form1 and the user will be able to set the focus to either form. (B) Form2 appears in front of Form1 and the user will only be able to set the focus to Form2. (C) A message box displaying the text "Hello" appears in front of Form2 and Form1. (D) A message box displaying the text "Hello" appears behind Form2 and Form1.
B
After a ToolTip control has been placed into the component tray of the Form Designer, the setting of what property determines how long a tooltip will remain visible when the mouse hovers over a text box? (A) AutomaticDelay (B) AutoPopDelay (C) Duration (D) AutoDelay
B
Give a statement that displays the value of the string variable strVar with yellow letters. (A) gr.DrawString(strVar, Me.Font, Yellow, 50, 50) (B) gr.DrawString(strVar, Me.Font, Brushes.Yellow, 50, 60) (C) gr.DrawString(strVar, Me.Font, Pens.Yellow, 50, 60) (D) gr.DrawString(strVar, Me.Font, Color.Yellow, 50, 60)
B
The _________ method is used to display a form as a modal form and give it the focus. (A) ShowForm (B) ShowDialog (C) ShowModal (D) ShowModalForm
B
The distance from the top of the picture box to the top of the circle drawn by the statement gr.DrawEllipse(Brushes.Red, 10, 20, 40, 40) is (A) 10 pixels. (B) 20 pixels. (C) 40 pixels. (D) 80 pixels.
B
The distance that the scroll box of a scroll bar will move when an arrow on the scroll bar is clicked is determined by (A) LargeChange. (B) SmallChange. (C) Value. (D) Maximum.
B
The first form loaded when a program starts running is called the ________ form. (A) default (B) startup (C) initial (D) favored
B
The radius of the circle drawn by the statement gr.DrawEllipse(Brushes.Red, 10, 20, 40, 40) is (A) 10 pixels. (B) 20 pixels. (C) 40 pixels. (D) 80 pixels
B
Which of the following expressions refers to the contents of the last row of the combo box? (A)cboBox.Items(lstBox.Items.Count) (B)cboBox.Items(lstBox.Items.Count - 1) (C)cboBox.Items(Count) (D)cboBox.Items.Count
B
Which of the following steps turns off a timer control? (A) Set the Interval property to zero. (B) Set the Enabled property to False. (C) Make the timer control invisible. (D) None of the above
B
21. The Clipboard object is used for all of the following except which one? (A) Copy text to the Clipboard. (B) Paste text from the Clipboard. (C) Clear the screen. (D) Clear the Clipboard.
C
39. After a ToolTip control has been placed into the component tray of the Form Designer, the message that appears when the mouse hovers over a text box is set with which of the following properties? (A) ToolTip (B) Message (C) ToolTip on ToolTip1 (D) ToolTipMessage
C
A form contains a horizontal scroll bar control named hsbXpos, and the statement lblFace.Top = hsbXpos.Value is placed inside the hsbXpos.Scroll event procedure (where lblFace identifies a label on the form, and the hsbXpos's Minimum and Maximum properties are set at their default values). What will happen when the hsbXpos.Scroll event is triggered by moving the scroll bar's scroll box to the right? (A) lblFace will move to the left (B) lblFace will move up (C) lblFace will move down (D) lblFace will move to the right
C
A form contains a text box named txtBox and a button named btnClip. The statement Clipboard.SetText("") is placed inside btnClip's Click event procedure. At run time, what will be placed into the Clipboard if the user enters the word "Hello" into txtBox and then clicks on btnClip? (A) the word "txtBox" (B) the word "Hello" (C) the Clipboard will be emptied of all contents (D) the word "btnClip"
C
For a scroll bar, the value of the Value property is (A) any number. (B) a number between the values of the SmallChange and LargeChange properties. (C) a number between the values of the Minimum and Maximum properties. (D) true or false.
C
Give a statement that draws a red diagonal from the upper-left corner of the picture box to the lower-right corner. (A) gr.DrawLine(Color.Red, 0, 0, picOutput.Width, picOutput.Height) (B) gr.DrawLine(Pens.Red, 0, 0, picOutput.Height, picOutput.Width) (C) gr.DrawLine(Pens.Red, 0, 0, picOutput.Width, picOutput.Height) (D) gr.DrawLine(Pens.Red, picOutput.Width, 0, 0, picOutput.Height)
C
Namespace-level variables are declared with the keyword _______. (A) Dim (B) Private (C) Public (D) Global
C
The __________ is used to specify the startup form for a program. (A) Toolbox (B) Properties window (C) Project Designer (D) Toolbar
C
The pair of statements Dim fnt As Font = New Font("Times New Roman", 12) Gr.DrawString("Hello", fnt, Brushes.Blue,10,10) displays the word Hello in 12-point Times New Roman font. T 21. What control is added to a form to enable printing of graphics? (A) Printer (B) PrintPage (C) PrintDocument (D) PrintDialog
C
To move the scroll box of a scroll bar a large distance (A) click on the scroll box. (B) click on the furthermost arrow button. (C) click on the bar between the scroll box and the furthermost arrow. (D) It can only be moved by writing code.
C
Which of the following controls has a drop down arrow and an attached text box that allows users to type selections? (A) ListBox (B) Simple ComboBox (C) DropDown ComboBox (D) DropDownList ComboBox
C
Which of the following controls is NOT used to select an item from a list? (A) List Box (B) ComboBox (C) Timer Control (D) OpenFileDialog
C
Which of the following is the default setting for a combo box's DropDownStyle property? (A) List (B) Simple (C) DropDown (D) DropDownList
C
Which of the following methods is used to load a new picture into a picture box control? (A) picBox.Picture = filespec (B) picBox.Image = filespec (C) picBox.Image = Image.FromFile(filespec) (D) picBox.Picture = LoadPicture(filespec)
C
Which of the following statements will remove all items from the list box? (A) lstBox.Items.RemoveAll (B) lstBox.Clear() (C) lstBox.Items.Clear() (D) For i As Integer = 1 to lstBox.Items.Count lstBox.Items.RemoveAt(i) Next
C
22. The correct code for replacing the selected text in txtBox with the contents of the Clipboard is: (A) txtBox.SelectedText = Clipboard.Text (B) txtBox.SelectedText = Clipboard.SetText (C) txtBox.SelectedText = Clipboard (D) txtBox.SelectedText = Clipboard.GetText
D
23. What expression should be used to generate random numbers from the set 2, 3, 4, 5, 6, 7? (Assume that the statement Dim randomNum As New Random() has been executed.) (A) randomNum.Next(2, 7) (B) randomNum.Next(1, 7) (C) randomNum.Next(1, 8) (D) randomNum.Next(2, 8)
D
A form contains a horizontal scroll bar control named hsbXpos, and the code lblFace.Left = hsbXpos.Value is placed inside the hsbXpos.Scroll event procedure (where lblFace identifies a label on the form, and the hsbXpos's Minimum and Maximum properties are set at their default values). What will happen when the hsbXpos.Scroll event is triggered by moving the scroll bar's scroll box to the right? (A) lblFace will move to the left (B) lblFace will move up (C) lblFace will move down (D) lblFace will move to the right
D
A variable that is visible to every form in a program is said to have _________ scope. (A) class-level (B) module-level (C) global (D) namespace-level
D
Give a statement that deletes all graphics and text from picOutput. (A) picOutput.Clear() (B) picOutput.Text = "" (C) picOutput.Delete() (D) picOutput.Refresh()
D
In order to begin timing with the timer control, which one of the following must be true? (A) the timer control's Name property must include the prefix tmr (B) the timer control's Interval property must be set to 1 (C) the timer control's Enabled property must be set to False (D) the timer control's Enabled property must be set to True
D
In the following exercises assume the statement Dim gr As Graphics = picOutput.CreateGraphics has been executed. 1. What is the effect of the statement gr.DrawString("Hello", Me.Font, Brushes.Blue, 50, 60)? (A) Display the word Hello in blue. (B) Display the word Hello beginning 50 pixels from the left side of the picture box. (C) Display the word Hello with the top of the word 60 pixels from the top of the picture box. (D) All of the above
D
In the following statement which term is used to designate the distance (in pixels) from the left side of the picture box to the left side of the rectangle? picBox.CreateGraphics.DrawRectangle(Pens.Blue, x, y, w, h) (A) h (B) w (C) y (D) x
D
The _________ control is used to print a form. (A) PrintDocument (B) FormPrinter (C) Print (D) PrintForm
D
The largest possible value for the Value property in a scroll bar is determined by (A) the LargeChange property. (B) the Minimum property. (C) the Value property. (D) the Maximum property.
D
Which of the following settings of a timer's Interval property will raise a timer event every 5 seconds? (A) 5 (B) 5000 (C) 5 seconds (D) 5000 milliseconds
D
Which of the following statements is true concerning the Clipboard object? (A) It is used to produce the Microsoft Help. (B) It is used to create a text file that permanently maintains copied items on the hard drive. (C) It is an object that appears on the form and is raised by its Click event. (D) It is a portion of memory that holds information and has no properties or events.
D