I had to take a VB.NET test today for an employer. This question was included.
If you run the code below what will the value of label1.Text
My answer was "i = infinity" but was told I was wrong. Can someone explain how I am wrong? They told me the correct answer is "i = undefined". I think they caught themselves in their own trick question.Code:Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim i As Double Dim s As String Try s = "i = " i = 1 / 0 s = s & "infinity" Catch s = s & "undefined" Finally label1.Text = s End Try End Sub




Reply With Quote