Internship interview

So awhile back I had a thread asking what to expect in a software engineer internship interview, and I just had it today (phone interview). It was with the director of engineering at the company I'm interviewing for. It started off with a few behavioral questions such as "What would you do in situation X", and "Describe times when you've had multiple tasks to get done, how did you manage?". Then it went into more technical questions. One of which was:
Describe the difference between an array and a linked list. Describe how they are different in memory, some pros and cons between the two, and when to use one or the other


Another was: (This one gave me some issues)
Describe the different scoping rules.

First off, I had to get clarification on what he was even asking. I hadn't heard the term rules applied to scoping before. But after that, I just realized he was asking to describe global vs local scope and the varying degrees. That part was easy, but then he asked to describe situations where you'd use one over the other. I was stumped because I had no idea when and where to use global scope. Being stumped, I just threw out "When there are threads accessing the same data?" and then I just stated that global scope seems to be frowned upon.

Another one that was weird involved OOP.
Suppose there are two classes, car and color. Car has multiple properties, one of which is color. Color is just a class that describes a color. Why would you keep color a separate class?

I wasn't sure on this, and kind of thought it was a trick because when I said that I wouldn't make a color class in this situation and just have an enumeration member in the car class he seemed to like that answer. Though now writing this out I kind of realize that a color class isn't all that bad. But he then asked again what the benefit of having a color class is, and I wasn't sure. So I just said it allows multiple classes to share a similar color interface.

The other questions were about software debugging and those are boring. Anyways, just posting this so people can have a slight idea of what to expect in similar situations (it is a very large healthcare IT company that does software and hardware primarily) and to get some input on these last two questions and how you would have answered them. I'm pretty sure there were other interesting questions that I can't think of right now, if I do I'll add them.

EDIT:
Another question was very broad, and it was just how would I implement a game of checkers using OOD. I wasn't quite ready for this, and said I'd have a class for the board, a class tiles, an abstract base class Piece with derived classes for each type of piece.
Last edited on
closed account (zb0S216C)
Interviewer wrote:
"Describe the difference between an array and a linked list. Describe how they are different in memory, some pros and cons between the two, and when to use one or the other"

An array's length is static, resides primarily on the stack and is a built-in type. Linked-lists consist of nodes which are linked together with pointers, their length is dynamic and they reside primarily on the heap.

The pros of arrays are that they make more effective use of the CPU cache, make effective use of the code cache, far more maintainable in comparison to linked-lists, are most likely aligned and are generally easier to optimise. The cons of arrays are that their length cannot change, the standard implementation do not provide bounds checking and are not thread-safe by default (unless an element contains some form of synchronisation).

The pros of linked-lists are that their length can change with node removal/insertion, bounds checking can be implemented and enforced, the underlying implementation is (and should be) encapsulated and easy to maintain. The cons of linked-lists are that they are can cause fragmentation, their nodes are not guaranteed to be contiguous, are prone to segmentation faults and heap corruptions, may not be aligned and each node has memory overhead.

Interviewer wrote:
"Describe the different scoping rules."

Global storage has a special region of memory allocated to it and all global storage have external linkage by default if they qualify. Local storage resides on the stack, has automatic storage, are non-static by default and have automatic storage duration.

Wazzak
Last edited on
When you are asked such a question as the scopping rules then the answer is simple: open the C++ standard and read it about the scopping rules.:) So you could say: "Just a moment. I will open the C++ standard and cite some paragraphs about the scopping rules.":)

I think seriously that it is the best answer.

And if you would do this you would know that there are such notions as declarative regions and scopes. And that there are block scope, function scope, function prototype scope, namespace scope, class scope, enumeration scope, and template parameter scope.

As you see I did not even use terms "local and global" scopes, because as opposed to you I do not know C++ but I read the C++ standard.:)
Last edited on
By the way the global scope is defined the following way in the C++ Standard

A name declared in the global namespace has global namespace scope (also called global scope).

So the global scope is a particular case of the namespace scope.
I'm a bit disappointed that he didn't ask you why manhole covers were round...but overall how do you think that you did?
I think I did pretty decent. I had pretty good answers for all the questions except when to use global variables (I didn't know about the benefits described above). The chess one was also a little weird just because of how open it was.

But for it being an internship, the guy seemed impressed. I do work for a network admin right now so I had plenty of IT job experience I was able to throw at him to make me look better than other applicants that just work the typical the random jobs during college.
Topic archived. No new replies allowed.