The interview “FizzBuzz” test

Interviewers have an interesting habit of using peculiar test questions to see if software developers actually know how to write code. Simply put, honesty comes before all else – if you desire to know about a candidate’s knowledge, why not ask the candidate? Sure, a candidate could lie – though not all candidates are liars. Some of us may not have the most experience on paper but have been writing code for many years. It is indeed demeaning to ask the simplest of questions during an interview – has a candidate ever asked a hiring manager to prove their capabilities as a manager? If they did, how many candidates would be hired if they proceeded to ask the most-elementary of questions?

The point is: If you are going to ask a question in an interview, it should be based on trust. Trust that if the candidate listed C# that they may have reasonable familiarity with it. Ask questions that can actually gauge the candidate’s grasp of the languages. Your company needs someone with .NET skills? Here are some nice simple questions: What can you tell me about inheritance in C# or VB.NET, and when should it be used? Or, something simple like: When’s a good time to use the StringBuilder class?

During an interview the focus should be on forming a bond between the candidate and company to determine if it is a good fit. Candidates are often stressed during interviews and this shouldn’t be held against them – remember, the primary cause of the stress may be that they really desire to be a part of your company and help achieve your goals. As anyone knows, many people that are fully qualified for a position are interviewed and never hear back from the company. This is a great stressor to some individuals.

Here is the “FizzBuzz” test in C#. Yes, there are many ways to solve it. Why did I chose THIS method? While non-multiples are the most common, they are our “default” output – therefore we must test our conditions before outputting the number. In the first example we test for a Mod 3 first because it is the most common of our criteria. If it meets the Mod 3 criteria we test for Mod 5 in case we’ve come across a “FizzBuzz” number. Yes, this means every Mod 3 is hit with a Mod 5 check – If we decided to check for a Mod 5 first we would take a bigger performance hit since there are less Mod 5’s than Mod 3’s. If we test for Mod 3 AND Mod 5 we waste cpu cycles since everything would be tested. Hence, test the Mod 3 numbers for Mod 5. ie: If it’s a Mod 3 it could be a Mod 5; but if it’s not a Mod 3 we only test to see if it is a Mod 5 from there.

Surely there is probably a slightly more efficient way to do this – just as you can swap two integer variables with the Xor trick, or swap two Strings without a temp, though of course you already knew how to do that! Hint: In .NET or VisualBasic 6 use the Left, Right, and Length functions. However, remember that while you are avoiding the creation of a new variable you are using a LOT more clock cycles to perform the “gimmick”! ..Not to mention that you will make your code significantly less human-intelligible.



            for (int i = 1; i <= 100; i++)
            {
                 if (i % 3 == 0)
                {
                    if (i % 5 == 0)
                    {
                        Debug.WriteLine("FizzBuzz");
                    }
                    else
                    {
                        Debug.WriteLine("Fizz");
                    }
                }
                else if (i % 5 == 0)
                {
                    Debug.WriteLine("Buzz");
                }
                else
                {
                    Debug.WriteLine(i.ToString());
                }
            }

Or, more fun - though the implementation choice really depends on several factors:


            string strTemp = "";

            for (int i = 1; i <= 100; i++)
            {
                if (i % 3 == 0)
                {
                    if (i % 5 == 0)
                    {
                        strTemp = "FizzBuzz";
                    }
                    else
                    {
                        strTemp = "Fizz";
                    }
                }
                else if (i % 5 == 0)
                {
                    strTemp = "Buzz";
                }
                else
                {
                    strTemp = i.ToString();
                }
                Debug.WriteLine(strTemp);
            }

Bear in mind that this code writes to the output window - if you do not have the Output windows in view you will not see any output from this code.

Just a head's up: If you came to the page in search of the answer to this question, well, you need to get in front of an IDE more often and write the code. Why an IDE? Many IDE's can tell you what you are doing wrong as you type your code. I started writing code on Visual Basic 3.0 and even THAT could tell you that what you just typed was full of errors! It was a great learning tool since rather than put little squiggly-lines under the code it would throw a MessageBox in your face and yell at you - complete with the Windows95 "Alert" .wav sound. A nice little punishment for your errors that taught you quickly.

David R. Betournay

