Visual Basic Prospective Employee Knowledge Assessment

I found somewhere on the internet an excellent list of questions which you could give to somebody to test their knowledge of Visual Basic 6.

I have tried to find these questions again but have so far been unable.

Can anybody suggest anything?  I need 2 tests one for VB6 and one for VB.NET.

Thanks in advance.
LVL 17
Who is Participating?

Improve company productivity with a Business Account.Sign Up

VBClassicGuyConnect With a Mentor Commented:
For VB6, how about:

1. When creating a table for use with either SQL Server or Access, the data types Single and YesNo for Jet need to be declared as what for SQL? REAL and BIT.

2. What method is called right before a form unloads? FORM_QUERYUNLOAD

3. To empty out a database table but keep the table, should you use the Drop or Delete statement? DELETE

4. Which uses less memory, the PictureBox or Image control? IMAGE

5. Without API calls or special coding, how do you display a PNG picture using standard VB6 controls? YOU CAN'T

6. The value of False is zero. What is the value of True? -1

7. If you insert the text of "1" through "10" into a sorted ListBox, what will the results look like in the ListBox? 1, 10, 2, 3, 4, 5, 6, 7, 8, 9

8. How do you correct the above situation? PAD VALUES WITH LEADING ZEROES SO ALL TEXT IS THE SAME LENGTH

9. Using the default settings of a Label, what will the text "Love & Marriage" look like? LOVE _MARRIAGE

10. What two ways to correct the above situation? USE TWO AMPERSANDS, OR SET THE UseMnemonic PROPERTY TO FALSE
aikimarkConnect With a Mentor Commented:
I'm a big fan of "what's wrong with this code" challenges.  Look at this old EE question:

The questions you ask should be a good indicator of the type of work to be done and expertise level for which you are hiring.  For instance, if this job will be database intensive, you should ask more database questions.

If you this job will be maintaining old code, you should ask questions about the type of code actually found in your system (classes, forms, objects, API calls, etc.)
Building an Effective Phishing Protection Program

Join Director of Product Management Todd OBoyle on April 26th as he covers the key elements of a phishing protection program. Whether you’re an old hat at phishing education or considering starting a program -- we'll discuss critical components that should be in any program.

"what's wrong with this code" :)

>>data types Single and YesNo for Jet need to be declared as what for SQL? REAL and BIT<<
Number (FieldSize =Single) -> SINGLE (Synonyms: FLOAT4, IEEESINGLE, REAL)

>>What method is called right before a form unloads? FORM_QUERYUNLOAD<<
FORM_QUERYUNLOAD is an EVENT, not METHOD. Furthermore, following code won't fire QueryUnload and Unload events though Unload METHOD was called:
   Dim f As New Form2
   Unload f

>>To empty out a database table but keep the table, should you use the Drop or Delete statement? DELETE<<
Why TRUNCATE is missing? It's much faster and resets autonumber fields as well.

>>Without API calls or special coding, how do you display a PNG picture using standard VB6 controls? YOU CAN'T<<
WebBrowser1.Navigate "yourimage.png"

inthedarkAuthor Commented:
Thanks for your help so far.... we interviewed 2 people so far and neither could do the first question; do you thing it was too hard?


Background information: In the UK the calculation of VAT is based on the following formula:

VATTotal = GoodsValue * VatRatePercentage /100

The Vat is always rounded to 2 decimal places. So the invoice total is calculated by adding the Goods and VAT:

InvoiceTotal = GoodsValue + VATTotal

Employees give an accountant their expenses which only include amounts including VAT.  The VB programmer needs to write a program to calculate the Goods and VAT values from the invoice total.  The programmer created 2 textboxes one for the entry of an invoice total and one for a VAT rate percentage.  A display button to calculate and display the goods and vat values was also added.

You need to fill in the missing lines so that the goods and VAT values are correctly calculated. Calculate the goods value first.

Private Sub cmdDisplay_Click()

Dim curInvoiceTotal As Currency
Dim curVATRate As Currency
Dim curGoods As Currency
Dim curVAT As Currency
Dim sResult As String

' get the invoicetotal from the textbox
curInvoiceTotal = CCur(txtInvoiceTotal)

' get the vat rate percentage
curVATRate = CCur(txtVATRate)

' ** Fill in the missing code

curGoods =

curVAT =

' Display the result
sResult = "Goods Value: " + Format(curGoods, "0.00") + vbCrLf
sResult = sResult + "VAT Value: " + Format(curVAT, "0.00")

MsgBox sResult, vbInformation, "Goods & VAT Calculator"

End Sub
inthedarkAuthor Commented:
For your interest the next 2 questions which nobody could answer..........were these too hard as well?

2) Hex Notation

In the following code:

Dim lMyLong As Long

lMyLong = &H1234
lMyLong = lMyLong / &H100
MsgBox "lMyLong=" + Hex(lMyLong)

What would the message box display?

3) RGB Colours

Screen colours are represented by long value which can be generated by the RGB(Red,Green,Blue) function.

For example RGB(16,17,18) will create a long hex value of &H121110.

Add the missing lines so that you can get the Red, Green & Blue values from a long colour.

Dim sResult As String
Dim lRed As Long
Dim lBlue As Long
Dim lGreen As Long
Dim lColour As Long

lColour = 1184016

lBlue = lColour/&H10000

' ** complete the missing code

lGreen =

lRed =

sResult = "Red: " + CStr(lRed) + vbCrLf
sResult = sResult + "Green: " + CStr(lGreen) + vbCrLf
sResult = sResult + "Blue: " + CStr(lBlue)
MsgBox sResult, vbInformation, "Red Green Blue Values"

I don't think are too hard, but it depends on the level of developer you are looking for and type of code they will be maintaining/developing.
Martin LissOlder than dirtCommented:
Rather than asking specific questions (which will probably either insult or stump him/her) you'd probably be better off trying to determine how they go about solving problems. For example I'd rather hire someone who says that he would go to Experts Exchange or VBForums if he can't figure out how to do something after giving it a reasonable amount of time on his own rather than spending days of his (and the company's) time on it. I would also ask him how he goes about solving problems and if he is familiar with Debug. I'd also contact his references early on to get a idea of how he performed there.
ArkConnect With a Mentor Commented:
These questions have nothing to do with programming (and VB6 in particular). They require basic school math skills. Whom are you looking for? Coders? Remove these questions and stay with VB6 syntax knowledge. Developers? Remove all explanations like "calculation of VAT is based on the following formula...", "Screen colours are represented by long value..." and code - leave the task: "Calculate and display Goods and VAT values for UK knowing Invoice total and VAT rate" and examine final code. For example your first question's answer can be:
For curGoods=0 To 1000000
     For curVAT=0 to 1000000 Step 0.01
           If curGoods + curVAT = curInvoiceTotal Then
               If  curVAT = curGoods * curVATRate/100 Then Exit For
            End If

Open in new window

Do you like it?
A classic "what's wrong with this code" case is updating a database on a record-by-record basis or coordinating two recordsets instead of doing a table join.
inthedarkAuthor Commented:
Thanks for the help. I used suggestions from all of you in the final thing.  Thanks for the humour Ark.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.