Sie sind auf Seite 1von 7

What is Microsoft ADO.NET? ADO.NET is one of the component in the Microsoft.

NET framework which contains following features to Windows, web and distributed applications. i. Data Access to the applications from Database in connected (Data reader object) and disconnected (Data set and data table) model. ii. Modify the data in database from application. What are the Benefits of ADO.Net? ADO.Net offers following Benefits Interoperability: XML Format is one of the best formats for Interoperability.ADO.NET supports to transmit the data using XML format. Scalability: ADO.NET works on Dataset that can represent a whole database or even a data table as a disconnected object and thereby eliminates the problem of the constraints of number of databases being connected. In this way scalability is achieved. Performance: The performance in ADO.NET is higher in comparison to ADO that uses COM marshalling. Programmability: ADO.Net Data components in Visual studio help to do easy program to connect to the database. Explain different connection objects used in ADO.NET? Sqlconnection object used to connect to a Microsoft SQL Server database. SQL database connections use the SqlDataAdapter object to perform commands and return data. OracleConnection object used to connect to Oracle databases. Oracle database connections use the OracleDataAdapter object to perform commands and return data. This connection object was introduced in Microsoft .NET Framework version 1.1. OleDbConnection object used to connect to a Microsoft Access or third-party database, such as MySQL. OLE database connections use the OleDbDataAdapter object to perform commands and return data. What are the different steps to access a database through ADO.NET? Create a connection to the database using a connection object. Open the Database Connection. Invoke a command to create a Dataset object using an adapter object. Use the Dataset object in code to display data or to change items in the database. Invoke a command to update the database from the Dataset object using an adapter object. Close the database connection. What is the difference between Data Reader and Data Adapter? Data Reader is read only forward only and much faster than Data Adapter. If you use Data Reader you have to open and close connection explicitly where as if you use Data Adapter the connection is automatically opened and closed. Data Reader expects connection to database to perform any operation on data where as Data Adapter is disconnected What is the difference between Execute Reader, Execute Scalar and Execute Non Query methods?

Execute Reader Execute Reader will be used to return the set of rows, on execution of SQL Query or Stored procedure using command object. Execute Scalar Execute Scalar will be used to return the single value, on execution of SQL Query or Stored procedure using command object. Execute Non Query If the command or stored procedure performs INSERT, DELETE or UPDATE operations, then we use Execute Non Query method. Execute Non Query method returns an integer specifying the number of rows inserted, deleted or updated.

Whats the advantage of using System.Text.StringBuilder over System.String? StringBuilder is more efficient in the cases, where a lot of manipulation is done to the text. Strings are immutable, so each time its being operated on, a new instance is created. Can you store multiple data types in System.Array? No. Whats the difference between the System.Array.CopyTo() and System.Array.Clone()? The first one performs a deep copy of the array, the second one is shallow. How can you sort the elements of the array in descending order? By calling Sort() and then Reverse() methods. Whats the .NET datatype that allows the retrieval of data by a unique key?HashTable. Whats class SortedList underneath? A sorted HashTable. Will finally block get executed if the exception had not occurred? Yes. Whats the C# equivalent of C++ catch (), which was a catch-all statement for 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 {}. Can multiple catch blocks be executed? No, once the proper catch code fires off, the control is transferred to the finally block (if there are any), and then whatever follows the finally block. Why is it a bad idea to throw your own exceptions? Well, if at that point you know that an error has occurred, then why not write the proper code to handle that error instead of passing a new Exception object to the catch block? Throwing your own exceptions signifies some design flaws in the project.

Whats a delegate? A delegate object encapsulates a reference to a method. In C++ they were referred to as function pointers. Whats a multicast delegate? Its a delegate that points to and eventually fires off several methods. Hows 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. Whats a satellite assembly? When you write a multilingual or multi-cultural application in .NET, and want to distribute the core application separately from the localized modules, the localized assemblies that modify the core application are called satellite assemblies. What namespaces are necessary to create a localized application?System.Globalization, System.Resources.

Whats the difference between // comments, /* */ comments and /// comments? Single-line, multi-line and XML documentation comments. How do you generate documentation from the C# file commented properly with a command-line compiler? Compile it with a /doc switch. Whats the difference between <c> and <code> XML documentation tag? Single line code example and multiple-line code example. Is XML case-sensitive? Yes, so <Student> and <student> are different elements. 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 thats pointed to by this reference. Objects 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. Whats the difference between the Debug class and Trace class? Documentation looks the same. Use Debug class for debug builds, use Trace class for both debug and release builds. Why are there five tracing levels in System.Diagnostics.TraceSwitcher? The tracing dumps can be quite verbose and for some applications that are constantly running you run the risk of overloading the machine and the hard drive there. Five levels range from None to Verbose, allowing to fine-tune the tracing activities.

