Tuesday, November 15, 2011

Microsoft Technologies Interview Questions (.NET FRAMEWORK)


Dot Net Framework Interview Question 


1. Which of the following are NOT true about .NET Framework?
It provides a consistent object-oriented programming environment whether object code is stored and executed locally, executed locally but Internet-distributed, or executed remotely.
It provides a code-execution environment that minimizes software deployment and versioning conflicts.
It provides a code-execution environment that promotes safe execution of code, including code created by an unknown or semi-trusted third party.
It provides different programming models for Windows-based applications and Web-based applications.
It provides an event driven programming model for building Windows Device Drivers.
A.1, 2
B.2, 4
C.4, 5
D.1, 2, 4
2. Which of the following utilities can be used to compile managed assemblies into processor-specific native code?
A. gacutil B.ngen
C. sn D.dumpbin
E. ildasm
3. Which of the following statements is correct about Managed Code?
A. Managed code is the code that is compiled by the JIT compilers.
B. Managed code is the code where resources are Garbage Collected.
C. Managed code is the code that runs on top of Windows.
D. Managed code is the code that is written to target the services of the CLR.
E. Managed code is the code that can run on top of Linux.
4.Which of the following are valid .NET CLR JIT performance counters?
Total memory used for JIT compilation
Average memory used for JIT compilation
Number of methods that failed to compile with the standard JIT
Percentage of processor time spent performing JIT compilation
Percentage of memory currently dedicated for JIT compilation
A.1, 5
B.3, 4
C.1, 2
D.4, 5
5.Which of the following statements are TRUE about the .NET CLR?
It provides a language-neutral development & execution environment.
It ensures that an application would not be able to access memory that it is not authorized to access.
It provides services to run “managed” applications.
The resources are garbage collected.
It provides services to run “unmanaged” applications.
A. Only 1 and 2
B. Only 1, 2 and 4
C. 1, 2, 3, 4
D. Only 4 and 5
E. Only 3 and 4
6. Which of the following components of the .NET framework provide an extensible set of classes that can be used by any .NET compliant programming language?
A. .NET class libraries
B. Common Language Runtime
C. Common Language Infrastructure
D. Component Object Model
E. Common Type System
7. Which of the following jobs are NOT performed by Garbage Collector?
Freeing memory on the stack.
Avoiding memory leaks.
Freeing memory occupied by unreferenced objects.
Closing unclosed database collections.
Closing unclosed files.
A. 1, 2, 3
B. 3, 5
C. 1, 4, 5
D. 3, 4
8. Which of the following .NET components can be used to remove unused references from the managed heap?
A. Common Language Infrastructure
B. CLR
C. Garbage Collector
D. Class Loader
E. CTS
9.Which of the following statements correctly define .NET Framework?
A. It is an environment for developing, building, deploying and executing Desktop Applications, Web Applications and Web Services.
B. It is an environment for developing, building, deploying and executing only Web Applications.
C. It is an environment for developing, building, deploying and executing Distributed Applications.
D. It is an environment for developing, building, deploying and executing Web Services.
E. It is an environment for development and execution of Windows applications.
10.Which of the following constitutes the .NET Framework?
ASP.NET Applications
CLR
Framework Class Library
Win Form Applications
Windows Services
A. 1, 2
B. 2, 3
C. 3, 4
D. 2, 5
11.Which of the following are parts of the .NET Framework?
The Common Language Runtime (CLR)
The Framework Class Libraries (FCL)
Microsoft Published Web Services
Applications deployed on IIS
Mobile Applications
A. Only 1, 2, 3
B. Only 1, 2
C. Only 1, 2, 4
D. Only 4, 5
E. All of the above
12.Which of the following statements are correct about JIT?
JIT compiler compiles instructions into machine code at run time.
The code compiler by the JIT compiler runs under CLR.
The instructions compiled by JIT compilers are written in native code.
The instructions compiled by JIT compilers are written in Intermediate Language (IL) code.
The method is JIT compiled even if it is not called
A. 1, 2, 3
B. 2, 4
C. 3, 4, 5
D. 1, 2
13.Which of the following statements are correct about a .NET Assembly?
It is the smallest deployable unit.
Each assembly has only one entry point – Main(), WinMain() or DLLMain().
An assembly can be a Shared assembly or a Private assembly.
An assembly can contain only code and data.
An assembly is always in the form of an EXE file.
A. 1, 2, 3
B. 2, 4, 5
C. 1, 3, 5
D. 1, 2
14.Which of the following jobs are done by Common Language Runtime?
It provides core services such as memory management, thread management, and remoting.
It enforces strict type safety.
It provides Code Access Security.
It provides Garbage Collection Services.
A. Only 1 and 2
B. Only 3, 4
C. Only 1, 3 and 4
D. Only 2, 3 and 4
E. All of the above
15.Which of the following security features can .NET applications avail?
PIN Security
Code Access Security
Role Based Security
Authentication Security
Biorhythm Security
A. 1, 4, 5
B. 2, 5
C. 1, 2
D. 3, 4
16.Which of the following benefits do we get on running managed code under CLR?
Type safety of the code running under CLR is assured.
It is ensured that an application would not access the memory that it is not authorized to access.
It launches separate process for every application running under it.
The resources are Garbage collected.
A. Only 1 and 2
B. Only 2, 3 and 4
C. Only 1, 2 and 4
D. Only 4
E. All of the above
17.Which of the following assemblies can be stored in Global Assembly Cache?
A. Private Assemblies
B. Friend Assemblies
C. Shared Assemblies
D. Public Assemblies
E. Protected Assemblies
18.Code that targets the Common Language Runtime is known as.
A. Unmanaged
B. Distributed
C. Legacy
D. Managed Code
E. Native Code
19. Which of the following is the root of the .NET type hierarchy?
A. System Object
B. System Type
C. System Base
D. System Parent
E. System Root
20.Which of the following statements is correct about the .NET Framework?
A. .NET Framework uses DCOM for achieving language interoperability.
B. .NET Framework is built on the DCOM technology.
C. .NET Framework uses DCOM for making transition between managed and unmanaged code.
D. .NET Framework uses DCOM for creating unmanaged applications.
E. .NET Framework uses COM+ services while creating Distributed Applications.
21. What is .NET?
.NET is essentially a framework for software development. It is similar in nature to any other software development framework (J2EE etc) in that it provides a set of runtime containers/capabilities, and a rich set of pre-built functionality in the form of class libraries and APIs
The .NET Framework is an environment for building, deploying, and running Web Services and other applications. It consists of three main parts: the Common Language Runtime, the Framework classes, and ASP.NET.
22. How many languages .NET is supporting now?
When .NET was introduced it came with several languages. VB.NET, C#, COBOL and Perl, etc. The site DotNetLanguages.Net says 44 languages are supported.
23. How is .NET able to support multiple languages?
A language should comply with the Common Language Runtime standard to become a .NET language. In .NET, code is compiled to Microsoft Intermediate Language (MSIL for short). This is called as Managed Code. This Managed code is run in .NET environment. So after compilation to this IL the language is not a barrier. A code can call or use a function written in another language.
24. How ASP .NET different from ASP?
Scripting is separated from the HTML, Code is compiled as a DLL, these DLLs can be executed on the server.
25. What is view state?
The web is stateless. But in ASP.NET, the state of a page is maintained in the in the page itself automatically. How? The values are encrypted and saved in hidden controls. this is done automatically by the ASP.NET. This can be switched off / on for a single control
26. How do you validate the controls in an ASP .NET page?
Using special validation controls that are meant for this. We have Range Validator, Email Validator.
Can the validation be done in the server side? Or this can be done only in the Client side?
Client side is done by default. Server side validation is also possible. We can switch off the client side and server side can be done.
27. How to manage pagination in a page?
Using pagination option in DataGrid control. We have to set the number of records for a page, then it takes care of pagination by itself.
28. What is ADO .NET and what is difference between ADO and ADO.NET?
ADO.NET is stateless mechanism. I can treat the ADO.Net as a separate in-memory database where in I can use relationships between the tables and select insert and updates to the database. I can update the actual database as a batch.
29. Observations between VB.NET and VC#.NET?
Choosing a programming language depends on your language experience and the scope of the application you are building. While small applications are often created using only one language, it is not uncommon to develop large applications using multiple languages.
For example, if you are extending an application with existing XML Web services, you might use a scripting language with little or no programming effort. For client-server applications, you would probably choose the single language you are most comfortable with for the entire application. For new enterprise applications, where large teams of developers create components and services for deployment across multiple remote sites, the best choice might be to use several languages depending on developer skills and long-term maintenance expectations.
The .NET Platform programming languages – including Visual Basic .NET, Visual C#, and Visual C++ with managed extensions, and many other programming languages from various vendors – use .NET Framework services and features through a common set of unified classes. The .NET unified classes provide a consistent method of accessing the platform’s functionality. If you learn to use the class library, you will find that all tasks follow the same uniform architecture. You no longer need to learn and master different API architectures to write your applications.
In most situations, you can effectively use all of the Microsoft programming languages. Nevertheless, each programming language has its relative strengths and you will want to understand the features unique to each language. The following sections will help you choose the right programming language for your application.
Visual Basic .NET
Visual Basic .NET is the next generation of the Visual Basic language from Microsoft. With Visual Basic you can build .NET applications, including Web services and ASP.NET Web applications, quickly and easily. Applications made with Visual Basic are built on the services of the common language runtime and take advantage of the .NET Framework.
Visual Basic has many new and improved features such as inheritance, interfaces, and overloading that make it a powerful object-oriented programming language. Other new language features include free threading and structured exception handling. Visual Basic fully integrates the .NET Framework and the common language runtime, which together provide language interoperability, garbage collection, enhanced security, and improved versioning support. A Visual Basic support single inheritance and creates Microsoft intermediate language (MSIL) as input to native code compilers.
Visual Basic is comparatively easy to learn and use, and Visual Basic has become the programming language of choice for hundreds of thousands of developers over the past decade. An understanding of Visual Basic can be leveraged in a variety of ways, such as writing macros in Visual Studio and providing programmability in applications such as Microsoft Excel, Access, and Word.
Visual Basic provides prototypes of some common project types, including:
Windows Application.
Class Library.
Windows Control Library.
ASP.NET Web Application.
ASP.NET Web Service.
Web Control Library.
Console Application.
Windows Service.
Windows Service.
Visual C# .NET
Visual C# (pronounced C sharp) is designed to be a fast and easy way to create .NET applications, including Web services and ASP.NET Web applications. Applications written in Visual C# are built on the services of the common language runtime and take full advantage of the .NET Framework.
C# is a simple, elegant, type-safe, object-oriented language recently developed by Microsoft for building a wide range of applications. Anyone familiar with C and similar languages will find few problems in adapting to C#. C# is designed to bring rapid development to the C++ programmer without sacrificing the power and control that are a hallmark of C and C++. Because of this heritage, C# has a high degree of fidelity with C and C++, and developers familiar with these languages can quickly become productive in C#. C# provides intrinsic code trust mechanisms for a high level of security, garbage collection, and type safety. C# supports single inheritance and creates Microsoft intermediate language (MSIL) as input to native code compilers.
C# is fully integrated with the .NET Framework and the common language runtime, which together provide language interoperability, garbage collection, enhanced security, and improved versioning support. C# simplifies and modernizes some of the more complex aspects of C and C++, notably namespaces, classes, enumerations, overloading, and structured exception handling. C# also eliminates C and C++ features such as macros, multiple inheritance, and virtual base classes. For current C++ developers, C# provides a powerful, high-productivity language alternative.
Visual C# provides prototypes of some common project types, including:
Windows Application.
Class Library.
Windows Control Library.
ASP.NET Web Application.
ASP.NET Web Service.
Web Control Library.
Console Application.
Windows Service.
30. Advantages of migrating to VB.NET ?
Visual Basic .NET has many new and improved language features — such as inheritance, interfaces, and overloading that make it a powerful object-oriented programming language. As a Visual Basic developer, you can now create multithreaded, scalable applications using explicit multithreading. Other new language features in Visual Basic .NET include structured exception handling, custom attributes, and common language specification (CLS) compliance.
The CLS is a set of rules that standardizes such things as data types and how objects are exposed and interoperate. Visual Basic .NET adds several features that take advantage of the CLS. Any CLS-compliant language can use the classes, objects, and components you create in Visual Basic .NET. And you, as a Visual Basic user, can access classes, components, and objects from other CLS-compliant programming languages without worrying about language-specific differences such as data types.
CLS features used by Visual Basic .NET programs include assemblies, namespaces, and attributes.
These are the new features to be stated briefly:
Inheritance
Visual Basic .NET supports inheritance by allowing you to define classes that serve as the basis for derived classes. Derived classes inherit and can extend the properties and methods of the base class. They can also override inherited methods with new implementations. All classes created with Visual Basic .NET are inheritable by default. Because the forms you design are really classes, you can use inheritance to define new forms based on existing ones.
Exception Handling
Visual Basic .NET supports structured exception handling, using an enhanced version of the Try…Catch…Finally syntax supported by other languages such as C++.
Structured exception handling combines a modern control structure (similar to Select Case or While) with exceptions, protected blocks of code, and filters. Structured exception handling makes it easy to create and maintain programs with robust, comprehensive error handlers.
Overloading
Overloading is the ability to define properties, methods, or procedures that have the same name but use different data types. Overloaded procedures allow you to provide as many implementations as necessary to handle different kinds of data, while giving the appearance of a single, versatile procedure. Overriding Properties and Methods The Overrides keyword allows derived objects to override characteristics inherited from parent objects. Overridden members have the same arguments as the members inherited from the base class, but different implementations. A member’s new implementation can call the original implementation in the parent class by preceding the member name with MyBase.
Constructors and Destructors
Constructors are procedures that control initialization of new instances of a class. Conversely, destructors are methods that free system resources when a class leaves scope or is set to Nothing. Visual Basic .NET supports constructors and destructors using the Sub New and Sub Finalize procedures.
Data Types
Visual Basic .NET introduces three new data types. The Char data type is an unsigned 16-bit quantity used to store Unicode characters. It is equivalent to the .NET Framework System. Char data type. The Short data type, a signed 16-bit integer, was named Integer in earlier versions of Visual Basic. The Decimal data type is a 96-bit signed integer scaled by a variable power of 10. In earlier versions of Visual Basic, it was available only within a Variant.
Interfaces
Interfaces describe the properties and methods of classes, but unlike classes, do not provide implementations. The Interface statement allows you to declare interfaces, while the Implements statement lets you write code that puts the items described in the interface into practice.
Delegates
Delegates objects that can call the methods of objects on your behalf are sometimes described as type-safe, object-oriented function pointers. You can use delegates to let procedures specify an event handler method that runs when an event occurs. You can also use delegates with multithreaded applications. For details, see Delegates and the AddressOf Operator.
Shared Members
Shared members are properties, procedures, and fields that are shared by all instances of a class. Shared data members are useful when multiple objects need to use information that is common to all. Shared class methods can be used without first creating an object from a class.
References
References allow you to use objects defined in other assemblies. In Visual Basic .NET, references point to assemblies instead of type libraries. For details, see References and the Imports Statement. Namespaces prevent naming conflicts by organizing classes, interfaces, and methods into hierarchies.
Assemblies
Assemblies replace and extend the capabilities of type libraries by, describing all the required files for a particular component or application. An assembly can contain one or more namespaces.
Attributes
Attributes enable you to provide additional information about program elements. For example, you can use an attribute to specify which methods in a class should be exposed when the class is used as a XML Web service.
Multithreading
Visual Basic .NET allows you to write applications that can perform multiple tasks independently. A task that has the potential of holding up other tasks can execute on a separate thread, a process known as multithreading. By causing complicated tasks to run on threads that are separate from your user interface, multithreading makes your applications more responsive to user input.
Using ActiveX Control in .Net
ActiveX control is a special type of COM component that supports a User Interface. Using ActiveX Control in your .Net Project is even easier than using COM component. They are bundled usually in .ocx files. Again a proxy assembly is made by .Net utility AxImp.exe (which we will see shortly) which your application (or client) uses as if it is a .Net control or assembly.
Making Proxy Assembly For ActiveX Control: First, a proxy assembly is made using AxImp.exe (acronym for ActiveX Import) by writing following command on Command Prompt:
C:> AxImp C:MyProjectsMyControl.ocx
This command will make two dlls, e.g., in case of above command
MyControl.dll
AxMyControl.dll
The first file MyControl.dll is a .Net assembly proxy, which allows you to reference the ActiveX as if it were non-graphical object.
The second file AxMyControl.dll is the Windows Control, which allows u to use the graphical aspects of activex control and use it in the Windows Form Project.
Adding Reference of ActiveX Proxy Assembly in your Project Settings: To add a reference of ActiveX Proxy Assembly in our Project, do this:
o Select Project A Add Reference (Select Add Reference from Project Menu).
o This will show you a dialog box, select .Net tab from the top of window.
o Click Browse button on the top right of window.
o Select the dll file for your ActiveX Proxy Assembly (which is MyControl.dll) and click OK o Your selected component is now shown in the ‘Selected Component’ List Box. Click OK again Some More On Using COM or ActiveX in .Net
.Net only provides wrapper class or proxy assembly (Runtime Callable Wrapper or RCW) for COM or activeX control. In the background, it is actually delegating the tasks to the original COM, so it does not convert your COM/activeX but just imports them.
A good thing about .Net is that when it imports a component, it also imports the components that are publically referenced by that component. So, if your component, say MyDataAcsess.dll references ADODB.dll then .Net will automatically import that COM component too!
The Visual Studio.NET does surprise you in a great deal when u see that it is applying its intellisense (showing methods, classes, interfaces, properties when placing dot) even on your imported COM components!!!! Isn’t it a magic or what?
When accessing thru RCW, .Net client has no knowledge that it is using COM component, it is presented just as another C# assembly.
U can also import COM component thru command prompt (for reference see Professional C# by Wrox)
U can also use your .Net components in COM, i.e., export your .net components (for reference see Professional C# by Wrox)


For Further Reading,
Microsoft, Placement Papers

0 comments:

Post a Comment

ShareThis

 
View My Stats