blogjava's web log

blogjava's web log
...

面试题.net的


A) In VB.Net, what is the method that is available without creating the instance of the class

· 1. Instance method
· 2. overloading method
· 3. Shared method
· 4. class methods

Ans:   3   

B) In VB.Net, what is finalise method and what are the role of it?
· 1. Release object memory
· 2. Release memory
· 3. it calls when page is closed

Ans:    1  

C) In VB.Net, passing an array using ByRef or ByVal makes a difference if you use a ReDim statement inside the called procedure.  Which array size will be affected ?
· 1. an array passed by ByVal
· 2. an array passed by ByRef
· 3. both affected
· 4. none affected

Ans:     3

D) In VB.Net, ParamArray arguments are passed by in a function?
· 1. Always by value
· 2. Always by reference
· 3. both
· 4. none

Ans:   2   

E) How are parameters referenced by default in VB.Net?
· 1. ByObject
· 2. ByVal
· 3. ByRef
· 4. None

Ans:    2  

F) Does ISDBNull() exsist in VB.Net?
Select Answer:
· 1. True              2. False

Ans:   1   

G) In VB.Net, constructor is always
· 1. sub new()
· 2. constructor()
· 3. base class()
· 4. the class name itself

Ans:    1  

H) In VB.NET, what is used to join strings
· 1. Plus sign
· 2. Ampersand
· 3. both

Ans:    3  

 

I) In Java, which statements ARE true?

1.       When a thread sleeps, its locks are released

2.       If a class has synchronized code, multiple threads can still access the non synchronized code.

3.       Methods and variables can be protected from concurrent access problems by marking them with the synchronized keyword.

4.       When a thread invokes wait(), its locks are released.

5.       A static method cannot be synchronized

Ans:     2

 

J) Which TWO combinations below consist (and only) the necessary classes in package java.io to read a single line of Traditional Chinese text via TCP connections?

  I. Socket

  II. TCPSocket

  III. PipedInputStream

  IV. BufferedInputStream

  V. BufferedReader

  VI. InputStreamReader

  VII. LineNumberReader

  VIII. StringReader

 

1.       (I) + (III) + (VI) + (VII)

2.       (I) + (IV) + (VI) + (V)

3.       (II) + (VI) + (VII)

4.       (I) + (IV) + (VI) + (VII)

5.       (I) + (VI) + (VIII)

Ans:    2  


 

Question 1

 

The VB function, GetCurrencyCode demonstrates the translation between the currency code and currency number.  However, the performance of this function is not good enough; the higher order of input number takes much more times to calculate.  Please suggest a way to improve the program performance:

 

Function GetCurrencyCode(ByVal input As String) As String

If input = "01" Then

return = "AFA"

ElseIf input = "02" Then

return = "ALL"

ElseIf input = "03" Then

return = "DZD"

ElseIf input = "04" Then

return = "USD"

ElseIf input = "05" Then

return = "HKD"

ElseIf input = "75" Then

return = "EUR"

ElseIf input = "76" Then

return = "XCD"

ElseIf input = "77" Then

return = "AMD"

End If

End Function

 

Answer:

 


Question 2

 

Write a function that reverses the order of the words in a string. For instance, your function should transform the string “Do or do not, there is no try.” To “try. No is there not, do or Do”. Assume that all words are space delimited and treat punctuation the same as letters.

 

Use your most hands-on programming language.

 

Answer:

 


Question 3

 

Study the following VB program:

 

Imports System

Imports System.IO

Module Module1

Public ArtList As ArrayList

End Module

 

Public Class Form1

Inherits System.Windows.Forms.Form

 

#Region " Windows Form Designer generated code "

#EndRegion

 

<[Serializable]()> PublicClass Art

Public Title AsString

Public Des AsString

Public Value AsInteger

Public Price AsDouble

Public Picture AsString

End Class

 

Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim myArt AsNewObject

Dim hashtable AsNew Collections.Hashtable

Dim key AsString

 

Try

myArt = New Art

With myArt

.Title = "Title"

.Des = "Desc"

.Value = 123

.Price = 321.05

End With

key = myArt.Title & myArt.Des & CStr(myArt.Value) & CStr(myArt.Price)

hashtable.Add(key, myArt)

ArtList.Add(myArt)

 

Catch ex As Exception 'This is the line 94’

MsgBox(ex.Message & vbCrLf & ex.StackTrace)

End Try

End Sub

End Class

A form is created on which a button control is placed.  When the Button1_Click is fired, a message box is popup:

 (图片未上传)

 

What is the problem and how to fix it?

 

Answer:

 


Question 4

 

In the following VB program, please states any potential problem(s) and how to correct.

 

Private Sub btnCalc_Click( )

Dim result As Integer

Try

Me.Cursor = Windows.Forms.Cursors.WaitCursor

result = Convert.ToInt32(txtInput1.Text) / Convert.ToInt32(txtInput2.Text)

txtResult.Text = result

Me.Cursor = Windows.Forms.Cursors.Default

Catch ex As Exception

MsgBox(ex.StackTrace)

Catch ex As ArgumentNullException

MsgBox("Input Test box cannot be null.")

Catch ex As OverflowException

MsgBox("Input Test box 2 cannot be zero!")

Catch ex As FormatException

MsgBox("Input Test box should be numeric format!")

End Try

End Sub

 

Answer:

 


Question 5

 

GetRecordset() is a VB function that returns a ADODB.Recordset object:

 

      

Ref_ID

Qty

Price

Row 0

00123

1000

60.50

Row 1

00123

2000

60.00

Row 2

00123

3500

59.50

Row 3

00124

3000

60.50

Row 4

00125

2000

59.50

Row 5

00125

1000