Where is the output of TextWriterTraceListener redirected? To the Console or a text file depending on the parameter passed to the constructor. How do you debug an ASP.NET Web application? Attach the aspnet_wp.exe process to the DbgClr debugger. What are three test cases you should go through in unit testing? Positive test cases (correct data, correct output), negative test cases (broken or missing data, proper handling), exception test cases (exceptions are thrown and caught properly). Can you change the value of a variable while debugging a C# application? Yes, if you are debugging via Visual Studio.NET, just go to Immediate window. Explain the three services model (three-tier application). Presentation (UI), business (logic and underlying code) and data (from storage or other sources). 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 its 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.

Whats 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. What is the wildcard character in SQL? Lets say you want to query database with LIKE for all employees whose name starts with La. The wildcard character is %, the proper query with LIKE would involve La%. Explain ACID rule of thumb for transactions. Transaction must be Atomic (it is one unit of work and does not dependent on previous and following transactions), Consistent (data is either committed or roll back, no in-between case where something has been updated and something

hasnt), Isolated (no transaction sees the intermediate results of the current transaction), Durable (the values persist if the data had been committed even if the system crashes right after).

What connections does Microsoft SQL Server support? Windows Authentication (via Active Directory) and SQL Server authentication (via Microsoft SQL Server username and passwords). Which one is trusted and which one is untrusted? Windows Authentication is trusted because the username and password are checked with the Active Directory, the SQL Server authentication is untrusted, since SQL Server is the only verifier participating in the transaction. Why would you use untrusted verificaion? Web Services might use it, as well as nonWindows applications. What does the parameter Initial Catalog define inside Connection String?The database name to connect to. Whats the data provider name to connect to Access database? Microsoft.Access. What does Dispose method do with the connection object? Deletes it from the memory. What is a pre-requisite for connection pooling? Multiple processes must agree that they will share the same connection, where every parameter is the same, including the security settings.
:

Questions 1 Answers : 1

What is Object Oriented Programming ? It is a problem solving technique to develop software systems. It is a technique to think real world in terms of objects. Object maps the software model to real world concept. These objects have responsibilities and provide services to application or other objects.

Questions What is a Class ? :2 Answers : A class describes all the attributes of objects, as well as the methods that implement the behavior of 2 member objects. It is a comprehensive data type which represents a blue print of objects. Its a template of object. Questions What is an Object ? :3 Answers : It is a basic unit of a system. An object is an entity that has attributes, behavior, and identity. Objects 3 are members of a class. Attributes and behavior of an object are defined by the class definition. Questions What is the relation between Classes and Objects? :4 Answers : They look very much same but are not same. Class is a definition, while object is instance of the class 4 created. Class is a blue print while objects are actual objects existing in real world. Example we have class CAR which has attributes and methods like Speed, Brakes, Type of Car etc.Class CAR is just a prototype, now we can create real time objects which can be used to provide functionality. Example we can create a Maruti car object with 100 km speed and urgent brakes. Questions What are different properties provided by Object-oriented systems ? :5 Answers : Following are characteristics of Object Oriented Systems:5 Abstraction It allows complex real world to be represented in simplified manner. Example color is abstracted to RGB.By just making the combination of these three colors we can achieve any color in world. Its a model of real world or concept. Encapsulation The process of hiding all the internal details of an object from the outside world. Communication Using messages when application wants to achieve certain task it can only be done using combination of objects. A single object can not do the entire task. Example if we want to make order processing form. We will use Customer object, Order object, Product object and Payment object to achieve this functionality. In short these objects should communicate with each other. This is achieved when objects send messages to each other. Object lifetime All objects have life time. Objects are created, initialized, necessary functionalities are done and later the object is destroyed. Every object have there own state and identity, which differ from instance to

