Scott Hanselman .NET

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

What is the GAC? What problem does it solve?

Each computer where the common language runtime is installed has a machine-wide code cache called the global assembly cache that stores assemblies specifically designated to be shared by several applications on the computer.

Is this valid? Assembly.Load("foo.dll");

No because "foo.dll" is not an assembly qualified name. THIS IS A QUALIFIED NAME: TopNamespace.SubNameSpace.ContainingClass+NestedClass, MyAssembly, Version=1.3.0.0, Culture=neutral, PublicKeyToken=b17a5c561934e089

What technology enables out-of-proc communication in .NET?

Remoting

What does this useful command line do? tasklist /m "mscor*"

It shows all the processes that loaded a DLL with a name matching the given pattern. In this case we will see all the processes using the .NET framework.

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

Assembly.Load is a dynamic reference since you're dynamically loading an external DLL at run-time. You would consider a static reference more like when you're adding a reference to a .NET project and building the project with that reference in place.

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

== opertator is to check identity. (i.e: a==b are these two are the same object?) .Equals() is to check value. (i.e: a.Equals(b) are both holding identical values?) With one exception: For string and predefined value types (such as int, float etc..), the operator == will answer for value and not identity. (same as using .Equals())

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

A strongly names assembly is signed using a public-private key pair. This means that external parties can verify that an assembly comes from a particular publisher and has not been modified from its original form. Things like the Global Assembly Cache would typically require assemblies to be strongly named for it to be registered.

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

