Solved

Visual Basic Prospective Employee Knowledge Assessment

Posted on 2011-09-02
11
463 Views
Last Modified: 2012-05-12
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.
0
Comment
Question by:inthedark
  • 3
  • 3
  • 2
  • +2
11 Comments
 
LVL 14

Assisted Solution

by:VBClassicGuy
VBClassicGuy earned 100 total points
Comment Utility
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
0
 
LVL 45

Accepted Solution

by:
Martin Liss earned 200 total points
Comment Utility
0
 
LVL 45

Assisted Solution

by:aikimark
aikimark earned 100 total points
Comment Utility
I'm a big fan of "what's wrong with this code" challenges.  Look at this old EE question:
http:/Q_21013971.html

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.)
0
 
LVL 27

Expert Comment

by:Ark
Comment Utility
"what's wrong with this code" :)

>>data types Single and YesNo for Jet need to be declared as what for SQL? REAL and BIT<<
Yes/No -> BOOLEAN (Synonyms: BIT, LOGICAL, LOGICAL1, YESNO)
Number (FieldSize =Single) -> SINGLE (Synonyms: FLOAT4, IEEESINGLE, REAL)
See http://msdn.microsoft.com/en-us/library/aa211091(v=office.11).aspx

>>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"



0
 
LVL 17

Author Comment

by:inthedark
Comment Utility
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?

1) UK VAT

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
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 17

Author Comment

by:inthedark
Comment Utility
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"


0
 
LVL 45

Expert Comment

by:aikimark
Comment Utility
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.
0
 
LVL 45

Expert Comment

by:Martin Liss
Comment Utility
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.
0
 
LVL 27

Assisted Solution

by:Ark
Ark earned 100 total points
Comment Utility
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
     Next
Next

Open in new window

Do you like it?
0
 
LVL 45

Expert Comment

by:aikimark
Comment Utility
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.
0
 
LVL 17

Author Closing Comment

by:inthedark
Comment Utility
Thanks for the help. I used suggestions from all of you in the final thing.  Thanks for the humour Ark.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
How can you create a game plan that lets you focus on special projects instead of running from cubicle to cubicle every day and feeling like you’ve accomplished nothing? Try these strategies for prioritizing your tasks, offloading what you can, and …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now