A rude awakening

Today I had a realization of how out of programming I have been. I have started this blog to tell my story not truly realizing my starting point. Today, I had an interview for a small company. To say I was terrified was an understatement. I have not had a technical interview in 5 years and it is a scary thing. I studied all weekend to brush up on all the things I may have forgotten, and entered feeling I would be OK that was far from truth.

Entering the exam

Paper portion

The questions were simple but then I stumbled, as he began with trivial engineering questions any undergrad engineer would be able to perform. My brain had failed me I could barley remember anything.

“Draw the Fast Fourier Transform(FFT) of a single frequency sine wave” the interviewer asks.

“FFT” as I think out-loud, “I know it relates to spectrum” as I being to draw stupidly the breakdown of a square wave. As I continue to draw my memory of FFT comes back and I apologize for my mistake and tell him “oh that is a square wave”, remember the fact that it brakes down waves in frequency domain with association to sign/cosign waves. Side note: If you don’t know a FFT look for a post in the far future, maybe. A square wave is made up of multiple frequencies that diminish to create the square wave at intervals.

Computer portion

Next and even more trivial question. “Lets make a matrix in matlab that has is 100 by 100 fill with random numbers from 1 to 100.”

Thinking to myself. EASY, got this in the bag; as I stare blankly at the screen trying to figure out why I cannot remember how to create a matrix but remembering the function is randi needs to be called. I begin to type a way my fingers unable to type words correctly.

int array[].... erase... arry int... erase...

My heart pounds and my fingers become even more useless. “why don’t you pull up the help for randi” he says.

I you don’t know the help is beautify documented within MATLAB…. help help help how do I open help.. yes by typing the function…

hlep felh hlelp

I fumble type… I stop take a second to breath..

help randi

… and I’m off. A matrix is created.

“great now replace all the values below 10 with 11”. This function I remember; its find.

help find

Got it off we go again:


(do you see my mistake took me a second too)

a =find(r<10) 

“great now replace it”. As I think about the code out loud “one way we can do it is threw a nested for loop but as we know this is matlab and it has amazing matrix power so”


Ops error


Done and done and moving on. Should of taken a few seconds to code this with my love of MATLAB but it took me over 5 min. “Great by the way if you use a for loop you would of failed”

Whiteboard portion

Next question was a lot more painful. I will save you the long and boring explanation and get to the meat. Conceptually, I knew what I was doing just did not know how to do it.

“Assume we have an unsigned 32 bit int ‘a’ and I want to change bit ‘n’ of the number how do I do that”.

So at this point my bran is going good.”Ok we have to do a LSR and we have to compare the bits. We need the logic of a NOR, nand..no…”

“its ok lets brake it down. ” the interviewer stats and my mind begins to think, I’m sure this guys is wondering why I am wasting his time.

“I know that we can compare binary numbers in C but problematically I could not remember if you can compare a binary to an int. This I could not wrap my head around. the code of if (1 or 333) how do you even do that whats the result. My brain was stuck on the if logic and the if operater was no where near where I wanted to be. I think out loud “Do I convert 330 to a binary then convert back. No that’s not right. I draw a quick mind dump of the logic and I come to the end result should be a a set and a clear method as follows which will work fantastically


int setbit(int n, int in){
bit= 1<<n;
out = bit || in;
return out;
int clearbit(int n, int in){
bit = 1<<n;
out = ~bit && in;
return out;

How the set works
in is 5 or b’0101
set is 2 or b’0010
the result b’0111

How the clear works
in is b’0101
and ~b is b’1101
do an and b’0101

By the way the job was in no way mine with how long I took to compete the job. I am grateful for the experiences to really kick me in the bottom to practices coding on a whiteboard. I look forward to the work to come and hope to continue.

Leave a Reply

Your email address will not be published. Required fields are marked *