What you want to see on DotNetFunda.com ?
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 64517 |  Welcome, Guest!   Register  Login
 Home > Interview Questions > VB.NET Interview Questions

Now you don't need go anywhere to get the best interview questions on Microsoft technology. We are trying to gather all real interview questions asked from MNCs and put them here. You can also assist us in doing so by submitting .net interview questions. These questions are generally different from certification questions however it may help you in that too.



Page copy protected against web site content infringement by Copyscape
In the code example below, the function “FindData” will return list(“sublist”) of the objects having matchingKey same as viewstate value.

Dim sublist As List(Of MyClass)

sublist = allClient.FindAll(AddressOf FindData) ‘sublist will contain objects matching specified matching condition

Function FindData(ByVal b As MyClass) _
As Boolean
If (b.matchingKey = CInt(ViewState("matchingKey "))) Then ‘matching condition
Return True
Else
Return False
End If
End Function

To deal with such scenario, you can find “ParameterDirection.ReturnValue”.
You can use this parameter direction to read the return value of the stored procedure.
Following example can make it more clearer.
In case, you have following or similar type of return statement somewhere in your stored procedure.
Return -999

To read this value, following code works,
Dim result As Integer = 0

Dim retValParam As New SqlClient.SqlParameter("@RETURN_VALUE", SqlDbType.Int)
retValParam.Direction = ParameterDirection.ReturnValue
dbCommand.Parameters.Add(retValParam)
database.ExecuteNonQuery(dbCommand)
result = retValParam.Value ‘ here the result must contain the returned value. In this case, it will be -999


Thanks,
Bhakti Shah

The default size of Integer data type is 32 bit.

NOTE: This is objective type question, Please click question title for correct answer.

Label1.Font.Size = 12
Label1.Font.Name = "Broadway"

With some scenarios you need to assign width to the controls rubtime. Generally we tend to make it soecified with percentage. At runtime we can use following way to make such assignments.

Label1.Width = Unit.Percentage(12.12)


You can have “pixel” or “point” as measurement unit and get your desired result set.

Sometimes, you need to bind data using ternary functions from code file. With VB, you can achieve this thing using IIF function.

For an example, here in code below at the time of databinding I need to check value of “testString”. If the value is null/empty string it shows “NA” else the value.

<%#IIf(String.IsNullOrEmpty(DataBinder.Eval(Container.DataItem, "testString")), "NA", DataBinder.Eval(Container.DataItem, " testString "))%>



You can achieve the same result from code behind by placing appropriate code in itemdatabound method.(if applicable)

NOTE: This is objective type question, Please click question title for correct answer.

Option Strict

Option Explicit

Fix is a function available in VB, which returns integer part of the number.

Both of them returns integer part of the provided number. Difference lies, how they deal with the negative numbers.
Fix returns the first negative integer greater than or equal to provided Number while Int returns the first negative integer less than or equal to provided Number.
For an example,
Int(-99.2)  ' Returns -100.

Fix(-99.2) ' Returns -99.

"Test..Bore..gHere"
Justification : here we have used is MID statement not the MID function.

Mid function returns the characters while the Mid statement replaces the characters.

Said both performs the same type of operation on string. The basic difference lies, how they indice the string characters.

In case, if you have got string "TEST", the MID function will indice the characters as 1,2,3,4. But with String.substring they will be indiced as 0,1,2,3.

Found this useful, bookmark this page link to the blog or social networking websites. Page copy protected against web site content infringement by Copyscape
Navigate to Page: 1 | 2 | 3 | 4 |

 More Exclusive VB.NET Interview Questions and Answers here


Found interesting? Add this to:


About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/23/2013 9:15:31 AM