I applied to a jr. software developer position 2 weeks ago. I had a phone interview, an in person interview, and now they want me back for a programming test. What types of things can I expect to see on this test for a "learning position" jr. software development position. I'm solid on programming logic (loops arrays etc..). As for specific language knowledge I think they use Javascript, C++, and SQL Server but I already told them I have no experience with Javascript.
I hope it's just logic. I have made a few functional relational databases and worked with SQL Query language a bit in my PHP days (last month hehe). Anybody have any suggestions on what I should be focusing on or what will be on the "programming test"?
I just had an interview for a similar position. I interviewed with two different engineers who worked in two different vastly different areas. Anyways, I was asked things like:
Implement a binary search for a given set of sorted numbers
Show how a binary search tree would be represented for a string of letters
How would you design a chess game using OOP principles
What is the benefits of having classes in a given situation
Debug a method (mine dealt with string replacement)
Write a unit test
Find null pointer exceptions
Explain the difference between managed and unmanaged languages
Some database questions (I told them I knew nothing about them so they just moved on)
Insert a node into a linked list
Yeah. I'm having trouble understanding heap based vs stack based objects for classes. For example, why would you want to use heap vs stack for an object?
Also pointers. I know pass by references, but pointers are a bit shady as well as the arrow operator (->) never used it, which I think is connected in some way with my first question and heap (memory based) objects.
Well, what you just showed are both variables on the stack. The first creates an object of type Calculator, while the second is just a pointer of type Calculator.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Calculator myCalc; //Stack object
Calculator *ptrCalc; //Stack pointer
ptrCalc = new Calculator; //ptrCalc now points to an object on the heap, but ptrCalc still resides on the stack.
delete ptrCalc; //Frees the memory pointed to by ptrCalc. ptrCalc is still alive and well though
ptrCalc = new Calculator; //Same as above, you can reuse a pointer.
ptrCalc->someMethod(); //-> is equivalent to (*ptrCalc).someMethod()
delete ptrCalc;
EDIT:
//Can also do
Calculator* pointer;
Calculator calc;
pointer = &calc; //Everything here is on the stack
Oria, great info. Makes sense. ResidentBiscuit, line 8. equivalent to (*ptrCalc) - what does this mean? Does it mean .someMethod() is a method of whatever class ptrCalc is assigned?
Also if I create an object on the heap, as in line 3, is that meant for dynamic memory management?
Not too difficult to understand thanks. I solidify memory of what I learn by practicing, so I will try to use pointers and classes in my preparations. Thanks!
Also you will generally want to use the heap for large objects or arrays. The stack space your program gets from the OS is allocated at startup and cannot become any larger (you generally get a few MB's I think). If you try to use more stack memory than you have available you get an error called a stack overflow. The heap doesn't have such size limitations though, you can keep allocating more memory until you exhaust all of the available physical memory on the computer.
Ok so what would be the benefit of creating a reference to an object using these two methods? I'm still unclear, I thought C++ automatically created a object when you assign a class variable.
1 2 3 4
className classVariable;
// vs //
className classVariable;
classVariable = new className;
The first statement creates an object of type className in C++. The third statement give you an error in C++.
However in C# the first statement create a reference to an object of type className that will be equal to null. The third statement creates an object in the managed heap in C# and assigns its reference to classVariable.