C Sharp Interview Questions
1 Apr, 2007
- What’s a delegate? A delegate object encapsulates a reference to a method. In C++ they were referred to as function pointers.
- What’s a multicast delegate? It’s a delegate that points to and eventually fires off several methods.
- How’s the DLL Hell problem solved in .NET? Assembly versioning allows the application to specify not only the library it needs to run (which was available under Win32), but also the version of the assembly.
- What are the ways to deploy an assembly? An MSI installer, a CAB archive, and XCOPY command.
1 Apr, 2007
- What debugging tools come with the .NET SDK? CorDBG – command-line debugger, and DbgCLR – graphic debugger. Visual Studio .NET uses the DbgCLR. To use CorDbg, you must compile the original C# file using the /debug switch.
- What does the This window show in the debugger? It points to the object that’s pointed to by this reference. Object’s instance data is shown.
- What does assert() do? In debug compilation, assert takes in a Boolean condition as a parameter, and shows the error dialog if the condition is false. The program proceeds without any interruption if the condition is true.
1 Apr, 2007
- What are advantages and disadvantages of Microsoft-provided data provider classes in ADO.NET? SQLServer.NET data provider is high-speed and robust, but requires SQL Server license purchased from Microsoft. OLE-DB.NET is universal for accessing other sources, like Oracle, DB2, Microsoft Access and Informix, but it’s a .NET layer on top of OLE layer, so not the fastest thing in the world. ODBC.NET is a deprecated layer provided for backward compatibility to ODBC engines.
- What’s the role of the DataReader class in ADO.NET connections? It returns a read-only dataset from the data source when the command is executed.
1 Apr, 2007
- 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.
- How do you inherit from a class in C#? Place a colon and then the name of the base class.
- Does C# support multiple inheritance? No, use interfaces instead.
- When you inherit a protected class-level variable, who is it available to? Classes in the same namespace.
- 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. But they are.
1 Apr, 2007
- 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 allow class to be inherited, but prevent the method from being over-ridden? Yes, just leave the class public and make the method sealed.
Pages (4): « First ... « 1 2 3 [4]