Software Interview Questions (C#)

¡Supera tus tareas y exámenes ahora con Quizwiz!

General rules about exception

- Always use a finally. Guarantees cleanup - Use "throw;" to retain stack trace - Never throw "new Exception()". Create custom - Not use exception for validation errors - Always use "ToString()" to show whole stack trace

Describe the difference between a Thread and a Process?

A process is the computer program. And within that program you can have one or more threads. Threads are basically tasks that run in parralel

What is encapsulation?

(data hiding) - categorizing data as per their role i.e private, public, etc.

What's a delegate?

A delegate object encapsulates a reference to a method.

What's a multicast delegate?

A delegate that has multiple handlers assigned to it. Each assigned handler (method) is called.

Can you name examples of how an application can anticipate user behavior?

Analyze it and look for patterns. Use a Markov Model to predict next action based on previous N actions.

What does the keyword "virtual" declare for a method or property?

The method or property can be overridden.

Can you tell me something that you have learned about testing and quality assurance in the last year?

The more thorough the unit tests the fewer the bugs found

Apart from the IDE, which other favorite tools do you use that you think are essential to you?

Tortoise SVN, Anksvn, Continuous Integration, NUnit

C# provides a default constructor for me. I write a constructor that takes a string as a parameter, but want to keep the no parameter one. How many constructors should I write?

Two. Once you write at least one constructor, C# cancels the freebie constructor, and now you have to write one yourself, even if there's no implementation in it.

How can you make sure that changes in code will not affect any other parts of the product?

Unit testing

How would you change the format of all the phone numbers in 10,000 static html web pages?

Use textpad or write a simple program that would open all files and then search the text using a regular expression and find the old pattern and replace with new pattern

What is important when updating a product that is in production and is being used?

Well we try to do if off hours to minimize affect

When do you absolutely have to declare a class as abstract (as opposed to free-willed educated choice or decision based on UML diagram)?

When at least one of the methods in the class is abstract. When the class itself is inherited from an abstract class, but not all base abstract methods have been over-ridden.

Explain what's happening in the first constructor: public class c{ public c(string a) : this() {;}; public c() {;} } How is this construct useful?

When constructor public c(string a) is called to construct an object, it first calls the default constructor then the initialisation procedures in public c(string a).

Which items do you normally place under version control?

In our company we store most everything except the binary. Since we version every checkin to the truck we can recreate it with ease. We do however deploy some of the binary to a shared library for other project to reference.

Can you name some limitations of a web environment vs. a Windows environment?

In web everything is stateless, don't have access to the local system. Desktop apps are a pain to deploy

Can multiple catch blocks be executed for a single try statement?

No. Once the proper catch block processed, control is transferred to the finally block .

Can you declare an override method to be static if the original method is not static?

No. The signature of the virtual method must remain the same. (Note: Only the keyword virtual is changed to keyword override)

Can you name a number of non-functional (or quality) requirements?

Non functional requirements are qualities of the system. Execution qualities (security, usability), Evolution qualities (scalability, testability)

Can you name different measures to guarantee correctness and robustness of data in an architecture?

Not sure on this but i know validation and unit testing play a big part.

What is the difference between typeof(foo) and myFoo.GetType()?

Nothing other than the second requires a non-nullable object

Contrast the use of override with new. What is shadowing?

Override is used to do true polymorphism. The use of New is another way to achieve something similar to it

What is the syntax to inherit from a class in C#?

Place a colon and then the name of the base class. Example: class MyNewClass : MyBaseClass

When do you use polymorphism and when do you use delegates?

Polymorphism is used when you want override functionality when inheriting a class. Its about shared classes and shared contracts. Delegates are used when you want to create events

Explain the three services model commonly know as a three-tier application?

Presentation (UI), Business (logic and underlying code) and Data (from storage or other sources).

What is inheritance?

Provides the real world genetic mechanism as what's there in the parent would be there in the child too(or not).

Write a standard lock() plus "double check" to create a critical section around a variable access.

object someObject; lock(someObject) { // stuff in here is locked }

What types of problems have you encountered most often in your products after deployment?

simple bugs not covered in unit tests

Which tools are essential to you for testing the quality of your code?

unit testing framework

Can you name a number of different techniques for specifying requirements? What works best in which case?

...

Why is catch(Exception) almost always a bad idea?

1. Since theres no variable defined you can't read the exception 2. Generally its bad to use exception when you have known exception types.

When do you absolutely have to declare a class as abstract?

1. When the class itself is inherited from an abstract class, but not all base abstract methods have been overridden. 2. When at least one of the methods in the class is abstract.

How would you store the results of a soccer/football competition (with teams and scores) in an XML document?

<results> <teams> <team> <name /> </team> </teams> <games> <game> <date></date> <team1></team1> <team2></team2> <team1Score></team1Score> <team2Score></team2Score> </game> </games> </results>

What's the C# syntax to catch any possible exception?

A catch block that catches the exception of type System.Exception. You can also omit the parameter data type in this case and just write catch {}.

Explain the use of abstract class.

A class with implementation that cannot be instantiated. An abstract class is a class that must be inherited and have the methods overridden.

What class is underneath the SortedList class?

A sorted HashTable.

What are the tenants of object oriented design

Abstraction, Polymorphism, Inheritance, Encapsulation

Do you know about design patterns? Which design patterns have you used, and in what situations?

Active Record = CSLA Factory = Dependency Injection Singleton = Logger

What is the difference between an EXE and a DLL?

An exe is an executible program. A DLL (Dynamic Link Library) is a file that can be loaded and executed by programs dynamically. Basically it's an external code repository for programs. Since usually several different programs reuse the same DLL instead of having that code in their own file, this dramatically reduces required storage space. A synonym for a DLL would be library. DLL does not have main function but exe has main function. Here DLL is inprocess component, both component and consumer will share same memory and Exe is out process component, it will run in its own memory.

Describe what an Interface is and how it's different from a Class.

An interface is basically a contract. The class contains the actual implementation, which can inherit from an interface

Can you name the responsibilities of the user, the customer and the developer in the requirements process?

At our company the users are the ones that help the customer figure out what the requirements will be. They query the user for feedback to find out what does and doesn't work for them. Then the customer writes the requirements based on that feedback and their own needs. That info is then forwarded to the developers so a design can be done and implemented.

How would you manage changes to technical documentation, like the architecture of a product?

At our company we use an enterprise wiki to manage our documentation. We then can send out notifications if this document is updated in anyway. However most of the time this comes up in our daily meetings

By what mechanism does NUnit know what methods to test?

Attributes and reflection

Can you explain what Test-Driven Development is? Can you name some principles of Extreme Programming?

Basically this means when designing behaviors you first will write a test to verify it. At first it should fail and as you get it implemented and working the test should pass. Not sure on the other but i assume it means doing regular testing and integration.

How can you sort the elements of the array in descending order?

By calling Sort() and then Reverse() methods.

XSS?

Cross-Site Scripting. A way of injecting browser scripting into a request to steal user info or hijack a session.

When you inherit a protected class-level variable, who is it available to?

Classes in the same namespace.

What measures have you taken to make your software products more easily maintainable?

Coding standards are key. We also design things to be testable which give you a benefit of generally being maintainable.

What do low coupling and high cohesion mean? What does the principle of encapsulation mean?

Coupling refers to how strongly or loosely components in a system are tied together. You want that to be low. Cohesion refers to how well the individual parts of a unit of code fit together for a single purpose. Encapsulation is about containing implementation of code so that outsiders don't need to know how it's works on the inside. By doing so you can reduce negative effects of coupling.

How do you manage conflicts in a web application when different people are editing the same data?

Database transactions can help. You can also have a checkout mechanism that will allow users to know that someone is editing it.

What is the difference between Debug.Write and Trace.Write? When should each be used?

Debug.Write is for debug code only. It is generally disabled in release builds. Trace.Write is for non-debug compilations. You still have to be careful in regards to writing to much data

What is the problem of using different colors when highlighting pieces of a text?

Depending on the colors it might make it hard to read

How can you overload a method?

Different parameter data types, different number of parameters, different order of parameters.

What are the different ways a method can be overloaded?

Different parameter data types, different number of parameters, different order of parameters.

Can you name different techniques for prototyping an application?

Drawing a diagram, Writing a simple application to prove the concept, work with real users

Is using Assembly.Load a static reference or dynamic reference?

Dynamic references are constructed on the fly as a result of calling various methods, such as System.Reflection.Assembly.Load

How would you find non matching records in sql

FULL OUTER JOIN. Returns records regardles of matching. WHERE t.SomeFieldId IS NULL

What is the difference between Finalize() and Dispose()?

Finalize it ran by the garbage collector and is not deterministic. Dispose is the opposite in that its deterministic. If you call the releases are released immediately

Can you describe the process you use for writing a piece of code, from requirements to delivery?

First i work with our BA's to go over what exactly the requirements are. I then do a formal review and put together a set of initial questions. After that i do the tech design, prototype and estimate. I then have another meeting with the BA's to go over it and make sure we are all on the same page. We then formalize a set of tasks for the developers and do the work. We generally deliver the project in pieces so some things can begin testing...

How do you make sure that your code can handle different kinds of error situations?

First off i'd identify normal error conditions, then write unit tests for those. Also everything should be wrapped in a try catch. If you have specific types of exceptions you want to handle they should go first in the catch blocks, while ending in a generic Exception block.

Can DateTimes be null?

No. However wrapping it in the Nullable<> or ? will allow it

How do you deal with changes that a customer wants in a released product?

Generally those request are entered into our issue tracking software and then prioritized by the project manager. Unless the request is a hotfix that must go up immediately then its added to the monthly release schedule.

Juxtapose the HTTP verbs GET and POST. What is HEAD?

Get = Url only Post = Url and Form Head = script and metadata

When would you use a class with static members and when would you use a Singleton class?

I generally use static members on class that have reusable functionality or helper classes that can easily be encapsulated in a method. I use singletons when the logic is to complex for just a method.

What's the .NET collection class that allows an element to be accessed using a unique key?

HashTable.

How do you find the middle item in a linked list?

I actually haven't worked with linked list in C#. I believe they exist in 4.0.

Do you know what a baseline is in configuration management? How do you freeze an important moment in a project?

I believe baseline is basically a package that includes everything not just the incremental changes. We do this with our database changes. If I understand the freezing question we do this a lot with software in regards to freezing the code at a certain version so it can be prepared for deployment to another system

Which is faster: finding an item in a hashtable or in a sorted list?

I believe the hashtable is faster but i don't use them that much so i'd have to confirm that.

How do you make sure that your code is both safe and fast?

I build for reliability first. If performance is an issue i start to make small tweaks and do more profiling.

What kind of tools are important to you for monitoring a product during maintenance?

I don't do that work

Do you know what a stateless business layer is? Where do long-running transactions fit into that picture?

I presume is a layer that is self contained in regards to functions. Each function doesn't rely on state data from another call. Long running processes fit nicely in that once you fire off the process it has all the info it needs

What is the last thing you learned about data structures from a book, magazine or web site?

I read an MSDN article about geometry types and function in sql server 2008

What is the last thing you learned about algorithms from a book, magazine or web site?

I read an msdn article about code contract in .net 4.0

Do you know what code coverage is? What types of code coverage are there?

I think this has to do with how much code is covered by unit tests

What is your advice when a customer wants high performance, high usability and high security?

I would say to some degree each of these attributes affect the others in a negative way. For instance if performance is key I will remove as many bottle necks as possible which could be usability and security. It doesn't mean they won't be there but might not be as robust.

Can you name an example of a recursive solution that you created?

I wrote a custom parser that had to use recursion to read delimited data within delimited data. Think of it as levels of data

How would you store a vector in N dimensions in a datatable?

I'd need more info

What kind of tests would you include for a smoke test of an ecommerce web site?

I'd want some kind of test to make sure you can add product to a basket it calculates everything properly and is able to process the credit card without issue

How do you prioritize requirements? Do you know different techniques?

I'm not sure of any techniques, but when I start to design a system I first look at what the data structure would look like to support the needs of the requirements. From there I move on to the code structure needed to support it.

How is the using() pattern useful? What is IDisposable? How does it support deterministic finalization?

If something supports IDisposable a using statement can be used. It make for a guaranteed way of calling dispose as you exit scope of the using statement regardless of an exception occurring.

What's wrong with a line like this? DateTime.Parse(myString);

If the string is not parsable it will throw an exception. TryParse is a better way

Can you name examples of anticipating changing requirements in your code?

If you do TDD, your code is generally easily changeable because of its modularity.

What is the difference between in-proc and out-of-proc?

In-proc - Com object is present within application process, Activex Dll, Faster, Useful for local com Out-Proc - Com object has it's own process area, Activex.exe, Comparitively slower, Useful for remote com

What is an interface class?

Interfaces, like classes, define a set of properties, methods, and events. But unlike classes, interfaces do not provide implementation. They are implemented by classes, and defined as separate entities from classes.

What is the GAC? What problem does it solve?

Is like a registry for .net components. It solves the problem of having multiple version of components running side-by-side

Explain C# "is" keyword?

It allows you to check if a object is a certain type. Ex. if (o is string)

What benefit does your code receive if you decorate it with attributes demanding specific Security permissions?

It allows you to do security checks to will determine if the code can actually run.

What is FullTrust? Do GAC'ed assemblies have FullTrust?

It basically means you can run native code, read from the Registry and Windows Event Log, and to read and write to files outside of the application's path. I believe they do.

How would you model user authorization, user profiles and permissions in a database?

It depends on how normalized you want the data. But generally tend to make things as granular as possible

Where is a protected class-level variable available?

It is available to any sub-class derived from base class

Describe the accessibility modifier "protected internal".

It is available to classes that are within the same assembly and derived from the specified base class.

Explain the use of internal.

It means all objects within the file can access it

Explain the use of virtual.

It means its defined to be overridable

How is a strongly-named assembly different from one that isn't strongly-named?

It means its versionable and can be installed in side-by-side mode in the GAC

Explain the use of private.

It means they are only accessible within the scope of the object they are declared in.

What is WIF?

It stands for Windows Identity Foundation. Allows you to externalize identity logic from application. Is cloud friendly. Appears to be like a single logon type api

Explain C# "as" keyword?

It will cast the object to the type specified, if not possible it will return NULL. Ex. var c = someObject as Customer;

Describe the accessibility modifier protected internal.?

It's available to derived classes and classes within the same Assembly (and naturally from the base class it's declared in).

What happens if you inherit multiple interfaces and they have conflicting method names?

It's up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you're okay.

Describe the difference between Interface-oriented, Object-oriented and Aspect-oriented programming.

Iterface programming is contract based, Object oriented is a way to write very granular objects which try to have a single purpose, Aspect Oriented Programming is to seggregate the code in such a way the primary tasks are carried by different objects and the secondary jobs are carried out by independent objects.

Is string a value type or a reference type?

Its a reference type

Do you know what load balancing is? Can you name different types of load balancing?

Its a way of distributing the workload. We load balance our web environment using a hardware appliance.

What is Reflection?

Its a way of reading metadata of an object.

Do you know what a regression test is? How do you verify that new changes have not broken existing features?

Its basically running a series of unit tests to verify a new change did not break anything.

What's an antipattern

Its coding in a way that will inheritantly lead to code issues. Ex. not using "using()", not exposing fields through properties, etc

What kinds of diagrams have you used in designing parts of an architecture, or a technical design?

Just typical flowcharts that show how data flows through components. I generally use visio

Which controls would you use when a user must select multiple items from a big list, in a minimal amount of space?

Listbox set as multi select and with a fixed size

Can you name reasons why maintenance of software is the biggest/most expensive part of an application's life cycle?

Maintenance doesn't have to be the most expensive if you put good processes in place (unit testing, etc)

How would one do a deep copy in .NET?

Mark the object with the serialization attribute. Then use the serialization functions

What is polymorphism?

Means same look and feel but different functional ability. Its about shared contracts

Can you name different ways of designing access to a large and complex list of features?

Menu bar, Ribbon control, in web you have lots of other options

Can you store multiple data types in System.Array?

No

Does C# support multiple-inheritance?

No

Can you override private virtual methods?

No, moreover, you cannot access private methods in inherited classes, have to be protected in the base class to allow any sort of access

Does C# support multiple inheritance?

No, use interfaces instead.

In the context of a comparison, what is object identity versus object equivalence?

OI = 2 objects referencing same memory OE = 2 objects that are only equal by an equality function For example, if x = 3 and y = 3, then x and y are equivalent but not identical.

Contrast OOP and SOA. What are tenets of each?

OOP = A computer-programming methodology that focuses on data items rather than processes. SOA = The modularization of business functions for greater flexibility and reusability.

How can you debug a system in a production environment, while it is being used?

One way we have done it is turning on the debug logging to see whats happening. If the app was deployed with debugging symbols its possible to attach to the process and debug it in visual studio, but i try to avoid that

Explain the use of protected.

Only the inheriting class has access

What are PDBs? Where must they be located for debugging to work?

PDB's contain the symbols needing for debugging. They must be in the same location where the dll or exe is running from.

How do you search and find requirements? What are possible sources?

People, documentation

How do you inherit from a class in C#?

Place a colon and then the name of the base class.

What is the difference between a queue and a stack?

Queue = First In, First Out Stack = Last In, First Out

What is the difference between re-engineering and reverse engineering?

Re-engineering is basically improving on work that is already done. Reverse engineering is looking at code and rewriting it from scratch.

What is REST?

Representational State Transfer. Simple http verbs used to do all crud operations

Explain the importance and use of each component of this string: Foo.Bar, Version=2.0.205.0, Culture=neutral, PublicKeyToken=593777ae2d274679d

Since this is strong named it will allow for this component to be installed along side another version of itself in the GAC.

What is SAAS?

Software as a service. Basically this thin client cloud based applications. Ex. Email Client... Azure

What's the advantage of using System.Text.StringBuilder over System.String?

StringBuilder is more efficient in cases where there is a large amount of string manipulation. Strings are immutable, so each time a string is changed, a new instance in memory is created.

What is strong-typing versus weak-typing? Which is preferred? Why?

Strong type is checking the types of variables at compile time. Weak typing is checking the types of the system at run-time. Strong typing is generally preferred to minimize bugs

What is the difference between a Struct and a Class?

Structs are value-type variables and are thus saved on the stack, additional overhead but faster retrieval. Another difference is that structs cannot inherit.

Which class is at the top of .NET class hierarchy?

System.Object

What's the difference between System.String and System.Text.StringBuilder classes?

System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.

Do you know the differences between tags and branches? When do you use which?

Tags are for versioning releases and branches are temporary holding places for doing changes. Branches are deleted once those changes are merged with the trunk.

What do you care about most when reviewing somebody else's code?

That it follows the set a standards setup for the company. I also look for clean and testable code.

How would you model the animal kingdom (with species and their behavior) as a class system?

Thats a tricky one. I'd first have to get a good understanding before i could model it. It would definitely utilize a lot base classes and interfaces. As complex as the animal kingdom is i'd also think i'd need multiple inheritance, which is not supported.

Is it namespace class or class namespace?

The .NET class library is organized into namespaces. Each namespace contains a functionally related group of classes so natural namespace comes first.

What's the difference between the System.Array.CopyTo() and System.Array.Clone()?

The Clone() method returns a new array (a shallow copy) object containing all the elements in the original array. The CopyTo() method copies the elements into another existing array. Both perform a shallow copy. A shallow copy means the contents (each array element) contains references to the same object as the elements in the original array. A deep copy (which neither of these methods performs) would create a new instance of each element's object, resulting in a different, yet identacle object.

What does the term immutable mean?

The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.

What is the difference between: catch(Exception e){throw e;} and catch(Exception e){throw;}

The first throws a new exception which doesn't include the stack trace. The second does. Most times you want to preserve the stack trace

Can you name the different tiers and responsibilities in an N-tier architecture?

The norm is UI, Data, Business. However you really can have many more layers depending on the needs.

Do you know about the Traveling Salesman Problem?

The problem asks us to find the shortest path that visits every node in a graph.

What is the difference between storing data on the heap vs. on the stack?

The stack is smaller, but quicker for creating variables, while the heap is limited in size only by how much memory can be allocated.

What is this? Can this be used within a static method?

The this keyword refers to the current instance of the class. It cannot be use within a static method, because static method doesn't live in an instance object type.

How can you make sure that team members know who changed what in a software project?

The way we track this is through checkins to the repository truck of the project. Then using the tools we have we can see modified what files when.

Why can't you specify the accessibility modifier for methods inside the interface?

They all must be public, and are therefore public by default.

Why can't you specify the accessibility modifier for methods inside the interface?

They all must be public. Therefore, to prevent you from getting the false impression that you have any freedom of choice, you are not allowed to specify any accessibility, it's public by default.

What are metaphors used for in functional design? Can you name some successful examples?

They are I'd use the car as an example. You have many parts the make up a car. Each of those parts should have a specific responsibility. Think of those parts as modules. If you put all the modules together you have program.

Explain how cookies work. Give an example of Cookie abuse.

They are name value pairs that can be stored in the browser for a specific domain. They are used to store basic settings, etc. They are passed to the server on every request. They can be used for tracking

What is the difference between a.Equals(b) and a == b?

They both are do equality checks, however the first one would not allow nulls

How do you treat changing requirements? Are they good or bad? Why?

They can be good and bad depending on the situation. If a requirement change requires a significant design change than that can be bad because it will affect the schedule, however if the change comes early enough and can be factored into the design with minimal impact, then all is good.

What is unboxing?

This is taking an object and turning it back into a value type or other object type

What is boxing?

This is the take a value type and turning it into an object

Explain the use of override.

This is used to override functionality from a base class. This is polymorphism

Explain the use of public.

This means anyone can use the class

Explain the use of sealed.

This means no other class can inherit from it

How do you find out if a number is a power of 2? And how do you know if it is an odd number?

To be honest i'm not much of a math guy anymore. I'd have to look that up

What's the implicit name of the parameter that gets passed into the class' set method?

Value, and it's datatype depends on whatever variable we're changing.

What's the implicit name of the parameter that gets passed into the set method/property of a class?

Value. The data type of the value parameter is defined by whatever data type the property is declared

Explain argument of out?

Variable does not need to be explicitly initialized. Changes will be reflected in the variable.

Explain argument of ref?

Variable must explicitly be initialized. Changes will be reflected in the variable.

What can you do reduce the chance that a customer finds things that he doesn't like during acceptance testing?

We do unit testing and then we do qa testing. This generally minimizes this

What do you do with requirements that are incomplete or incomprehensible?

We query the customer for clarification and if necessary ask for them to update the requirements documents accordingly

How do you create technical documentation for your products?

We use a product called Sandcastle

How do you find an error in a large file with code that you cannot step through?

Well if you have good exception logging you could look at the stack trace it produces. If you got debugging symbols then you can get the line number

Why are out parameters a bad idea in .NET? Are they?

Well it means you want two return values, which means your design needs work

How is method overriding different from method overloading?

When overriding a method, you change the behavior of the method for the derived class. Overloading a method simply involves having another method with the same name within the class.

What is abstraction?

Which means making things loosely coupled so that in future they can be easily handled without affecting the system.

What is a Windows Service and how does its lifecycle differ from a "standard" EXE?

Windows Service applications are long-running applications that are ideal for use in server environments. The applications do not have a user interface or produce any visual output. Any user messages are typically written to the Windows Event Log. Services can be automatically started when the computer is booted. They do not require a logged in user in order to execute and can run under the context of any user including the system. Windows Services are controlled through the Service Control Manager where they can be stopped, paused, and started as needed.

Can you name any differences between object-oriented design and component-based design?

Would object oriented design be encapsulated to some degree in component based design

Can you name some different text file formats for storing unicode characters?

Wouldnt it have to be a unicode file format. There are a few of those

Can you name different measures to guarantee correctness of data entry?

Writing validators that then show the user information about what the problem is. You will also want to unit test these

Will the finally block get executed if an exception has not occurred?

Yes

Can attributes be placed on specific parameters to a method? Why is this useful?

Yes, However I've actually never used before so i can not comment

Are private class-level variables inherited?

Yes, but they are not accessible, so looking at it you can honestly say that they are not inherited.

Are private class-level variables inherited?

Yes, but they are not accessible.

Can you allow class to be inherited, but prevent the method from being over-ridden?

Yes, just leave the class public and make the method sealed.

If a base class has a bunch of overloaded constructors, and an inherited class has another bunch of overloaded constructors, can you enforce a call from an inherited constructor to an arbitrary base constructor?

Yes, just place a colon, and then keyword base (parameter list to invoke the appropriate constructor) in the overloaded constructor definition inside the inherited class.

If a base class has a number of overloaded constructors, and an inheriting class has a number of overloaded constructors; can you enforce a call from an inherited constructor to a specific base constructor?

Yes, just place a colon, and then keyword base (parameter list to invoke the appropriate constructor) in the overloaded constructor definition inside the inherited class.

Can you prevent your class from being inherited and becoming a base class for some other classes?

Yes, that's what keyword sealed in the class definition is for. The developer trying to derive from your class will get a message: cannot inherit from Sealed class WhateverBaseClassName. It's the same concept as final class in Java

Can you inherit multiple interfaces?

Yes. .NET does support multiple interfaces.

Can you allow a class to be inherited, but prevent the method from being over-ridden?

Yes. Just leave the class public and make the method sealed.

Can you prevent your class from being inherited by another class?

Yes. The keyword "sealed" will prevent the class from being inherited.

Are threads reused in ASP.NET between reqeusts? Does every HttpRequest get its own thread? Should you use Thread Local storage with ASP.NET?

Yes. They are pooled

How can you reduce the user's perception of waiting when some functions take a lot of time?

You can do these tasks asynchronously or maybe show some kind of progress info

In an array with integers between 1 and 1,000,000 one value is in the array twice. How do you determine which one?

You could easily do this with linq to find the distinct, then get a count where its greater than 1.

How can you implement unit testing when there are dependencies between a business layer and a data layer?

You mock the dependencies

Conceptually, what is the difference between early-binding and late-binding?

early = compile time, late = runtime. Reflection is considered late binding

In Linq whats the syntax for a join?

from t1 in db.Table1 join t2 in db.Table2 on t1.field equals t2.field select new { t1.field2, t2.field3}

What kind of data is passed via HTTP Headers?

script and metadata

What does this do? sn -t foo.dll

this will create a strong name key. You need this if you want to do proper versioning


Conjuntos de estudio relacionados

Chapter 9: Pathways That Harvest Chemical Energy

View Set

KONSEP ALAM MELAYU DARI SEGI GEOGRAFI , BAHASA DAN BUDAYA

View Set

Intro to Health Informatics Final Study Guide

View Set

Power Engineering 4th Class Ch 114

View Set

LECOM Post-Bacc Spring Exam 3 MCQ

View Set