Please Note: this article is still a work in progress, please download the PDF document or the PowerPoint slides from the links below in order to view the complete version
PowerPoint 2007 Version
Download my Blog List to import into your favorite Blog Reader (like Google Reader)
At some time in your career you will need to interview for a job, if you own your own consulting firm then you are most likely interviewing for jobs on a weekly basis (by pitching clients to contract you for work). Preparing for technical job interviews requires a great deal of research, work, and most of all patience. This article provides a list of questions and answers that I fielded while interviewing for senior level software development positions, it is a collection of my experiences during 17 different job interviews with 10 companies including NASA (who offered me a job).
TABLE OF CONTENTS:
JOBS LOST IN THE UNITED STATES:
- Current job trend in the USA: Its not a pretty sight
- Getting Prepared for the Job Market
- Evaluating your skill set:
- Identifying your strengths and weaknesses
- Comparing yourself to your peers: how do I measure up?
- Preparing your resume:
- Guess what, its read by a computer first
- Keywords, keywords, keywords
- Finding a Job:
- Searching for, finding, and being found
- The interview:
- What to expect
- How to prepare
- Being yourself
- (Not) Knowing it all
- Working with Recruiters
- Finding a job is a full time job
- Leveraging recruiters to work for you while you work on yourself
- Do’s and Don’t
- Being “All You Can Be”
- Staying informed on what’s happening in Tech.
- Practicing the fundamentals:
- What are they anyway?
- Design Patterns:
- What they are and why you need to know them
- You’re already using them, but didn’t even know it
- There are no “experts”, only commitments
- Teaching yourself the skills that are in demand:
- Contributing to the community –it makes you a better developer:
- Do you Blog? You should be!
- Do you read Blogs? You should be!!!
- Using and Giving Back: OSS, Alpha’s & Beta’s, putting pen to paper (well, actually finger to keyboard), teaching others what you’ve learned (Mentoring)
- Real Questions asked in Real Interview: your going to be surprised
U.S. Dept. of Labor & Statistics Report (www.bls.gov)
–651,000 Jobs lost in February 2009
–632,000 Jobs lost in January 2009
–598,000 Jobs lost in December 2008
–533,000 jobs lost in November 2008
–250,000 jobs lost in October 2008
–12.5 million people are out of work
–2.6 million in the last 4 months
GETTING PREPARED: evaluating your skill set
Identifying your strengths and weaknesses:
How would you rate your skills (1-10) where 10 is the highest and 0 is the lowest.
–ASP.NET Web Forms:
Test Your Skills:
–WCF and Service Oriented Architecture:
–Silverlight & WPFLook at your ratings, I strongly recommend researching and learning everything you can about any item that is under a 5.
Create simple scenarios that demonstrate the fundamentals in each of these areas, then code projects that meet these scenarios
How do you stay informed about what’s up and coming in our industry?
channel9.msnd.com, subscribe to the blogs of the "Gang of Four" (Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides) and definitely read Design Patterns: Elements of Reusable Object-Oriented Software, keep up with the work of Martin Fowler by reading his bliki, join your local .NET users group, go to the Code Camps in your area (drive across the state if you have to), attend the annual and semi-annual tech conferences in your area, read books on the latest stuff, and most of all experiment with the latest things by doing them yourself using "real world" senarios.
What is a Worker Process? When the IIS Worker Process or the ASP.NET Worker Process starts a Web application, the Web application inherits the identity of the process if impersonation is disabled. (Impersonation is the process of allowing a thread to run under a different account from its process.) However, if impersonation is enabled, each Web application runs under the user account that is authenticated by IIS or the user account that is configured in the Web.config file. Impersonation can be enabled in either of the following two ways in Web.config:
This allows the Web application to run using the identity that was authenticated by IIS.
This allows the Web application to run using a specific identity.
Where can Viewstate be stored? Anywhere, stored in the file by the server at the time the page is returned to the client.
What is the effect of changing the web.config file in a running application? Resets the cache, app pool, and timing. IIS freaks out, destroys session and “first load” problem because this changes the HASH for the aspx Auth cookie so everyone needs needs to get a new auth cookie.
When/why would you make a windows form instead of an web application? When your volume of data is too high to warrant web traffic and data transfer
What is the difference between String and StringBuilder? Strings are immutable and stringbuilder by-passes this. When you concatenate two strings then a third objects is created (the original 2 and the newly created concatenated string object), the original two then sit on the Heap waiting to be destroyed by the Garbage Collection, an obvious waste of server resources. String.Format uses StringBuilder and ellimiates the overhead of adding an additional third object when two are concatenated.
Are there pointers in .NET? No (although there are delegates) pointers use variables that point to memory locations.
What is a Delegate? A delegate in C# is similar to a function pointer in C or C++. Using a delegate allows the programmer to encapsulate a reference to a method inside a delegate object. The delegate object can then be passed to code which can call the referenced method, without having to know at compile time which method will be invoked. Unlike function pointers in C or C++, delegates are object-oriented, type-safe, and secure.
What is the GAC? Where the .NET DLL’s live so that applications have access to these. “repository for DLL’s that respects versioning”
What is MSIL? Intermediate Language, the Compilers convert the high level code to the IL
Who is considered the father of modern computer science and what concepts did he bring forth that are fundamentally important to computer science as a whole? Alan Turing, He provided an influential formalization of the concept of the algorithm and computation with the Turing machine. With the Turing test, meanwhile, he made a significant and characteristically provocative contribution to the debate regarding artificial intelligence: whether it will ever be possible to say that a machine is conscious and can think.
He later worked at the National Physical Laboratory, creating one of the first designs for a stored-program computer, the ACE, although it was never actually built in its full form. In 1948, he moved to the University of Manchester to work on the Manchester Mark 1, then emerging as one of the world's earliest true computers.
During the Second World War Turing worked at Bletchley Park, the UK's code-breaking centre, and was for a time head of Hut 8, the section responsible for German naval cryptanalysis. He devised a number of techniques for breaking German ciphers, including the method of the bombe, an electromechanical machine that could find settings for the Enigma machine.
Turing Complete: A computational system that can compute every Turing-computable function is called Turing-complete (or Turing-powerful). Alternatively, such a system is one that can simulate a universal Turing machine. The concept of the Turing machine is based on the idea of a person executing a well-defined procedure by changing the contents of an infinite amount of ordered paper sheets that can contain one of a finite set of symbols. The person needs to remember one of a finite set of states and the procedure is formulated in very basic steps in the form of "If your state is 42 and the symbol you see is a '0' then replace this with a '1', remember the state 17, and go to the following sheet."
What is Silverlight? Microsoft Silverlight is a programmable web browser plugin that enables features such as animation, vector graphics and audio-video playback that characterize rich Internet applications. Version 2.0, released October 2008, brings additional interactivity features and support for .NET languages and development tools. It is compatible with multiple web browser products used on Microsoft Windows and Mac OS X operating systems. Mobile devices, starting with Windows Mobile 6 and Symbian (Series 60) phones, will also be supported. A third-party free software implementation named Moonlight is under development to bring compatible functionality to GNU/Linux.
What is SOAP? SOAP (Simple Object Application Protocol) is a light weight protocol intended for the exchanging of structured information in a decentralized, distributed environment. It uses XML technologies to define an extensible messaging framework providing a message construct that can be exchanged over a variety of underlying protocols. The framework has been designed to be independent of any particular programming model and other implementation specific semantics. The technological foundation that makes up Web services includes SOAP, the Web Service Description Language (WSDL), Universal Description, Discovery, and Integration (UDDI), and XML. Specifically, SOAP provides a heterogeneous mechanism to allow the invocation and communication between Web services. Some of the shortcomings of the SOAP 1.1 has been clarified, updated and corrected in SOAP 1.2. SOAP 1.2 contains a number of issues such as those on interoperability and ambiguities that resulted in differences of interpretation.
SOAP 1.1 is based on XML 1.0 and can only use HTTP POST headers to transmit SOAP messages. As a result, it isn't really suitable for wide-scale applications.
What’s the default file extension for a .NET web service? .asmx
What’s the difference between the GET and POST request methods? The GET method appends name/value pairs to the URL, allowing you to retrieve a resource representation. The big issue with this is that the length of a URL is limited (roughly 3000 char) resulting in data loss should you have to much stuff in the form on your page, so this method only works if there is a small number parameters.
The alternative to the GET method is the POST method. This method packages the name/value pairs inside the body of the HTTP request, which makes for a cleaner URL and imposes no size limitations on the forms output, basically its a no-brainer on which one to use. POST is also more secure but certainly not safe. Although HTTP fully supports CRUD, HTML 4 only supports issuing GET and POST requests through its various elements. This limitation has held Web applications back from making full use of HTTP, and to work around it, most applications overload POST to take care of everything but resource retrieval.
Describe briefly your opinions regarding source control: (I like centralized version control, I use version control on every project) Visual Sourse Safe is widely used in government, personally I prefer SubVersion to all that I have used, followed by Microsoft Team Foundation Server
What is OOP? Object-oriented programming may be seen as a collection of cooperating objects, as opposed to a traditional view in which a program may be seen as a group of tasks to compute ("subroutines"). In OOP, each object is capable of receiving messages, processing data, and sending messages to other objects.
Inheritance: ‘Subclasses’ are more specialized versions of a class, which inherit attributes and behaviors from their parent classes, and can introduce their own. Each of its sub-classes will inherit these members, meaning that the programmer only needs to write the code for them once.
Abstraction: Abstraction is simplifying complex reality by modeling classes appropriate to the problem, and working at the most appropriate level of inheritance for a given aspect of the problem.
Abstraction is also achieved through Composition. For example, a class Car would be made up of an Engine, Gearbox, Steering objects, and many more components. To build the Car class, one does not need to know how the different components work internally, but only how to interface with them, i.e., send messages to them, receive messages from them, and perhaps make the different objects composing the class interact with each other.
Encapsulation: Encapsulation conceals the functional details of a class from objects that send messages to it.
Encapsulation is achieved by specifying which classes may use the members of an object. The result is that each object exposes to any class a certain interface — those members accessible to that class. The reason for encapsulation is to prevent clients of an interface from depending on those parts of the implementation that are likely to change in future, thereby allowing those changes to be made more easily, that is, without changes to clients. Members are often specified as public, protected or private, determining whether they are available to all classes, sub-classes or only the defining class. Some languages go further: Java uses the default access modifier to restrict access also to classes in the same package, C# and VB.NET reserve some members to classes in the same assembly using keywords internal (C#) or Friend (VB.NET), and Eiffel and C++allow one to specify which classes may access any member.
Polymorphism: Polymorphism allows the programmer to treat derived class members just like their parent class' members. More precisely, Polymorphism in object-oriented programming is the ability of objects belonging to different data types to respond to method calls of methods of the same name, each one according to an appropriate type-specific behavior. One method, or an operator such as +, -, or *, can be abstractly applied in many different situations. If a Dog is commanded to speak(), this may elicit a bark(). However, if a Pig is commanded to speak(), this may elicit an oink(). They both inherit speak() from Animal, but their derived class methods override the methods of the parent class; this is Overriding Polymorphism.
Overloading Polymorphism is the use of one method signature, or one operator such as ‘+’, to perform several different functions depending on the implementation. The ‘+’ operator, for example, may be used to perform integer addition, float addition, list concatenation, or string concatenation. Any two subclasses of Number, such as Integer and Double, are expected to add together properly in an OOP language. The language must therefore overload the concatenation operator, ‘+’, to work this way. This helps improve code readability. How this is implemented varies from language to language, but most OOP languages support at least some level of overloading polymorphism. Many OOP languages also support Parametric Polymorphism, where code is written without mention of any specific type and thus can be used transparently with any number of new types. Pointers are an example of a simple polymorphic routine that can be used with many different types of objects.
What is the coolest piece of code you have written? Has to be really cool
Can the constructor of a class be declared as static and if so why? Yes a constructor can be static. When a constructor is declared as static it is fired before all other constructors and is very useful in instantiating variables
Describe Web Services? Behind the scenes there are three major components that make up a Web Service:
- The Web Service on the Server side
- The client application calling the Web Service via a Web Reference
- A WSDL Web Service description that describes the functionality of the Web Service
Classes in Web Services are standard .Net classes and the only difference is that every method that you want to expose to the Web is prefixed with a [WebMethod] attribute.
Web Service’s mission is to provide a Remote Procedure Call (RPC) interface for client applications to call class methods on the server side. Actually, the handling interface on the server need not be a class, but in the case of .Net and COM before it classes are typically used as the implementing entity. The idea is that in order to create a Web Service, you create class methods with standard input and output parameters and you then mark those classes and the specific methods as exposable over the Net.
Web Services are meant to expose functionality of a server to other applications. The ‘client’ applications in this case may be a Fat Client Windows app, a Fat Server Web application that runs a standard Web backend such as ASP, Cold Fusion, Web Connection etc., a browser based client application using script code, or even Java applets running in a browser on a Unix machine. As long as a client application has support for the Simple Object Access Protocol (SOAP) it can call the remote Web Service and return data for it, assuming the user is authorized.
SOAP is an important part of this process – it is the protocol that’s responsible for routing the RPC message from the client to the server and returning the result back to the client application. SOAP is based on XML and follows a relatively simple design that’s easy to implement. SOAP’s simple protocol has contributed to its widespread support on just about any platform and development environment. You can find SOAP clients for COM (the MSSOAP Toolkit is available for Visual Studio 6 developers), .Net (obviously), Perl, Java, C++, PHP – and just about any development environment you can think of.
SOAP implementations provided by vendors typically consist of two pieces: A client side Proxy that handles the SOAP message creation and result message cracking to return the result data, as well as a server piece that implements the Web Service logic. The server piece tends to be an application server that calls out to custom Web Service classes that you create and that contain the business logic of your Web Service. The server code you write essentially consists of simple methods to handle inputs and outputs via parameters and return values respectively. The logic you write in the actual method is up to you and contains any functionality that your language of choice supports. This means writing code to call your business objects or if the process is simple enough using procedural code to perform some operation. Although Web Services can expose classes, you’ll find that typically you end up creating wrapper classes for existing business objects in order to handle the specific logic required to drive your Web Service. As such you’re breaking up the business tier with a front end service (the Web Service) and a business service (your actual business objects – or if you use procedural code just that code).
One important thing to remember is that Web Services follow typical Web rules. For one they are stateless. This means that even though Web Services expose classes, they are more of a remote procedure call interface than a remote class interface. You call methods with parameters rather than storing state in properties between method calls. In fact, none of the major Web Service implementations support properties in any way. If you need to keep state you’ll have to use Web Server specific functionality such as the ASP or ASP.NET Session object to store that state and retrieve it on subsequent hits. Since Web Services use the standard Web architecture, the same tools you’ve used for HTML based browser applications can also be used in the Web Services code, although you will find that you spend very little time accessing this functionality in your Web Service code as the frameworks abstract away the need to deal with the HTTP and Web Server layer for the most part. Things that you may need to manage yourself include state and security since the Web Service architecture doesn't provide this for you. In both cases you can however take advantage of the HTTP services (Authentication, SSL for example) or the Web server features like the session object to make short work of dealing with these issues.
SOAP proxies vary widely in quality and ease of use and unfortunately, as the official SOAP spec is still under heavy construction by the standards bodies. Interoperability is not perfect, but getting better all the time. Be sure to stay up with your vendor’s latest toolkits for best compatibility. Proxies are the key to making Web Services easy to use and consume. Microsoft’s implementations in both COM and .Net provide proxy interfaces that simulate the remote object and provide you with a simple call interface that lets you create the proxy and then call methods on it the same way as you would on a local object. Visual Studio .Net takes this one step further by actually providing you a real proxy object that contains the actual methods of the remote object making it possible to even use time saving features like IntelliSense on the object.
What is WSDL? A WSDL file describes all the methods and method signatures, as well as the namespaces and the handling URL for the Web Service in an XML document. This document works very much like a type library does in COM for the client application to determine what functionality is available in the Web Service. Visual Studio.Net uses the WSDL file to create a Web Reference on the client side from your Web Service. It reads the WSDL file and based on the definitions found in the WSDL file creates a proxy class that mimics the interface of the Web Service. The resulting class is actual source code that you can look at. Because this class is actually linked into your client project the class becomes available in IntelliSense and you can actually see the full interface of the class as you type.
WSDL is a Service Description Language.
WSDL is a standard that is used to describe a Web Service's features and how the service should be called. As SOAP standards are getting more complex and include specific namespace references and complex data types the need for a type definition format to provide this information to the SOAP client tools became necessary. Microsoft especially embraced WSDL early on in it SOAP toolkits and relies heavily on the WSDL description – MS SOAP clients don't work without WSDL files. The SOAP spec does not require WSDL, but the ability to have a type definition in WSDL makes it easier to call a Web Service since the client application will not have to set various namespace references manually – this information can be retrieved from the WSDL file. Use of WSDL makes it possible to make single line method calls to various service methods that would otherwise require a number of custom configuration settings.
Define URI and URL? (are they the same thing?) URI (Uniform Resource Identifier) is the unique identifier that represents a service available in a RESTful application such as the World Wide Web.
The Uniform Resource Locator (URL) provides a way of uniquely specifying the location of a resource on the Internet
They are the same thing; URL has been replaced by URI
What is WCF? Can you give an example of when it’s used? Windows Communication Foundation, WCF is designed in accordance with Service oriented architecture principles to support Distributed computing where services are consumed by consumers. Clients can consume multiple services and services can be consumed by multiple clients. Services typically have a WSDL interface which any WCF client can use to consume the service, irrespective of which platform the service is hosted on. WCF implements many advanced web services (WS) standards such as WS-Addressing, WS-ReliableMessaging and WS-Security. WCF could be used when architecting a system that needs to be completely separated from its presentation layer allowing a Windows Forms, Silverlight, and Web Forms front end to interact with the same business logic layers of the system.
Explain an Abstract class An abstract class means that, no object of this class can be instantiated, but can make derivations of this. Abstract classes can have implementation within its methods or properties where as an Interface cannot have implementation within its methods or properties.
Explain a Sealed class. The sealed modifier is used to prevent derivation from a class. An error occurs if a sealed class is specified as the base class of another class. A sealed class cannot also be an abstract class.
The sealed modifier is primarily used to prevent unintended derivation, but it also enables certain run-time optimizations. In particular, because a sealed class is known to never have any derived classes, it is possible to transform virtual function member invocations on sealed class instances into non-virtual invocations.
Explain a Virtual Method: Abstract methods are required to be overridden, whereas virtual methods are not. Abstract methods are similar to C++ pure virtual methods, except C++ pure virtual methods may have an implementation associated with them, whereas C# abstract methods may not. Virtual methods, in contrast to abstract methods, are required to have an implementation associated with them. Virtual methods, along with interfaces, are the only means of implementing polymorphism within C#.
If you has a data source with 1 million records and needed to sort them on a given field how would you do this? (Bucket sort or Quick sort)
is a straightforward and simplistic method of sorting data that is used in computer science education. The algorithm starts at the beginning of the data set. It compares the first two elements, and if the first is greater than the second, it swaps them. It continues doing this for each pair of adjacent elements to the end of the data set. It then starts again with the first two elements, repeating until no swaps have occurred on the last pass. While simple, this algorithm is highly inefficient and is rarely used except in education. For example, if we have 100 elements then the total number of comparisons will be 10000. A slightly better variant, cocktail sort, works by inverting the ordering criteria and the pass direction on alternating passes. Its average case and worst case are both O(n²).
Selection sort Main article: Selection sort
Selection sort is a simple sorting algorithm that improves on the performance of bubble sort. It works by first finding the smallest element using a linear scan and swapping it into the first position in the list, then finding the second smallest element by scanning the remaining elements, and so on. Selection sort is unique compared to almost any other algorithm in that its running time is not affected by the prior ordering of the list: it performs the same number of operations because of its simple structure. Selection sort requires (n - 1) swaps and hence T(n) memory writes. However, Bubble sort requires (n - 1) + (n - 2) + ... + 2 + 1 = n(n - 1) / 2 = T(n2) comparisons. Thus it can be very attractive if writes are the most expensive operation, but otherwise selection sort will usually be outperformed by insertion sort or the more complicated algorithms.
Insertion sort Main article: Insertion sort
Insertion sort is a simple sorting algorithm that is relatively efficient for small lists and mostly-sorted lists, and often is used as part of more sophisticated algorithms. It works by taking elements from the list one by one and inserting them in their correct position into a new sorted list. In arrays, the new list and the remaining elements can share the array's space, but insertion is expensive, requiring shifting all following elements over by one. The insertion sort works just like its name suggests - it inserts each item into its proper place in the final list. The simplest implementation of this requires two list structures - the source list and the list into which sorted items are inserted. To save memory, most implementations use an in-place sort that works by moving the current item past the already sorted items and repeatedly swapping it with the preceding item until it is in place. Shell sort (see below) is a variant of insertion sort that is more efficient for larger lists. This method is much more efficient than the bubble sort, though it has more constraints.
Shell sort Main article: Shell sort
Shell sort was invented by Donald Shell in 1959. It improves upon bubble sort and insertion sort by moving out of order elements more than one position at a time. One implementation can be described as arranging the data sequence in a two-dimensional array and then sorting the columns of the array using insertion sort. Although this method is inefficient for large data sets, it is one of the fastest algorithms for sorting small numbers of elements (sets with fewer than 1000 or so elements). Another advantage of this algorithm is that it requires relatively small amounts of memory.
Merge sort Main article: Merge sort
Merge sort takes advantage of the ease of merging already sorted lists into a new sorted list. It starts by comparing every two elements (i.e., 1 with 2, then 3 with 4...) and swapping them if the first should come after the second. It then merges each of the resulting lists of two into lists of four, then merges those lists of four, and so on; until at last two lists are merged into the final sorted list. Of the algorithms described here, this is the first that scales well to very large lists, because its worst-case running time is O(n log n).
Heapsort Main article: Heapsort
Heapsort is a much more efficient version of selection sort. It also works by determining the largest (or smallest) element of the list, placing that at the end (or beginning) of the list, then continuing with the rest of the list, but accomplishes this task efficiently by using a data structure called a heap, a special type of binary tree. Once the data list has been made into a heap, the root node is guaranteed to be the largest element. When it is removed and placed at the end of the list, the heap is rearranged so the largest element remaining moves to the root. Using the heap, finding the next largest element takes O(log n) time, instead of O(n) for a linear scan as in simple selection sort. This allows Heapsort to run in O(n log n) time.
Quicksort Main article: Quicksort
Quicksort is a divide and conquer algorithm which relies on a partition operation: to partition an array, we choose an element, called a pivot, move all smaller elements before the pivot, and move all greater elements after it. This can be done efficiently in linear time and in-place. We then recursively sort the lesser and greater sublists. Efficient implementations of quicksort (with in-place partitioning) are typically unstable sorts and somewhat complex, but are among the fastest sorting algorithms in practice. Together with its modest O(log n) space usage, this makes quicksort one of the most popular sorting algorithms, available in many standard libraries. The most complex issue in quicksort is choosing a good pivot element; consistently poor choices of pivots can result in drastically slower (O(n²)) performance, but if at each step we choose the median as the pivot then it works in O(n log n).
Bucket sort Main article: Bucket sort
Bucket sort is a sorting algorithm that works by partitioning an array into a finite number of buckets. Each bucket is then sorted individually, either using a different sorting algorithm, or by recursively applying the bucket sorting algorithm. A variation of this method called the single buffered count sort is faster than the quick sort and takes about the same time to run on any set of data.
Radix sort Main article: Radix sort
Radix sort is an algorithm that sorts a list of fixed-size numbers of length k in O(n · k) time by treating them as bit strings. We first sort the list by the least significant bit while preserving their relative order using a stable sort. Then we sort them by the next bit, and so on from right to left, and the list will end up sorted. Most often, the counting sort algorithm is used to accomplish the bitwise sorting, since the number of values a bit can have is small.
Explain the B-Tree and what it’s used for?
In computer science, a B-tree is a tree data structure that keeps data sorted and allows searches, insertions, and deletions in logarithmic amortized time. It is most commonly used in databases and filesystems.
In B-trees, internal (non-leaf) nodes can have a variable number of child nodes within some pre-defined range. When data is inserted or removed from a node, its number of child nodes changes. In order to maintain the pre-defined range, internal nodes may be joined or split. Because a range of child nodes is permitted, B-trees do not need re-balancing as frequently as other self-balancing search trees, but may waste some space, since nodes are not entirely full. The lower and upper bounds on the number of child nodes are typically fixed for a particular implementation. For example, in a 2-3 B-tree (often simply referred to as a 2-3 tree), each internal node may have only 2 or 3 child nodes. A B-tree of order m (the maximum number of children for each node) is a tree which satisfies the following properties :
- Every node has at most m children.
- Every node (except root and leaves) has at least m/2 children.
- The root has at least 2 children if it is not a leaf node.
- All leaves appear in the same level, and carry no information.
- A non-leaf node with k children contains k – 1 keys
The B-tree's creators, Rudolf Bayer and Ed McCreight, have not explained what, if anything, the B stands for. The most common belief is that B stands for balanced, as all the leaf nodes are at the same level in the tree. B may also stand for Bayer, Branching Tree, or for Boeing, because they were working for Boeing Scientific Research Labs at the time.
Can you give an example of when you might use reflection? Reflection is Microsoft's implementation of Code Introspection, which is the ability to have code that has Meta Data. For example: You cannot cast a string to an object so you must convert it into an object via Reflection.
What attributes are you familiar with, how have you used them? (inherit from the class System.Attibute) like Test and WebMethod, Serializable (cross Service Oriented Architecture gateway which renders an XML schema defining the Meta Data so look at WCF and Remoting or go into Session)
What is the name of the process that runs aspx code in XP? aspnet_wp.exe
What about 2003, Vista? w3wp.exe
What is new in 2.0?
- Generics and generic collections
- 64-bit platform support
- ADO.NET support for UDT (user defined types)
- ACL (access control list) support which grants/revokes permission to access a resource on a computer.
- Tons of new data control objects introduced to ASP.NET (GridView, new cache features, aspnet membership services, object/sql datasource skips codebehind binding. MasterPages, Themes, Web Application Project model (vs. Website model)
- Controls render output in XHTML 1.1 standards
- Debugger Edit & Continue Support
- Data Protection API: encrypt web.config, passwords, blocks of memory
- WCF Web Programming Model: enables developers to build Web-style services with WCF. The Web Programming Model includes rich URI processing capability, support for all HTTP verbs including GET, and a simple programming model for working with a wide variety of message formats (including XML, JSON, and opaque binary streams)
- .NET compact Framework support for WCF (Windows Communication Foundation)
- AJAX-Enabled Website projects, AJAX Library
- Forms authentication, roles management, and profiles can be consumed in a WCF-compatible application
- ListView Databound control and the LinqDataSource object
- Add-In and Extensibility support (discovery, activation, isolation, sandboxing, UI composition, Versioning)
- Suite B cryptographic algorithm support published by the National Security Agency (NSA) including Advanced Encryption Standard (AES) with keys of 128 & 256 bit encryption, Secure Hash Algorithm (SHA-256 & SHA-384) for hashing
- Peer to Peer networking support (PNRP) Peer Name Resolution Protocol
What's the difference between a DataTable and a DataReader?
DataTable: opens the connection for less time so better for network performance, pulling back all the records and storing them for use.
DataReader: pulls back data one record at a time, leaving the connection open, while executing the same query over and over again to obtain the next record. While this is faster on small record sets it is problematic will larger amounts of data and can lead to memory leaks if left unclosed.
What are the different joins, and when would you use them? There are 4: Left Out, Right Out, full Inner, full Outer (x,y cartiesian product)
Explain "Having": Since you cannot do where’s after a Group By you add a Having which is basically a Where clause for filtering a Group By clause
What is the difference between Normalized & Denormalized, and when do you use which? Normalized means separate tables via foreign key relationship (historically inaccurate), Denormalized does not. You use Denormalized form when you have a large amount of data that you want to do calculations on its far greater performance to have Denormalized or you need Reporting)
What is an alternative to using cursors, and why would you use it? A Cursor is used to place you in the location of a record while you loop through other records. They are BAD, take up Temp Table memory, put a lock on the database record it’s on, and holds a lock in the Master database so that no other connection can be made to that record. An alternative is to use a for-loop and a while loop
What is the difference between an index, clustered index and trigger? A clustered index is how the B tree stores the index, you can have unlimited indexes because they are stored in memory but only one clustered index.
What is an interface, and why would you use one? The contract between two classes, although some argue that rather than a contract an interface is merely a means of enforcing uniform language between two classes. An interface can only contain declarations and is used to ensure that all classes that implement the interface conform to the "language" or "contact" required so that other classes can use these your class in a consistent and predictable way. Interfaces are commonly used in the Factory Design Pattern of software architecture.
Does C# support multiple inheritances? No
If not then how can we get around this? We can define multiple interfaces which classes can then implement in order to mimic the functionality of multiple inheritance
How do you bounce IIS from the command line? iisreset
Can you data model the following: User, Group, Permission. If we assume that a user may belong to many groups and may have many permissions. (How many permissions are in a group and how many groups can a user belong to?)
What do you use to decompile a dll? .NET reflector will decompile the DLL into either C# or VB.NET
In try, catch finally: If you call return from the catch, does the finally get executed? Yes, finally always gets executed and if an exception is caused in the finally block it can caused infinite loops
What is the difference between an implicit and explicit interface implementation?
Explicit implementation means the objects are only available when the class is. only shown when you cast the object (you have a method that you don’t want it to be part of the interface that conflicts with the method name) the explicit implementation keeps the interface members out of the class and out of intellisense. Explicit method implementation cannot be virtual and cannot be abstract.
Implicit Implementation: can be abstract, the “public” keyword is attached to the method
How do you create a custom event? (Must declare a delegate in the even handler) need event declaration and something to initiate that event.
Give an example of cross browser difficulties: DOM is traversed differently, Z-indexes are handled different, different color palettes (transparent color is not part of IE 6 and therefore causes transparent images to render with a gray color where they should be transparent) are rendered differently
How can you hide a div using css? Visibility: hidden (makes it take up the space it will normally take up), Display: none (does not take up the space it normally would)
Describe some disadvantages of AJAX. Two connection limit in browsers is a major constraint and can cause the page to appear to have locked up because the limit has been exceeded, transfering large amount of data can cause the same perception. Ajax has a high number of network calls because your increasing the number of wires in order to pass the data back and forth, if you do GET you can do cross browser but your limited to roughly 3,000 char per request but if you use POST you have an unlimited number of char. however you cannot do cross browser in POST.
What is the "png problem" in IE6? Transparency is not in the IE6 color palette
Why would you use an interface vs. a base class? When you have a large number of objects that do the same basic functions then you use a base class (a good example is System.Web.UI.Page which puts all the core page functions in this page class, allowing what is unique to a page to be separate from this core functionality and instead placed in the .aspx pages which will inherit from System.Web.UI.Page), otherwise an interface would be used.
What design patterns are you familiar with? Which design pattern is your favorite and why? Why are design patterns important? (Pick the one the candidate is most familiar with, and ask questions until the candidate says "I don't know") Please buy a copy of Head First Design Patterns by Eric Freeman & Elisabeth Freeman (Oreilly Press) ISBN 0-596-0071204 as it is extremely well written and very very easy to follow, this book will be invaluble to you in learning Sofware Design Patterns. In addition you should, without fail, read Design Patterns: Elements of Reusable Object-Oriented Software, as this is one of the most important books you will ever read in your career.
My personal favorite Design Pattern is the Strategy Pattern because it is the foundation for all other design patterns in existance, it simply states "identify in your application what changes and separate it from what stays the same", the System.Web.UI.Page namespace is a perfect example of how Microsoft separate what doesn't change (the core parts of a web page) from what does change (your specific implementation of a web page).
This abstract class provides an interface for attaching and detaching observers. Subject class also holds a private list of observers. Contains these functions (methods):
Attach - Adds a new observer to the list of observers observing the subject.
Detach - Removes an existing observer from the list of observers observing the subject
Notify - Notifies each observer by calling the update() function in the observer, when a change occurs.
This class provides the state of interest to observers. It also sends a notification to all observers, by calling the Notify function in its superclass or base class (i.e, in the Subject class). Contains this
GetState - Returns the state of the subject.
This class defines an updating interface for all observers, to receive update notification from the subject. The Observer class is used as an abstract class to implement concrete observers. Contains this function:
Update - An abstract function, to be overridden by concrete observers.
This class maintains a reference with the ConcreteSubject, to receive the state of the subject when a notification is received. Contains this function:
Update - This is the overridden function in the concrete class. When this function is called by the subject, the ConcreteObserver calls the GetState function of the subject to update the information it has about the subject's state. When the event is raised each observer receives a callback. This may be either a virtual function of the observer class (called 'update()' on the diagram) or a function pointer (more generally a function object or "functor") passed as an argument to the listener registration method. The update function may also be passed some parameters (generally information about the event that is occurring) which can be used by the observer. When an event occurs within the subject, the subject then calls the update method on all observers attached to that subject. Each concrete observer implements the update function and as a consequence defines its own behavior when the notification occurs.
Typical usages - When an abstraction has two aspects, one dependent on the other. Encapsulating these aspects in separate objects allows the programmer to vary and reuse them independently.
When a change to one object requires changing others, and it's not known in advance how many objects need to be changed. When an object should be able to notify other objects without making assumptions about who these objects are. The observer pattern is also very often associated with the model-view-controller (MVC) paradigm. In MVC, the observer pattern is used to create a loose coupling between the model and the view. Typically, a modification in the model triggers the notification of model observers which are actually the views.
An example is Java Swing, in which the model is expected to issue change notifications to the views via the PropertyChangeNotification infrastructure. Model classes are Java beans that behave as the subject, described above. View classes are associated with some visible item on the GUI and behave as the observers, described above. As the application runs, changes are made to the model. The user sees these changes because the views are updated accordingly.
The decorator pattern is a design pattern that allows new/additional behaviour to be added to an existing class dynamically. The decorator pattern can be used to make it possible to extend (decorate) the functionality of a class at runtime. This works by adding a new decorator class that wraps the original class. This wrapping is typically achieved by passing the original object as a parameter to the constructor of the decorator when it is created. The decorator implements the new functionality, but for functionality that is not new, the original (wrapped) class is used. The decorating class must have the same interface as the original class.
The decorator pattern is an alternative to subclassing. Subclassing adds behaviour at compile time whereas decorating can provide new behaviour at runtime.
This difference becomes most important when there are several independent ways of extending functionality. In some object-oriented programming languages, classes cannot be created at runtime, and it is typically not possible to predict what combinations of extensions will be needed at design time. This would mean that a new class would have to be made for every possible combination. By contrast, decorators are objects, created at runtime, and can be combined on a per-use basis.
An example of the decorator pattern is the Java I/O Stream simplementation. As an example, consider a window in a windowing system. To allow scrolling of the window's contents, we may wish to add horizontal or vertical scrollbars to it, as appropriate. Assume windows are represented by instances of the Window class, and assume this class has no functionality for adding scrollbars. We could create a subclassScrollingWindow that provides them, or we could create a ScrollingWindowDecorator that merely adds this functionality to existing Window objects. At this point, either solution would be fine.
Now let's assume we also wish the option to add borders to our windows. Again, our original Window class has no support. The ScrollingWindow subclass now poses a problem, because it has effectively created a new kind of window. If we wish to add border support to all windows, we must create subclasses WindowWithBorder and ScrollingWindowWithBorder. Obviously, this problem gets worse with every new feature to be added. For the decorator solution, we need merely create a new BorderedWindowDecorator—at runtime, we can decorate existing windows with theScrollingWindowDecorator or the BorderedWindowDecorator or both, as we see fit.
Another good example of where a decorator can be desired is when there is a need to restrict access to an object's properties or methods according to some set of rules or perhaps several parallel sets of rules (different user credentials, etc). In this case instead of implementing the access control in the original object it is left unchanged and unaware of any restrictions on its use, and it is wrapped in an access control decorator object, which can then serve only the permitted subset of the original object's interface.
Consider viewing a webpage with a web browser. The webpage itself displays the information needed, but the web browser knows nothing about the content. It is likely that the webpage doesn't fit in the entire browser area and a scrollbar is required to show the information. The web browser doesn't need to assume that all webpages will require a scrollbar and it certainly should never assume a scrollbar is never needed. Browsers will typically display the scrollbar only if it is necessary and hide it if it is unnecessary. In this case, the scrollbar is the "decoration" to the webpage. It takes care of whether it should be displayed dynamically as opposed to statically forcing the webpage display to be a subclass of the scrollbar display. Thus, it is up to the scrollbar to decide whether it should display itself (instead of trying to force that responsibility on the webpage or on the external parts of the web browser).
A Flyweight is an object that minimizes memory occupation by sharing as much data as possible with other similar objects; it is a way to use objects in large numbers when a simple representation would use an unacceptable amount of memory. Often some parts of the object state can be shared and it's common to put them in external data structures and pass them to the flyweight objects temporarily when they are used.
A classic example usage of the flyweight pattern are the data structures for graphical representation of characters in a word processor. It would be nice to have, for each character in a document, a glyph object containing its font outline, font metrics, and other formatting data, but it would amount to hundreds or thousands of bytes for each character. Instead, for every character there might be a reference to a flyweight glyph object shared by every instance of the same character in the document; only the position of each character (in the document and/or the page) would need to be stored externally.
the composite pattern is a partitioning design pattern. Composite allows a group of objects to be treated in the same way as a single instance of an object. The intent of composite is to "compose objects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual objects and compositions uniformly.
When dealing with tree-structured data, programmers often have to discriminate between a leaf-node and a branch. This makes code more complex, and therefore, error prone. The solution is an interface that allows treating complex and primitive objects uniformly. In object-oriented programming, a composite is an object (e.g., a shape) designed as a composition of one-or-more similar objects (other kinds of shapes/geometries), all exhibiting similar functionality. This is known as a "has-a" relationship between objects. The key concept is that you can manipulate a single instance of the object just as you would a group of them. The operations you can perform on all the composite objects often have a least common denominatorrelationship. For example, if defining a system to portray grouped shapes on a screen, it would be useful to define resizing a group of shapes to have the same effect (in some sense) as resizing a single shape.
Composite can be used when clients should ignore the difference between compositions of objects and individual objects. If programmers find that they are using multiple objects in the same way, and often have nearly identical code to handle each of them, then composite is a good choice; it is less complex in this situation to treat primitives and composites as homogeneous.
- is the abstraction for all components, including composite ones
- declares the interface for objects in the composition
- implements default behavior for the interface common to all classes, as appropriate
- declares an interface for accessing and managing its child components
- (optional) defines an interface for accessing a component's parent in the recursive structure, and implements it if that's appropriate
- represents leaf objects in the composition
- implements all Component methods
- represents a composite Component (component having children)
- implements methods to manipulate children
- implements all Component methods, generally by delegating them to its children
- A proxy, in its most general form, is a class functioning as an interface to another thing. The other thing could be anything: a network connection, a large object in memory, a file, or some other resource that is expensive or impossible to duplicate.
- A well-known example of the proxy pattern is a reference counting pointer object.
- In situations where multiple copies of a complex object must exist the proxy pattern can be adapted to incorporate the Flyweight Pattern in order to reduce the application's memory footprint. Typically one instance of the complex object is created, and multiple proxy objects are created, all of which contain a reference to the single original complex object. Any operations performed on the proxies are forwarded to the original object. Once all instances of the proxy are out of scope, the complex object's memory may be deallocated.
What do you think about ORM?
ORM is useful in getting you started but becomes a problem in long-term maintenance as you are committed to the ORM you initially select. Another disadvantage is that if the schema is changed the application is not shielded from the change. The relational schema of the data is hard coded into the application. If the data model changes the ORM object won’t know until they are regenerated by the ORM software.
Name some ORMs?
SubSonic, Linq, ADO.NET Entity Framework (released with .NET 3.5 SP1), NHibernate
What ORM patterns have you used?
ActiveRecord pattern, via SubSonic, which allows for the Lazy Loading of objects.
What is Lazy Loading, what is its opposite?
Lazy Loading refers to a design pattern commonly used in computer programming to defer initialization of an object until the point at which it is needed. It can contribute to efficiency in the program's operation if properly and appropriately used.
Eager Loading is the opposite of Lazy Loading.
Name the ways Lazy Loading can be implemented and describe each: There are 4 ways lazy loading can be implemented
Lazy Initialization: The object to be lazily loaded is initially set to NULL, and every request for the object checks for NULL and creates it “on the fly” before returning it first
Virtual Proxy: a virtual proxy is an object that “looks like” the object that is to be lazily loaded. Both the object and the proxy implement the same interface, with the proxy providing a wrapper that instantiates and initialize the object when one of its properties is accessed for the first time
Ghost: a ghost is the object that is to be loaded in a partial state. It may only contain the objects identifier, but it loads its own data the first time one of its properties is accessed.
Value Holder: a value holder is a generic object that handles the lazy loading behavior, and appears in place of the object’s data fields.
What do you think about code generation? SubSonic is a code generator (ORM generator) which is cool. I like it where it can help me automate mundane tasks, it can help you get started but it doesn’t facilitate long-term maintenance making it not practical.
What’s the largest number of concurrent users any app you’ve worked on has supported? (had about 500 concurrent users and can handle about 2000, looking at logs shows how many transaction you support per second which you figure out how many requests a thread can process per second multiplied by the number of threads)
How did you scale to that?
We implemented a Web Farm behind a Proxy Server that handled request distribution. We set up a separate SQL box and a mirrored backup
Any problems scaling? I/O is the biggest bottleneck, we have to closely watch our code to reduce the number of database transactions and page size which is a constant battle.
How do you convert a number that is input in a textbox (string) to an int, float, double, etc.?
int.TryParse(string s, out x);
What is the difference between a double & a decimal? Why would you use one vs. another? Which would you use for money and why?
a double and a float are calculated and can result in “off by one” errors. All the Math functions built into C# only take double. If you were going to write a Money app you would need to rewrite the Math class and the Rounding methods because these built in classes uses Bankers Rounding which cause you to loose the remainder on any rounding.
What is OLAP?
Databases store information about business transactions, plus other data such as employee records. Those types of systems are called online transaction processing (OLTP) databases. OLTP data contains a wealth of information that can help you make informed decisions about your business. The process of analyzing your data for that type of information, and the data that results, are collectively called business intelligence.
You can spend a lot of time and money trying to extract business intelligence information from your database. The time and expense involved in retrieving answers (queried information) from databasesmeans that a lot of business intelligence information often goes unused. The reason: most operational databases are designed to store your data, not to help you analyze it. The solution: an online analytical processing (OLAP) database, a specialized database designed to help you extract business intelligence information from your data in a structured manner.
Microsoft® SQL Server™ 2000 (and newer versions) Analysis Services is a high-performance online analytical processing (OLAP) tool for performing data analysis and data mining.
Comparing yourself to your peers: how do I measure up?<br>The best way to measure yourself is to get involved with the tech. community, then you will have people to compare yourself to:<br>?Talking to others in your fieldabout things you know, want to know, and what they are doing provides insight into the skills and experience others possess.<br>?Read blogs, articles, and books by respected individuals (be “reachable” by the community)<br>–Join user groups (on-line only groups and groups in your local community)<br>–Research what people are discussing, think deeply about these topics and form your own opinions<br>–discuss your opinions with others<br>•With your friends, family, girlfriend even if they aren’t listening you will still be gaining a better understanding of these ideas<br>•at user group meetings and tech events (i.e. Code Camp)<br>•definitely on your own blog)<br>–“Must read” blogs: Martin Fowler, Scott Guthrie, Scott Hanselman, Phil Haack, Michael Knopf (shameless plug). To download a OPML file with subscriptions to these blogs and more go to http://www.mknopf.com/CMSFiles/Docs/blog-subscriptions.xmlsave it to your desktop, then “Import” it into Google Reader<br>?Perfect the fundamentals, then practice them some more, rinse and repeatComparing yourself to your peers: how do I measure up?
The best way to measure yourself is to get involved with the tech. community, then you will have people to compare yourself to:
?Talking to others in your fieldabout things you know, want to know, and what they are doing provides insight into the skills and experience others possess.
?Read blogs, articles, and books by respected individuals (be “reachable” by the community)
–Join user groups (on-line only groups and groups in your local community)
–Research what people are discussing, think deeply about these topics and form your own opinions
–discuss your opinions with others
•With your friends, family, girlfriend even if they aren’t listening you will still be gaining a better understanding of these ideas
•at user group meetings and tech events (i.e. Code Camp)
•definitely on your own blog)
–“Must read” blogs: Martin Fowler, Scott Guthrie, Scott Hanselman, Phil Haack, Michael Knopf (shameless plug). To download a OPML file with subscriptions to these blogs and download and save My Blog List
to your desktop, then “Import” it into Google Reader
?Perfect the fundamentals, then practice them some more, rinse and repeat