How to bring the Quick Launch bar back in Windows 7 & 8

Windows Quick Launch Bar

When Microsoft released Windows 7, a new feature that allowed users to “pin” programs and folders to the taskbar was added. However, the Quick Launch bar – which dates back to the Internet Explorer 4.0 Desktop Update for Windows 95 – was seemingly removed.

Luckily, the Quick Launch functionality still exists in Windows 7 and Windows 8 – though there are a few quick and easy steps that are necessary to get it back:

1. You will need to have access to an account on the computer that will allow you to change folder options, as you will need to be able to view Hidden files.

2. Open a File Folder – such as My Computer – and if the Menu Bar is visible at the top of the window, simply click on the Tools menu and select the Folder Options… choice. If the menu bar is not visible, you will need to click on the Organize button, then go into Layout, and select Menu Bar before proceeding.

3. Select the View tab at the top of the window, and set the Hidden files and folders option to “Show hidden files, folders, and drives.”

4. Right-click on an un-occupied area of the Taskbar. From the menu, go into Toolbars and select “New Toolbar…”

5. Most users will have their copy of Windows installed to their “C” drive. In this case the Quick Launch folder will be located in the following location: C:\Users\Insert_Your_User_Account_Name_Here\AppData\Roaming\Microsoft\Internet Explorer

Note: This is where you may need to keep your eyes peeled – since the location of the Quick Launch folder is not the same on every system. For example, if your user account name is William, the path would likely be: C:\Users\William\AppData\Roaming\Microsoft\Internet Explorer

6. When you create the new toolbar it will have text labels by default, this is not pretty – so we must change the settings.

7. Right click on a blank area of the Taskbar, make sure “Lock the Taskbar” is disabled from the context menu.

8. If the new Quick Launch bar is hard to see – crushed in on the side for example – left click and drag the dotted area of the bar to the left of the words “Quick Launch”.  You will likely want to move this bar to the far left of the screen in order to display it as it has been displayed by default in previous Windows versions. In order to do this, you may need to “juggle” multiple toolbars, ie: dragging the opposing toolbar over the Quick Launch toolbar to the right.

9. Right click the Quicklaunch toolbar – preferably where the words “Quick Launch” appear for ease. Click “Show Text” to remove text next to each icon, and, right clicking once again, click “Show Title” to remove the “Quick Launch” title from your toolbar.

10. It may take a bit of finagling, but organize your toolbars in a way to maximize taskbar space, ie: the Quicklaunch bar should be no longer than need be to display its icons. Once your toolbars are positioned to your liking, right click on an unused portion of the Taskbar once again, and select “Lock the Taskbar”. Unfortunately, this often disturbs all the hard work you did of positioning the Quick Launch toolbar – but, a little trial and error of Unlocking/Resizing/Locking will quickly get you where you need to be.

11. Go back and repeat steps 2-3, though choose to Hide hidden items at the end of step 3.

12. Enjoy the QuickLaunch bar! It will function just as it did in past years.

 

Thanks for reading,

David Betournay

Trails for Nails at Robinson State Park

Rob_Park_FieldAnnual Trails for Nails at Robinson State Park – 5K Run/Walk and/or 10K Bike

Who: Well, myself of course – I have registered for the 5K Run. This is a charity event (Registration required in advance; see below) to raise donations and awareness for the Greater Springfield Habitat for Humanity.

What: A 5 mile Run/Walk or 10 mile Bike Ride on the paved road-loop within the park. Donations/Pledges from this event benefit the Springfield HFH. Children, Adults, and Elderly are encouraged to attend – you are not required to participate in the 5K/10K to visit the event. All are welcome.

Where: Robinson State Park, 462 North St. Feeding Hills, MA 01030


View Larger Map

Rob_Park

When: June 8th, 2013 at 9:00AM (Bike), 10:00AM (Walk/Run)

How: Registration is available through the Greater Springfield Habitat for Humanity – Trail for Nails at Robinson State Park page. Registration is available up until the time of the event, however, lunch and freebies may not be available to those that register after May 25th, 2013.

Huh?: More info is available through the registration link listed in the “How” section.

 

 

walk_bike

 

 

Thanks for reading,

David Betournay