A windows service always runs once the computer starts up (as long as it's so configured). A standard EXE only runs when a user is logged in, and will stop if the user logs out. You would use a windows service for things that always need to run even if nobody is logged in. You would use a standard EXE for programs that a user will run while logged in.

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

An interface is a contract: it specifies what members (methods and properties) a class implementing the interface must have. But because it is only a contract, it has no implementations for any of its members. A class can implement zero, one or multiple interfaces.

What is an Asssembly Qualified Name? Is it a filename? How is it different?

Assembly qualified name contains contains the full assembly name, the associated version, public key and other meta information. It is therefore not a filename as that is simple file name physically on file system. An qualified name or assembly names store much more Meta data as is very important by means of defining scope and using it in application and of course helping with the handling of versions.. TopNamespace.SubNameSpace.ContainingClass+NestedClass, MyAssembly, Version=1.3.0.0, Culture=neutral, PublicKeyToken=b17a5c561934e089

Describe the difference between a Thread and a Process?

Both processes and threads are independent sequences of execution. The typical difference is that threads (of the same process) run in a shared memory space, while processes run in separate memory spaces. A process is an executing instance of an application. What does that mean? Well, for example, when you double-click the Microsoft Word icon, you start a process that runs Word. A thread is a path of execution within a process. Also, a process can contain multiple threads. When you start Word, the operating system creates a process and begins executing the primary thread of that process. Another difference between a thread and a process is that threads within the same process share the same address space, whereas different processes do not. This allows threads to read from and write to the same data structures and variables, and also facilitates communication between threads. Communication between processes - also known as IPC, or inter-process communication - is quite difficult and resource-intensive.

What is the maximum amount of memory any single process on Windows can address? Is this different than the maximum virtual memory for the system? How would this affect a system design?

But, in a nutshell, 32 bit on 32 bit OS: 2 GB, unless set to large address space aware, in which case 3 GB. 32 bit on 64 bit OS: 2 GB, unless set to large address space aware, in which case 4 GB. 64 bit process: 2 GB, unless set to large address space aware, in which case it could address up to 8 TB, unless it is hosted on an Intel Itanium-based systems which is limited to 7 TB.

Can DateTimes be null?

DateTime is a value type, which, just like int and double, has no meaningful null value. In VB.NET, you can write this: Dim d As DateTime = Nothing But all this does is to set d to the default DateTime value. In C# the equivalent code would be this: DateTime d = default(DateTime); ...which is equivalent to DateTime.MinValue. That said, there is the Nullable<T> type, which is used to provide a null value for any value type T. The shorthand for Nullable<DateTime> in C# is DateTime?.

What is the difference between an EXE and a DLL?

EXE: It's a executable file When loading an executable, no export is called, but only the module entry point. When a system launches new executable, a new process is created The entry thread is called in context of main thread of that process. DLL: It's a Dynamic Link Library There are multiple exported symbols. The system loads a DLL into the context of an existing process.

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

Finalize() is called by the runtime (the GC) and Dispose() is called by the user.

How many processes can listen on a single TCP/IP port?

For TCP, no. You can only have one application listening on a single port at one time. Now if you had 2 network cards, you could have one application listen on the first IP and the second one on the second IP using the same port number.

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

Interface oriented approach compels to develop the software based on the contract. Object oriented approach emphasizes on its aspects like: Abstraction Encapsulation Inheritance Polymorphism Wikipedia has one of the best examples for this meta-programming. Assume you have a graphical class with many "set...()" methods. After each set method, the data of the graphics changed, thus the graphics changed and thus the graphics need to be updated on screen. Assume to repaint the graphics you must call "Display.update()". The classical approach is to solve this by adding more code. At the end of each set method you write void set...(...) { : : Display.update(); } If you have 3 set-methods, that is not a problem. If you have 200 (hypothetical), it's getting real painful to add this everywhere. Also whenever you add a new set-method, you must be sure to not forget adding this to the end, otherwise you just created a bug. AOP solves this without adding tons of code, instead you add an aspect: after() : set() { Display.update(); } And that's it! Instead of writing the update code yourself, you just tell the system that after a set() pointcut has been reached, it must run this code and it will run this code. No need to update 200 methods, no need to make sure you don't forget to add this code on a new set-method. Additionally you just need a pointcut:

How does the generational garbage collector in the .NET CLR manage object lifetime? What is non-deterministic finalization?

It divides the objects into three generations. The first generation is used for short lived objects and is collected often (its cheap to collect it). The other two generations are used for longer term object. Non-deterministic finalization means that it is not known when the object's finalizer is called since it is called when the GC decides to collect the object and not when the object falls out of scope etc.

What is the JIT? What is NGEN? What are limitations and benefits of each?

JIT means Just In Time compilation which means the code is being compiled just before it is supposed to run. This means longer startup time (because the code takes some time to compile) but more efficient compilation (since the compiler has more information about the target system etc.). NGen is used to pre-JIT code which yields faster startup time but the compiler produces less efficient code because it has less information.

Are the type system represented by XmlSchema and the CLS isomorphic?

No

What is a PID? How is it useful when troubleshooting a system?

PID stands for Process Identifier. It is a uniquely assigned integer that identifies a process in an OS. It is used in diagnosing the problems with the process in Multi-Tasking systems.

What is Reflection?

Reflection allows you to write code that can inspect various aspects about the code itself. It enables you to do simple things like: Check the type of an object at runtime (simple calls to typeof() for example) Inspect the Attributes of an object at runtime to change the behavior of a method (the various serialization methods in .NET) To much more complicated tasks like: Loading an assembly at runtime, finding a specific class, determining if it matches a given Interface, and invoking certain members dynamically. The earlier is much more common usage. The later is helpful to developers working on plug-in architectures for their applications or people who want to swap assemblies at runtime depending on configuration changes.

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

Strong typing: It checks the type of variables as soon as possible, usually at compile time. It prevents mixing operations between mismatched types. A strong-typed programming language is one in which: All variables (or data types) are known at compile time There is strict enforcement of typing rules (a String can't be used where an Integer would be expected) All exceptions to typing rules results in a compile time error Weak Typing: While weak typing is delaying checking the types of the system as late as possible, usually to run-time. In this you can mix types without an explicit conversion. A "weak-typed" programming language is simply one which is not strong-typed. which is preferred depeneds on what you want. for scripts and good stuff you will usually want weak typing, because you want to write as much less code as possible. in big programs, strong typing can reduce errors at compile time.

Corillian's product is a "Component Container." Name at least 3 component containers that ship now with the Windows Server Family.

System.Web.UI.Page, System.Windows.Forms.Form System.ComponentModel.Container Components are any version controlled reusable code elements and component container manages these either visually or not. For example the form is nothing more that visual component container of IComponent based controls that are rendered and the life cycle of which is managed. Important to note that not all component containers are visual in nature.

When you're running a component within ASP.NET, what process is it running within on Windows XP? Windows 2000? Windows 2003?

The ASP.NET worker process.

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

The using statement defines a scope at the end of which a given object will be disposed. Using the 'using statement' helps not to forget disposing of a disposable object. IDisposable is an interface used to define a way to dispose of objects in a deterministic manner. When the 'using statement' scope ends the Dispose() method is automatically called on the given object.

When would using Assembly.LoadFrom or Assembly.LoadFile be appropriate?

There are a lot of rules that govern how assemblies are loaded, and some of them have to do with how they resolve dependencies - if your AssemblyA is dependent on AssemblyB, where should .NET look to find AssemblyB? In the Global Assembly Cache, the same directory it found AssemblyA, or somewhere else entirely? Furthermore, if it finds multiple copies of that assembly, how should it choose which one to use? LoadFrom has one set of rules, while LoadFile has another set of rules. It is hard to imagine many reasons to use LoadFile, but if you needed to use reflection on different copies of the same assembly, it's there for you.

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

When using early-binding the call information is known at compile time. When using late-binding the call information is only known at runtime.

What is the difference between XML Web Services using ASMX and .NET Remoting using SOAP?

XML Web services are more restricted than objects exposed over .NET Remoting. XML Web services support open standards that target cross-platform use. XML Web services are generally easier to create and due to the restricted nature of XML Web services, the design issues are simplified. XML Web services support only SOAP message formatting, which uses larger XML text messages. Communication with .NET Remoting can be faster than XML Web service communication with a binary formatter. XML Web services are designed for use between companies and organizations. XML Web services don't require a dedicated hosting program because they are always hosted by ASP.NET. Consumers can use XML Web services just as easily as they can download HTML pages from the Internet. Thus there's no need for an administrator to open additional ports on a firewall as they work through MS-IIS and ASP.NET

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

out-of-proc requires marshaling between two processes and thus slower. An inproc server runs in the same process as the calling application. It's close to a normal function call on a dll. Calling an outproc server, data needs to be marshalled across the process boundry which is an expensive operation. An inproc server is fast but it can bring down your application.


Kaugnay na mga set ng pag-aaral

IT195 Customer Service Skills for the Service Desk Professional - Chapter 1 - NO TRUE/FALSE

View Set

PrepU CH 36: Management of Patients with Musculoskeletal Disorders

View Set

Chapter 21: Complications Occurring Before Labor and Delivery: PREPU

View Set

Chapter 4: Project Integration Management

View Set

MENTAL HEALTH CHAPTERS 1,2,9, & 27 (Halter)

View Set

how to find area and perimeter of shapes

View Set