Loading

[NEW SOLN] CSIS 208 FINAL EXAM

[SOLVED]CSIS 208 FINAL EXAM: QUESTION 1

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?

1picBox.CreateGraphics.DrawRectangle(Pens.Blue, x, y, w, h)

 h
 w
 y
 x

QUESTION 2

What numbers will be displayed in the list box when the button is clicked?

1234567Private Sub btnDisplay_Click(...) Handles btnDisplay.ClickDim numasDouble = 10Do While num > 1  lstBox.Items.Add(num)  num = num - 3LoopEndSub

 10, 7, and 4
 10, 7, 4, and 1
 10, 7, 4, 1, and -2
 No output

QUESTION 3

What is the value of (“12/15/09”).Substring(3,2)?
 /15
 15
 /15/
 12/15/09

QUESTION 4

What colleges are displayed in the list box by the following program segment?

12345678Dim ivies() As String = {"Harvard","Princeton","Yale","Dartmouth","Brown","Columbia","Univ. of PA","Cornell"}Dim query = From college in ivies            Where college.Length <= 9            Order By college.Length Descending, college Descending            Select collegelstBox.Items.Add(query.Last)lstBox.Items.Add(query.Min)

 Dartmouth and Princeton
 Yale and Brown
 Yale and Cornell
 Dartmouth and Yale

QUESTION 5

How many lines of output are produced by the following program segment?

1234567For i As Integer = 1 To 3  For j As Integer = 1 To 3    For k As Integer = i to j      lstBox.Items.Add("Programming is fun.")    Next  NextNext

 8
 9
 10
 11

QUESTION 6

Which of the properties in a control’s list of properties is used to give the control a meaningful name?
 Text
 ContextMenu
 ControlName
 Name

QUESTION 7

What is the correct syntax for displaying the value of the String variable myString in a text box?
 txtBox.Text = “myString”
 txtBox.Text = myString
 txtBox.Text.myString
 txtBox.Text = Str(myString)

QUESTION 8

What will be displayed when the following lines are executed?

12345Dim x As Double = 3, y As Double = 1>Dim z As Doublez = x + (y * x)x = yz = x + z lstBox.Items.Add(x + y + z)

 4
 9
 10
 None of the above

QUESTION 9

Which statement will display the words “Hello World” in a text box?
 txtBox.Text = Hello & World
 txtBox.Text = “Hello ” & World
 txtBox.Text = Hello & ” World”
 txtBox.Text = “Hello” & ” World”

QUESTION 10

The ______________ of a Sub procedure are vehicles for passing numbers and strings to the Sub procedure.
 calling statements
 arguments
 parameters
 variables declared inside

QUESTION 11

In Visual Basic, tooltips assist by showing a small caption about the purpose of each icon on the Toolbar. How do you make a tooltip appear?
 Right click the Toolbar icon and select purpose from the available options.
 Position the mouse pointer over the icon for a few seconds.
 Hold down a shift key, then click the appropriate Toolbar icon to display its purpose.
 Hold down the Alt key, then click the appropriate Toolbar icon to display its purpose.

QUESTION 12

The default event procedure for a list box is _______
 SelectedIndexChanged
 Click
 CheckedChanged
 IndexChanged

QUESTION 13

The Count method returns what information about an array?
 The highest number that can be used as a subscript for the array.
 The largest value that can be assigned to an array element.
 The number of elements in the array.
 The highest dimension of the array.

QUESTION 14

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?
 lblFace will move to the left
 lblFace will move up
 lblFace will move down
 lblFace will move to the right

QUESTION 15

When the odd numbers are added successively, any finite sum will be a perfect square (e.g., 1 + 3 + 5 = 9 and 9 = 3^2). What change must be made in the following program to correctly demonstrate this fact for the first few odd numbers?

1234567891011Private Sub btnDisplay_Click(...) Handles btnDisplay.ClickDim oddNumber As IntegerDim sum As Integer = 0For i As Integer = 1 To 9 Step 2 'Generate first few odd numbers  oddNumber = i  For j As Integer = 1 To oddNumber Step 2 'Add odd numbers    sum += j  Next  lstBox.Items.Add(sum &" is a perfect square.")NextEndSub

 Change the Step size to 1 in the first For statement.
 Move oddNumber = i inside the second For loop.
 Reset sum to zero immediately before the second Next statement.
 Reset sum to zero immediately before the first Next statement.

QUESTION 16

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?
 ToolTip
 Message
 ToolTip on ToolTip1
 ToolTipMessage

QUESTION 17

Which of the following is a valid statement in Visual Basic?
 Form1.Text = “Revenue”
 Form1.Caption = “Revenue”
 btnButton.Text = Push Me
 Me.Text = “Revenue”

QUESTION 18

Which statement is true?
 “Ford“ < “Ford“  “Chevy” > “Chevy”
 “GMC” <= “GMC”  “oldsmobile” < “Oldsmobile”

QUESTION 19

What will be the output of the following lines?