instance. Questions What is an Abstract class ? :6 Answers : Abstract class defines an abstract concept which can not be instantiated and comparing o interface it 6 can have some implementation while interfaces can not. Below are some points for abstract class:=>We can not create object of abstract class it can only be inherited in a below class. => Normally abstract classes have base implementation and then child classes derive from the abstract class to make the class concrete. Questions What are Abstract methods? :7 Answers : Abstract class can contain abstract methods. Abstract methods do not have implementation. Abstract 7 methods should be implemented in the subclasses which inherit them. So if an abstract class has an abstract method class inheriting the abstract class should implement the method or else java compiler will through an error. In this way, an abstract class can define a complete programming interface thereby providing its subclasses with the method declarations for all of the methods necessary to implement that programming interface. Abstract methods are defined using "abstract" keyword. Below is a sample code snippet. abstract class pcdsGraphics { abstract void draw(); } Any class inheriting from "pcdsGraphics" class should implement the "draw" method or else the java compiler will throw an error. so if we do not implement a abstract method the program will not compile. Questions What is the difference between Abstract classes and Interfaces ? :8 Answers : Difference between Abstract class and Interface is as follows:8 Abstract class can only be inherited while interfaces can not be it has to be implemented. Interface cannot implement any methods, whereas an abstract class can have implementation. Class can implement many interfaces but can have only one super class. Interface is not part of the class hierarchy while Abstract class comes in through inheritance. Unrelated classes can implement the same interface. Questions What is difference between Static and Non-Static fields of a class ? :9 Answers : Non-Static values are also called as instance variables. Each object of the class has its own copy of 9 Non-Static instance variables. So when a new object is created of the same class it will have completely its own copy of instance variables. While Static values have only one copy of instance variables and will be shared among all the objects of the class. Questions What are inner classes and what is the practical implementation of inner classes? : 10 Answers : Inner classes are nested inside other class. They have access to outer class fields and methods even if 10 the fields of outer class are defined as private. public class Pcds { class pcdsEmp { // inner class defines the required structure String first; String last; } // array of name objects clsName personArray[] = {new clsName(), new clsName(), new clsName()}; } Normally inner classes are used for data structures like one shown above or some kind of helper classes. Questions What is a constructor in class? : 11 Answers : Constructor has the same name as the class in which it resides and looks from syntax point of view it 11 looks similiar to a method. Constructor is automatically called immediately after the object is created,

before the new operator completes. Constructors have no return type, not even void. This is because the implicit return type of a class' constructor is the class type itself. It is the constructor's job to initialize the internal state of an object so that the code creating an instance will have a fully initialized, usable object immediately. Questions Can constructors be parameterized? : 12 Answers : Yes we can have parameterized constructor which can also be termed as constructor overloading. 12 Below is a code snippet which shows two constructors for pcdsMaths class one with parameter and one with out. class pcdsMaths { double PI; // This is the constructor for the maths constant class. pcdsMaths() {PI = 3.14;} pcdsMaths(int pi) { PI = pi; }} Questions What is the use if instanceof keyword? and How do refer to a current instance of object? : 13 Answers : "instanceof" keyword is used to check what is the type of object. 13 we can refer the current instance of object using "this" keyword. For instance if we have class which has color property we can refer the current object instance inside any of the method using "this.color". Questions : 14 Answers : 14 what is Bootstrap, Extension and System Class loader? or Can you explain primordial class loader? There three types of class loaders:BootStrap Class loader also called as primordial class loader. Extension Class loader. System Class loader. Lets now try to get the fundamentals of these class loaders. Bootstrap Class loader Bootstrap class loader loads those classes those which are essential for JVM to function properly. Bootstrap class loader is responsible for loading all core java classes for instance java.lang.*, java.io.* etc. Bootstrap class loader finds these necessary classes from jdk/ jre/lib/rt.jar. Bootstrap class loader can not be instantiated from JAVA code and is implemented natively inside JVM. Extension Class loader The extension class loader also termed as the standard extensions class loader is a child of the bootstrap class loader. Its primary responsibility is to load classes from the extension directories, normally located the jre/lib/ext directory. This provides the ability to simply drop in new extensions, such as various security extensions, without requiring modification to the user's class path. System Class loader The system class loader also termed application class loader is the class loader responsible for loading code from the path specified by the CLASSPATH environment variable. It is also used to load an applications entry point class that is the "static void main ()" method in a class. Questions whats the main difference between ArrayList / HashMap and Vector / Hashtable? : 15 Answers : Vector / HashTable are synchronized which means they are thread safe. Cost of thread safe is 15 performance degradation. So if you are sure that you are not dealing with huge number of threads then you should use ArrayList / HashMap.But yes you can still synchronize List and Maps using Collections provided methods :List OurList = Collections.synchronizedList (OurList); Map OurMap = Collections.synchronizedMap (OurMap); Questions What are access modifiers? : 16 Answers : Access modifiers decide whether a method or a data variable can be accessed by another method in 16 another class or subclass. four types of access modifiers: Public: - Can be accessed by any other class anywhere. Protected: - Can be accessed by classes inside the package or by subclasses ( that means classes who

inherit from this class). Private - Can be accessed only within the class. Even methods in subclasses in the same package do not have access. Default - (Its private access by default) accessible to classes in the same package but not by classes in other packages, even if these are subclasses. Questions Define exceptions ? : 17 Answers : An exception is an abnormal condition that arises in a code sequence at run time. Basically there are 17 four important keywords which form the main pillars of exception handling: try, catch, throw and finally. Code which you want to monitor for exception is contained in the try block. If any exception occurs in the try block its sent to the catch block which can handle this error in a more rational manner. To throw an exception manually you need to call use the throw keyword. If you want to put any clean up code use the finally block. The finally block is executed irrespective if there is an error or not. Questions What is serialization?How do we implement serialization actually? : 18 Answers : Serialization is a process by which an object instance is converted in to stream of bytes. There are 18 many useful stuff you can do when the object instance is converted in to stream of bytes for instance you can save the object in hard disk or send it across the network. In order to implement serialization we need to use two classes from java.io package ObjectOutputStream and ObjectInputStream. ObjectOutputStream has a method called writeObject, while ObjectInputStream has a method called readObject. Using writeobject we can write and readObject can be used to read the object from the stream. Below are two code snippet which used the FileInputStream and FileOutputstream to read and write from harddisk.

http://www.careerride.com/CSharp-FAQs.aspx

Das könnte Ihnen auch gefallen