Interview Questions from a Government-Influenced Company

Occasionally the same questions come up but it's nice when you get a few new ones thrown your way. Here are several questions that were prompted for a generic Software Engineering position. This company deals primarily with the government and military.

Q. How do you analyze, or time/measure, algorithms?
A. The interviewer stated that a person that's been working probably wouldn't understand this question. The answer she was looking for was Big-O-Notation. Basically Big-O-Notation is used to measure the growth or how long something of size "n" may take. Constant, logarithmic, and linear algorithms would be defined as O(1), O(log n), and O(n) respectively.

Q. Are you familiar with the acronym SBIR?
A. I did not but found out that the government provides financial support to businesses engaged in research and development for government applications. The term itself stands for Small Business Innovation Research. A quick google search provided the following SBIR documentation.

Q. What is inheritance?
A. Inheritance allows you to define a class with the default behavior and fields of another pre-existing class. When declaring a class you would use the extends keyword. Java only supports single-inheritance (you can only inherit from one class).

Q. What is an abstract class?
A. An abstract class can not be instantiated and is a class declared with the abstract keyword. In general this allows you to provide a general blueprint for other classes. The methods defined as abstract within an abstract class must be overwritten by any of its subclasses.

Q. Can you have an abstract method within a non-abstract (normal) class?
A. No. Any class that has abstract methods must also be defined as abstract.

Q. What is the difference between an Abstract class and an Interface?
A. A typical abstract class may or may not have abstract methods. An interface only has abstract methods. With interfaces you can implement the functionality of class defined with the interface keyword. Actually, you can implement from multiple interfaces if you need to. You can only inherit from one source, but implement many. The java documentation explains all of this in a easy to understand manner, see the article on the abstract keyword.

Q. Can an abstract class have a default behavior?
A. Yes, an abstract class may have normal methods.

Q. Can an interface have a default behavior?
A. No, an interface only has abstract methods and an abstract method has no body.

  1. gravatar

    # by Brent - July 22, 2009 at 4:02 PM

    Ha, this might come in handy when I apply at BAH.