1234Dim alphabet, soup As Stringalphabet ="abcdefghijklmnopqrstuvwxyz"soup = alphabet.ToUppertxtBox.Text = alphabet.Substring(0, 5) & soup.Substring(0, 5)

 abcdeABCDE
 ABCDEABCDE
 eE
 EE

QUESTION 20

What control causes a binding navigator toolbar to appear anchored to the top of the form?
 BindingNavigator
 NavigatorToolbar
 Navigator
 BindingToolbar

QUESTION 21

In analyzing the solution to a program, you conclude that you want to construct a loop so that the loop terminates either when (a < 12) or when (b = 16). Using a Do loop, the test condition should be
 Do While (a > 12) Or (b <> 16)
 Do While (a >= 12) Or (b <> 16)
 Do While (a < 12) Or (b <> 16)
 Do While (a >= 12) And (b <> 16)
 Do While (a < 12) And (b = 16)

QUESTION 22

Assuming the following statement, what is the For…Next loop’s counter variable?

1For yr As Integer = 1 To 5

 1
 5
 To
 yr

QUESTION 23

Which of the following logical structures should not be used in structured programming?
 Sequence
 Selection
 Looping (iteration)
 Unconditional branching

QUESTION 24

A list box named lstBox has its Sorted property set to False and contains the three items Cat, Dog, and Gnu in its list. If the word Elephant is added to the list at run time, what will be its index value?
 2
 1
 3
 0

QUESTION 25

Which of the following is not a main type of event that can be raised by user selections of items in a list box?
 Click event
 SelectedIndexChanged event
 FillDown event
 DoubleClick event

QUESTION 26

What elements are in the array newArray after the following code is executed?

123Dim firstArray() As Integer = {1, 2, 3}Dim secondArray() As Integer = {3, 4, 5, 6}Dim newArray() As Integer = firstArray.Union(secondArray).ToArray

 1, 2, 3, 3, 4, 5, 6
 1, 2, 3, 4, 5, 6
 3
 1, 2

QUESTION 27

Which of the following statements is used when you want to add data to the end of an existing text file?
 Dim sr As IO.StreamReader = IO.File.OpenText(“Data.txt”)
 Dim sr As IO.StreamReader = IO.File.AddText(“Data.txt”)
 Dim sw As IO.StreamWriter = IO.File.CreateText(“Data.txt”)
 Dim sw As IO.StreamReader = IO.File.AppendText(“Data.txt”)

QUESTION 28

For a scroll bar, the value of the Value property is
 any number
 a number between the values of the SmallChange and LargeChange properties
 a number between the values of the Minimum and Maximum properties
 true or false

QUESTION 29

What is one drawback in using non-integer Step sizes?
 Round-off errors may cause unpredictable results.
 Decimal Step sizes are invalid in Visual Basic.
 A decimal Step size is never needed.
 Decimal Step sizes usually produce infinite loops.

QUESTION 30

The code in a Try block refers to a file and the first catch block is written as follows:

1Catch exc As IO.IOException

The second catch block is written with the following clause:

1Catch

What type of exception will this second Catch block handle?
 any exception that hasn’t already been handled
 an exception generated by deleting or renaming an open file
 this block isn’t designed to catch any exceptions
 this block will catch all cases where the file specified by fileName does exist

QUESTION 31

The Description pane, located below the Properties windows, shows a brief explanation of the highlighted property.
 True
 False

QUESTION 32

A class-level variable declared in one form can be accessed by other forms if it is declared with the keyword Public.
 True
 False

QUESTION 33

The following lines of code are correct.

123If age >= 13 And < 20 Then  txtOutput.Text ="You are a teenager."EndIf

 True
 False

QUESTION 34

Debugging an unstructured program often requires the programmer to look at the entire program in order to make even a simple modification.
 True
 False

QUESTION 35

Get property procedures are used to retrieve values of member variables.
 True
 False

QUESTION 36

Keywords are also referred to as reserved words.
 True
 False

QUESTION 37

Like other variables, array variables can be declared and assigned initial values at the same time.
 True
 False

QUESTION 38

The value of cboBox.Text is the currently highlighted item.
 True
 False

QUESTION 39

The number of items in cboBox is cboBox.Items.Count.
 True
 False

QUESTION 40

When starting a new program, it is best to start writing code as soon as possible to avoid wasting time thinking about it.
 True
 False

QUESTION 41

The Substring method is used to extract a portion of a string.
 True
 False

QUESTION 42

One may use a Select Case block within another Select Case block.
 True
 False

QUESTION 43

Inheritance does not enhance code reusability.
 True
 False

QUESTION 44

End tags always begin with a less than symbol followed by a forward slash.
 True
 False

QUESTION 45

In a Simple combo box, the list is always visible.
 True
 False

QUESTION 46

If the initial value is greater than the terminating value in a For…Next loop, the statements within are still executed one time.
 True
 False

QUESTION 47

When an If block has completed execution, the program instruction immediately following the If block is executed.
 True
 False

QUESTION 48

No more than one ElseIf statement may occur in any one If block.
 True
 False

QUESTION 49

Clicking on a checked check box unchecks the check box.
 True
 False

QUESTION 50

Two instances of the same class may exist in a single program.
 True
 False

Support