Ans:- A process is a collection of virtual memory space, code, data, and system resources. A thread is code that is to be serially executed within a process. A processor executes threads, not processes, so each application has at least one process, and a process always has at least one thread of execution, known as the primary thread. A process can have multiple threads in addition to the primary thread
Thread – is stream of executable code within process. They are light weight process.
All thread with in a process share process instruction,code & data segment,open file descriptor,signal handler,userID and GroupID. Thread has its own set of register including program counter,stack pointer
The major difference between threads and processes is
1.Threads(Light weight Processes) share the address space of the process that created it; processes have their own address.
2.Threads have direct access to the data segment of its process; processes have their own copy of the data segment of the parent process.
3.Threads can directly communicate with other threads of its process; processes must use interprocess communication to communicate with sibling processes. 4.Threads have almost no overhead; processes have considerable overhead.
5.New threads are easily created; new processes require duplication of the parent process.
6.Threads can exercise considerable control over threads of the same process; processes can only exercise control over child processes.
7.Changes to the main thread (cancellation, priority change, etc.) may affect the behavior of the other threads of the process; changes to the parent process does not affect child processes.If we consider running a word processing program to be a process, then the auto-save and spell check features that occur in the background are different threads of that process which are all operating on the same data set (your document).
Q2) What is a Windows Service and how does its lifecycle differ from a "standard" EXE?
Ans:- A service opens before you even get to the login screen, whereas a standard exe cannot open until after you have logged on.
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.
Q3) 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?
Ans:- Processes access virtual memory space, not physical memory. Applications never access RAM directly but only through the memory management interface of the processor.
Depending on which version of Windows you are using, and how the program was compiled there is a differnt maximum ammount of addressable memory.
All 32 bit processes on 32bit Windows have a 4GB virtual address space. The upper 2GB is common to all processes and is used by the system. The lower 2GB is private to each process and is inaccessable to all others. Unless the program was compiled as large address aware, in which case it will have 3GB of private address space.
For 32bit processes on 64bit Windows, each process has 2GB private address space, unless compiled large address aware in which case it has 4GB private adress space.
For 64bit processes on 64bit windows each process has 8TB of private address space whilst compiled as large address aware. The 2GB address space limit remains for programs not compiled as large address aware.
This is completely independent of the size of RAM or the pagefile. The system maps physical memory into this virtual address space according to both need and availability.
At any given time the data in virtual memory space might be stored in RAM, on disk, or both. All of this is totally transparent to all applications. Frequently accessed data will be kept in RAM with the remainder left on disk.
Q4) What is the difference between an EXE and a DLL?
Ans:- 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.
Q5) What is strong-typing versus weak-typing? Which is preferred? Why?
Ans:- Weak typing is where a language allows you to treat blocks of memory defined as one type as another (casting). Languages like C and C++, although statically typed, are weakly typed.
Languages like Perl and PHP are weakly typed because you can do things like adding numbers to strings and the language will do an implicit coercion for you.
Languages like Java, C# and Python are strongly typed - there is no way you can add a number to a string without doing an explicit conversion.
Q6) Corillian's product is a "Component Container." Name at least 3 component containers that ship now with the Windows Server Family.
Q7) What is a PID? How is it useful when troubleshooting a system?
Ans:- 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.
Q8) How many processes can listen on a single TCP/IP port?
Ans:- Only one. If there was more than one process listening on the same port, then there would be no way of knowing which process incoming data was intended for.
Q9) What is the GAC? What problem does it solve?
Ans:- ach computer on which the common language runtime is installed has a machine-wide code cache called the global assembly cache (GAC). Assemblies deployed in the global assembly cache must have a strong name. A developer tool named "Global Assembly Cache tool" (Gacutil.exe), provided by the .NET Framework SDK can be used to deploy assemblies to GAC. The global assembly cache stores assemblies specifically designated to be shared by several applications on the computer. It provides us the way to overcome "DLL Hell" problem also.
Mid-Level .NET Developer
Q1) Describe the difference between Interface-oriented, Object-oriented and Aspect-oriented programming.
Ans:- Aspect-Oriented:-
Aspect-oriented programming looks at how many components or pieces of a system might need to interact. The intersections of these pieces are what are important in AOP. \"Crosscutting\" is a slice across several units, all of which interact during some operation
Interface-Oriented:-
Interface-oriented programming is a contract-based approach. Nether side of the interface cares how the other does its work, only that the two sides can communicate via an agreed-upon contract. WSDL-based web services are the prime example of this.
a contract between
Interface oriented programming defines two parties - a rule that both stick to and neither care how the other is providing the functionality. Classic example would be COM.
Object-Oriented:-
Object-Oriented programming is based on abstraction, encapsulation (data hiding), polymorphism and inheritance. Classes implement these concepts to build objects controlling or implementing a system.
Abstraction allows loose coupling between components by providing a layer between objects so that one object isn't concerned with how the other implements its business rules. (Interfaces, layers) Great stuff when you want to isolate parts of the system so they can be swapped out without killing the rest of the sytsem.
Encapsulation allows abstraction to work by hiding details of a class's implementation from calling classes. (Public vs. private fields)
Inheritance enables base (parent) classes to have common functionality defined in it and passed down to child classes. A Shape class might have a field for color which is inherited by child classes of Square or Circle type.
Polymorphism enables implementation of same-named public fields, allowing different classes to perform different actions on the same call - rendering a Square or Circle object differently in a graphic program, even though they might both be subclassed from a base Shape class. (Overriding)
Q2) Describe what an Interface is and how it’s different from a Class.
Ans:- In Interface,we cannot specify any definition inside butwhere as class we can.
interface is differ from the class by class can access the interface but interface cannot access the class
Q3) What is Reflection?
Ans:- Reflection is a collection of classes which allow you to query assembly (classes/objects) metadata at runtime. Using reflection you can also create new types and their instances at runtime and invoke methods on these new type instances.
There are other uses for reflection. Compilers for languages such as JScript use reflection to construct symbol tables.
In .Net the classes in the System.Runtime.Serialization namespace use reflection to access data and to determine which fields to persist. You can use System.Reflection.Emit namespace to dynamically generate types.
Q4) What is the difference between XML Web Services using ASMX and .NET Remoting using SOAP?
Ans:- XML Web services offer a simpler model for distributed applications than that provided by .NET Remoting. XML Web services are fine-tuned for Internet scenarios and cross-platform use. Although you can apply .NET Remoting in these scenarios, thanks to its SOAP formatter and HTTP channel, .NET Remoting is more suitable as a high-speed solution for binary communication between proprietary .NET components, usually over an internal network. And although XML Web services can't match the communication speed of .NET Remoting over a binary channel, they still lend themselves to high-performance designs thanks to their stateless nature and ASP.NET's multithreaded hosting service.
Here's a quick overview of the major differences between the XML Web service and .NET Remoting technologies:
XML Web services are more restricted than objects exposed over .NET Remoting. An XML Web service works in a similar way to a SingleCall .NET Remoting object. It isn't possible to create a singleton or a client-activated object.
Because of the restricted nature of XML Web services, the design issues are simplified. XML Web services are generally easier to create than remotable components (and easier to design well).
Communication with .NET Remoting can be faster than XML Web service communication if you use a binary formatter. XML Web services support only SOAP message formatting, which uses larger XML text messages.
XML Web services support open standards that target cross-platform use. For example, each .NET XML Web service has an associated WSDL document that describes how a client can interact with the service. Therefore, any client that can parse an XML message and connect over an HTTP channel can use an XML Web service, even if the client is written in Java and hosted on a UNIX computer.
XML Web services are designed for use between companies and organizations. They can use a dynamic discovery mechanism or a UDDI registry that "advertises" services to interested parties over the Internet.
XML Web services don't require a dedicated hosting program because they are always hosted by ASP.NET. That also means that they gain access to some impressive platform services, including data caching, Web farm-ready session state management, authentication, and an application collection for global, shareable objects. These features, if required, can be extremely difficult to re-create by hand in a component exposed through .NET Remoting.
Because XML Web services work through Microsoft Internet Information Services (IIS) and ASP.NET, they can communicate with clients using the default HTTP channel (usually port 80). This means that consumers can use XML Web services just as easily as they can download HTML pages from the Internet. There's no need for an administrator to open additional ports on a firewall.
Q5) Are the type system represented by XmlSchema and the CLS isomorphic?
Q6) Conceptually, what is the difference between early-binding and late-binding?
Ans:- Late binding is implemented when you do not know which function will be called, though early binding is faster then latebinding.
(Early Binding is also called static binding or compile time binding)
(Late Binding is also called dynamic binding or runtime binding)
Q7) Is using Assembly.Load a static reference or dynamic reference?
Ans:- 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.
Q8) When would using Assembly.LoadFrom or Assembly.LoadFile be appropriate?
Q9) What is an Asssembly Qualified Name? Is it a filename? How is it different?
Ans:- A strong-named assembly has a fully qualified name that includes the assembly's name, culture, public key, and version number. The runtime uses this information to locate the assembly and differentiate it from other assemblies with the same name.
For example an assembly MyLibrary can have the name
"myTypes, Version=1.0.1234.0, Culture="en-US", PublicKeyToken=b77a5c561934e089c
The version info has major,minor ,build,revision numbers
Q10) Is this valid? Assembly.Load("foo.dll");
Ans:- sure if you know the absolute path.
Q11) How is a strongly-named assembly different from one that isn’t strongly-named?
Ans:-
Q12) Can DateTimes be null?
Ans:- DateTime t = null; Is the above statement valid ?
Its not actually a datetime-value, but a datetime-object, which contains a datetime value.. and as we know of objectreferences, they can be null.
Q13) What is the JIT? What is NGEN? What are limitations and benefits of each?
Ans:- all source code is converted to IL(inertmediate language) and using JIT il is convet to machine code.this is come in CLR(managed code) this is used in runtime environment.
types
1.pre-JIT in that all source code is complied at one time on one complication.
2.Econo-JIT in that this complied the methods which arec called at runtime .
3.normal-JIT in that this complied the methods which arec called at runtime.The methods which are compiled at first time these are kept in cache and when need refer from it.
in that this called the methods at only
The Native Image Generator (Ngen.exe) is a tool that improves the performance of managed applications. Ngen.exe creates native images, which are files containing compiled processor-specific machine code, and installs them into the native image cache on the local computer. The runtime can use native images from the cache instead using the just-in-time (JIT) compiler to compile the original assembly.
Q14) How does the generational garbage collector in the .NET CLR manage object lifetime? What is non-deterministic finalization?
Q15) What is the difference between Finalize() and Dispose()?
Ans:- Design Pattern : If your classes use unmanaged resources you need to implement both Dispose & Finalize. Dispose() is called by user code that is the code that is using your class.
Finalize/Destructor cannot be called by User code it's called by Garbage Collector
Finalize : Is a destructor called by Garbage Collector when the object goes out of scope. Implement it when you have unmanaged resources in your code and want to make sure that these resources are freed when the Garbage collection happens.
Dispose : Same purpose as finalize to free unmanaged resources. However implement this when you are writing a custom class that will be used by other users. Overriding Dispose() provides a way for the user code to free the unmanaged objects in your custom class.
As an aside here's how the GC works:
The garbage collector keeps track of objects that have Finalize methods using an internal structure called the finalization queue. Each time your application creates an object that has a Finalize method the garbage collector places an entry in the finalization queue that points to that object. The finalization queue contains entries for all the objects in the managed heap that need to have their finalization code called before the garbage collector can reclaim their memory.
Implementing Finalize methods or destructors can have a negative impact on performance and you should avoid using them unnecessarily. Reclaiming the memory used by objects with Finalize methods requires at least two garbage collections. When the garbage collector performs a collection it reclaims the memory for inaccessible objects without finalizers. At this time it cannot collect the inaccessible objects that do have finalizers. Instead it removes the entries for these objects from the finalization queue and places them in a list of objects marked as ready for finalization. Entries in this list point to the objects in the managed heap that are ready to have their finalization code called. The garbage collector calls the Finalize methods for the objects in this list and then removes the entries from the list. A future garbage collection will determine that the finalized objects are truly garbage because they are no longer pointed to by entries in the list of objects marked as ready for finalization. In this future garbage collection the objects' memory is actually reclaimed.
* How is the using() pattern useful? What is IDisposable? How does it support deterministic finalization?
* What does this useful command line do? tasklist /m "mscor*"
* What is the difference between in-proc and out-of-proc?
* What technology enables out-of-proc communication in .NET?
* When you’re running a component within ASP.NET, what process is it running within on Windows XP? Windows 2000? Windows 2003?
Senior Developers/Architects
* What’s wrong with a line like this? DateTime.Parse(myString);
* What are PDBs? Where must they be located for debugging to work?
* What is cyclomatic complexity and why is it important?
* Write a standard lock() plus “double check” to create a critical section around a variable access.
* What is FullTrust? Do GAC’ed assemblies have FullTrust?
* What benefit does your code receive if you decorate it with attributes demanding specific Security permissions?
* What does this do? gacutil /l | find /i "Corillian"
* What does this do? sn -t foo.dll
* What ports must be open for DCOM over a firewall? What is the purpose of Port 135?
* Contrast OOP and SOA. What are tenets of each?
* How does the XmlSerializer work? What ACL permissions does a process using it require?
* Why is catch(Exception) almost always a bad idea?
* What is the difference between Debug.Write and Trace.Write? When should each be used?
* What is the difference between a Debug and Release build? Is there a significant speed difference? Why or why not?
* Does JITting occur per-assembly or per-method? How does this affect the working set?
* Contrast the use of an abstract base class against an interface?
* What is the difference between a.Equals(b) and a == b?
* In the context of a comparison, what is object identity versus object equivalence?
* How would one do a deep copy in .NET?
* Explain current thinking around IClonable.
* What is boxing?
* Is string a value type or a reference type?
* What is the significance of the "PropertySpecified" pattern used by the XmlSerializer? What problem does it attempt to solve?
* Why are out parameters a bad idea in .NET? Are they?
* Can attributes be placed on specific parameters to a method? Why is this useful?
C# Component Developers
* Juxtapose the use of override with new. What is shadowing?
* Explain the use of virtual, sealed, override, and abstract.
* Explain the importance and use of each component of this string: Foo.Bar, Version=2.0.205.0, Culture=neutral, PublicKeyToken=593777ae2d274679d
* Explain the differences between public, protected, private and internal.
* What benefit do you get from using a Primary Interop Assembly (PIA)?
* By what mechanism does NUnit know what methods to test?
* What is the difference between: catch(Exception e){throw e;} and catch(Exception e){throw;}
* What is the difference between typeof(foo) and myFoo.GetType()?
* Explain what’s happening in the first constructor: public class c{ public c(string a) : this() {;}; public c() {;} } How is this construct useful?
* What is this? Can this be used within a static method?
ASP.NET (UI) Developers
* Describe how a browser-based Form POST becomes a Server-Side event like Button1_OnClick.
* What is a PostBack?
* What is ViewState? How is it encoded? Is it encrypted? Who uses ViewState?
* What is the
* What three Session State providers are available in ASP.NET 1.1? What are the pros and cons of each?
* What is Web Gardening? How would using it affect a design?
* Given one ASP.NET application, how many application objects does it have on a single proc box? A dual? A dual with Web Gardening enabled? How would this affect a design?
* Are threads reused in ASP.NET between reqeusts? Does every HttpRequest get its own thread? Should you use Thread Local storage with ASP.NET?
* Is the [ThreadStatic] attribute useful in ASP.NET? Are there side effects? Good or bad?
* Give an example of how using an HttpHandler could simplify an existing design that serves Check Images from an .aspx page.
* What kinds of events can an HttpModule subscribe to? What influence can they have on an implementation? What can be done without recompiling the ASP.NET Application?
* Describe ways to present an arbitrary endpoint (URL) and route requests to that endpoint to ASP.NET.
* Explain how cookies work. Give an example of Cookie abuse.
* Explain the importance of HttpRequest.ValidateInput()?
* What kind of data is passed via HTTP Headers?
* Juxtapose the HTTP verbs GET and POST. What is HEAD?
* Name and describe at least a half dozen HTTP Status Codes and what they express to the requesting client.
* How does if-not-modified-since work? How can it be programmatically implemented with ASP.NET?
Explain <@OutputCache%> and the usage of VaryByParam, VaryByHeader.
* How does VaryByCustom work?
* How would one implement ASP.NET HTML output caching, caching outgoing versions of pages generated via all values of q= except where q=5 (as in http://localhost/page.aspx?q=5)?
Developers using XML
* What is the purpose of XML Namespaces?
* When is the DOM appropriate for use? When is it not? Are there size limitations?
* What is the WS-I Basic Profile and why is it important?
* Write a small XML document that uses a default namespace and a qualified (prefixed) namespace. Include elements from both namespace.
* What is the one fundamental difference between Elements and Attributes?
* What is the difference between Well-Formed XML and Valid XML?
* How would you validate XML using .NET?
* Why is this almost always a bad idea? When is it a good idea? myXmlDocument.SelectNodes("//mynode");
* Describe the difference between pull-style parsers (XmlReader) and eventing-readers (Sax)
* What is the difference between XPathDocument and XmlDocument? Describe situations where one should be used over the other.
* What is the difference between an XML "Fragment" and an XML "Document."
* What does it meant to say “the canonical” form of XML?
* Why is the XML InfoSet specification different from the Xml DOM? What does the InfoSet attempt to solve?
* Contrast DTDs versus XSDs. What are their similarities and differences? Which is preferred and why?
* Does System.Xml support DTDs? How?
* Can any XML Schema be represented as an object graph? Vice versa?
0 comments:
Post a Comment