58.00

 

 (This recordset is sorted by Ref_ID)

 

The following program

 

Dim rst as ADODB.Recordset

Rst = GetRecordset

Do While Not rst.EOF

Console.writeline(rst.Fields("Ref_ID") & vbcrlf & rst.Fields(" Qty ") & vbcrlf & rst.Fields(" Price "))

rst.MoveNext()

Loop

 

Can generate the following output:

 

Output:

 

00123 1000 60.50

00123 2000 60.00

00123 3500 59.50

00124 3000 60.50

00125 2000 59.50

00125 1000 58.00

 

Please suggest how to modify the above program to generate the following output:

 

Output:

00123

1000           60.50

2000           60.00

3500            59.50

----             -----

6500            60.00

00124

3000            60.50

----             -----

3000           60.50

00125

2000            59.50

1000            58.00

----             -----

3000            58.75

 

 

Answer:

 


Question 6

 

Problem: Use your most hands-on programming language to implement a function that prints all possible combinations of the characters in a string. These combinations range in length from one to the length of the string. Two combinations that differ only in ordering of the characters ARE the same combination.  In other words, “12” and “31” are different combinations from the input string “123”, but “21 is the same as “12”.

 

For example, if we use “wxyz” as parameter for Combination(“wxyz”) the function will print out

 

w

x

y

z

wx

wy

wz

xy

xz

yz

wxy

wxz

wyz

xyz

wxyz

 

Answer:

 


Question 7

 

Module modFree

#Region "clsShape"

Public Class clsShape

Private m_Area As Double

Private m_Sides As Integer

 

Public Sub New()

m_Area = 0.0

m_Sides = 0

End Sub

 

Public Sub New(ByVal Sides As Integer)

m_Sides = Sides

End Sub

 

Public Sub New(ByVal Area As Double)

m_Area = Area

End Sub

 

Public Sub New(ByVal Area As Double, ByVal Sides As Integer)

m_Area = Area

m_Sides = Sides

End Sub

 

Public Property Area() As Double

Get

Return m_Area

End Get

Set(ByVal Value As Double)

m_Area = Value

End Set

End Property

 

Public Property Sides() As Integer

Get

Return m_Sides

End Get

Set(ByVal Value As Integer)

m_Sides = Value

End Set

End Property

End Class

#End Region

 

 

#Region "clsTriangle"

Public Class clsTriangle

Inherits clsShape

 

Public Sub New()

MyBase.New(3)

End Sub

 

Public Sub New(ByVal Area As Double)

MyBase.New(Area, 3)

End Sub

 

Public Function CalculateArea(ByVal SideBase As Double, ByVal Height As Double, _ Optional ByVal AssignToArea As Boolean = False) As Double

Dim Area As Double = (SideBase * Height) / 2

 

If AssignToArea Then

Me.Area = Area

End If

 

Return Area

End Function

End Class

#End Region

 

Public Sub Main()

Dim objTriangle As New clsTriangle

Dim objShape As New clsShape

 

objTriangle.Area = -330

objTriangle.Sides = 5.5

objTriangle.CalculateArea(10.0, 2.5)

 

objShape.Area = 123

objShape.Sides = -2

objShape = CType(objShape, clsTriangle)

 

Console.WriteLine(TypeOf objTriangle Is clsShape)

Console.WriteLine(TypeOf objShape Is clsTriangle)

Console.WriteLine(objTriangle.Area)

End Sub

End Module

 

7.1 Please find the line of code from the procedure Main to cause run-time error.

 

Answer:

 

7.2 Please write the result output from the procedure Main.

 

Answer:

 


Question 8

 

Consider the following account and customer tables:

 

cust_tbl

cust_id

title

e_first_name

e_last_name

address1

.

0

MR

Martin

Ma

.

 

1

MR

Kirs

Cheung

.

 

2

MR

Ricky

Chan

.

 

3

MR

Tom

Kwan

.

 

4

MR

Corporate Default

Corporate Default

.

 

5

MRS

Mary

Mok

.

 

.

.

.

.

.

 

 

acc_grp_cust_tbl

acc_group

Cust_id1

Cust_id2

Cust_id3

Cust_id4

1400

0

1

2

 

1500

3

4

 

 

1600

5

 

 

 

.

.

.

.

.

.

.

.

.

.

 

The acc_grp_cust_tbl table is responsible to store the customer ID, and the cust_tbl table is responsible to store customer personal information such as name, address, etc… Please write a SQL query in order to provide following result.

 

ACC_GROUP

PAYEENAMES

1400

Ma Martin/Cheung Kris/Chan Ricky

1500

Kwan Tom/Corporate Default Corporate Default

1600

Mok Mary

.

.

.

.

 

Answer:

 


posted on 2006-06-04 11:37 record java and net 阅读(1417) 评论(3)  编辑  收藏 所属分类: dot net相关

评论

# re: 第一轮面试题,搞.net的 2006-07-17 12:01 牛哥

呵呵!有同感啊!我直接放弃了!不想去了,想想以后还要去做VB。NET  回复  更多评论   

# re: 第一轮面试题,搞.net的 2006-08-30 21:40

第一题就答错了,和java一样是类方法!  回复  更多评论   

# re: 第一轮面试题,搞.net的 2006-08-31 09:05 junmy

A) In VB.Net, what is the method that is available without creating the instance of the class
· 1. Instance method
· 2. overloading method
· 3. Shared method
· 4. class methods

这 个是类方法???


老兄 你也太强了吧.

3. Shared method 应该没有错吧.
  回复  更多评论   


只有注册用户登录后才能发表评论。


网站导航:
 

导航

常用链接

留言簿(44)

新闻档案

2.动态语言

3.工具箱

9.文档教程

友情链接

搜索

最新评论