ASP.NET Interview Questions
Ques: 1 What does the keyword virtual declare for a method?
Ans:We can override the method or property using virtual keyword.
Ques: 2 what is the implicit name of the parameter that gets passed into the set propertyof a class?
Ans:The data type of the value parameter is defined by whatever data type the property has.
Ques: 3 What is the difference between an interface and abstract class ?
Ans:1. All methods are abstract and there is no implementation in case of an interface class. Whereas, in an abstract class some methods can be concrete.
2. No accessibility modifiers are allowed in case of an interface class. Whereas, an abstract class may have accessibility modifiers.
Ques: 4 How to Specify the accessibility modifier for methods inside the interface?
Ans:It is rule that all must be public and all are public by default.
Ques: 5 Define interface class ?
Ans:Interfaces, like classes, define a set of properties, methods, and events. But unlike classes, interfaces do not provide implementation. They are implemented by classes, and defined as separate entities from classes.
Ques: 6 When you declared a class as abstract?
Ans:1. At least one of the methods in the class is abstract.
2. The class itself is inherited from an abstract class, but not all base abstract methods have been overridden.
Ques: 7 Define abstract class?
Ans:1. A class is called abstract class when it cannot be instantiated.
2. An abstract class is a class, which should be inherited and methods have to be overridden.
3. An abstract class is essentially like a blueprint for a class, but it has no implementation.
Ques: 8 How to allowed a class to be inherited, but it must be prevent the method from being over-ridden?
Ans:We can make it using "sealed" keyword. For that, just leave the class as public and make the method as sealed.
Ques: 9 How to prevent your class from being inherited by another class?
Ans:By using "sealed" keyword, we can prevent the class from being inherited.
Ques: 10 What class is underneath the SortedList class?
Ans:A sorted HashTable.
Ques: 11 What is the .NET collection class that allows an element to be accessed using a unique key?
Ans:HashTable.
Ques: 12 Difference between System.String and System.Text.StringBuilder classes?
Ans:
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.
Ques: 14 What is the top .NET class that everything is derived from?Ans:System.Object.
Ques: 15 How can you automatically generate interface for the remotable object in .NET?
Ans:Use the Soapsuds tool.
Ques: 16 How to configure a .NET Remoting object via XML file?
Ans:It can be done via machine.config and application level .config file (or web.config in ASP.NET). Application-level XML settings take precedence over machine.config.
Ques: 17 What is Singleton activation mode?
Ans:A single object is instantiated regardless of the number of clients accessing it. Lifetime of this object is determined by lifetime lease.
Ques: 18 What security measures exist for .NET Remoting?
Ans:
None.
Ques: 19 In .NET Remoting, What are channels?
Ans:Channels represent the objects that transfer the other serialized objects from one application domain to another and from one computer to another, as well as one process to another on the same box. A channel must exist before an object can be transferred.
Ques: 20 What are remotable objects in .NET Remoting?
Ans:1. They can be marshaled across the application domains.
2. You can marshal by value, where a deep copy of the object is created and then passed to the receiver. You can also marshal by reference, where just a reference to an existing object is passed.
Ques: 21 Do you know the proxy of the server object in .NET Remoting?Ans:This process is known as marshaling. It handles the communication between real server object and the client object. We can say that It’s a fake copy of the server object that resides on the client side and behaves as if it was the server.
Ques: 22 Give your idea when deciding to use .NET Remoting or ASP.NET Web Services?
Ans:1. Remoting is a more efficient communication exchange when you can control both ends of the application involved in the communication process. 2. Web Services provide an open-protocol-based exchange of informaion. Web Services are best when you need to communicate with an external organization or another (non-.NET) technology.
Ques: 23 Define the possible implementations of distributed applications in .NET?
Ans:.NET Remoting and ASP.NET Web Services. If we talk about the Framework Class Library, noteworthy classes are in System.Runtime.Remoting and System.Web.Services.
Ques: 24 Explain what relationship is between a Process, Application Domain, and Application?
Ans:A process is an instance of a running application. An application is an executable on the hard drive or network. There can be numerous processes launched of the same application (5 copies of Word running), but 1 process can run just 1 application.
Ques: 25 What’s typical about a Windows process in regards to memory allocation?
Ans:Each process is allocated its own block of available RAM space, no process can access another process’ code or data. If the process crashes, it dies alone without taking the entire OS or a bunch of other applications down.
Ques: 26 What’s a Windows process?
Ans:It’s an application that’s running and had been allocated memory.
Ques: 27 Using XSLT, how would you extract a specific attribute from an element in an XML document?
Ans:Successful candidates should recognize this as one of the most basic applications of XSLT. If they are not able to construct a reply similar to the example below, they should at least be able to identify the components necessary for this operation: xsl:template to match the appropriate XML element, xsl:value-of to select the attribute value, and the optional xsl:apply-templates to continue processing the document.
Ques: 28 What is SOAP and how does it relate to XML?
Ans:The Simple Object Access Protocol (SOAP) uses XML to define a protocol for the exchange of information in distributed computing environments. SOAP consists of three components: an envelope, a set of encoding rules, and a convention for representing remote procedure calls. Unless experience with SOAP is a direct requirement for the open position, knowing the specifics of the protocol, or how it can be used in conjunction with HTTP, is not as important as identifying it as a natural application of XML.
Ques: 29 What is main difference between Global.asax and Web.Config?Ans:ASP.NET uses the global.asax to establish any global objects that your Web application uses. The .asax extension denotes an application file rather than .aspx for a page file. Each ASP.NET application can contain at most one global.asax file. The file is compiled on the first page hit to your Web application. ASP.NET is also configured so that any attempts to browse to the global.asax page directly are rejected. However, you can specify application-wide settings in the web.config file. The web.config is an XML-formatted text file that resides in the Web site’s root directory. Through Web.config you can specify settings like custom 404 error pages, authentication and authorization settings for the Web site, compilation options for the ASP.NET Web pages, if tracing should be enabled, etc
Ques: 30 What is the difference between the value-type variables and reference-type variables in terms of garbage collection?
Ans:The value-type variables are not garbage-collected, they just fall off the stack when they fall out of scope, the reference-type objects are picked up by GC when their references go null.
Ques: 31 Where do the reference-type variables go in the RAM?
Ans:The references go on the stack, while the objects themselves go on the heap. However, in reality things are more elaborate.
Ques: 32 What’s the difference between struct and class in C#?
Ans:1. Structs cannot be inherited.
2. Structs are passed by value, not by reference.
3. Struct is stored on the stack, not the heap.
Ques: 33 To test a Web service you must create a windows application or Web application to consume this service?
Ans:The webservice comes with a test page and it provides HTTP-GET method to test.
Ques: 34 What is the transport protocol you use to call a Web service?Ans: SOAP is the preferred protocol.
Ques: 35 Can you give an example of what might be best suited to place in the Application Start and Session Start subroutines?
Ans:This is where you can set the specific variables for the Application and Session objects.
Ques: 36 Where do you store the information about the user’s locale?Ans:System.Web.UI.Page.Culture
Ques: 37 Where does the Web page belong in the .NET Framework class hierarchy?
Ans:System.Web.UI.Page
Ques: 38 Name two properties common in every validation control?Ans:ControlToValidate property and Text property
Ques: 39 What property must you set, and what method must you call in your code, in order to bind the data from some data source to the Repeater control?Ans:You must set the DataSource property and call the DataBind method.
Ques: 40 How can you provide an alternating color scheme in a Repeater control?
Ans:Use the AlternatingItemTemplate
Page 3
Ques: 41 Which template must you provide, in order to display data in a Repeater control?
Ans:ItemTemplate
Ques: 42 Can you edit data in the Repeater control?
Ans:No, it just reads the information from its data source
Ques: 43 Which method do you invoke on the DataAdapter control to load your generated dataset with data?
Ans:The .Fill() method
Ques: 44 Describe the difference between inline and code behind.
Ans:Inline code written along side the html in a page. Code-behind is code written in a separate file and referenced by the .aspx page.
Ques: 45 What’s a bubbled event?
Ans:When you have a complex control, like DataGrid, writing an event processing routine for each object (cell, button, row, etc.) is quite tedious. The controls can bubble up their eventhandlers, allowing the main DataGrid event handler to take care of its constituents.
Ques: 46 What is the role of global.asax.
Ans:Store global information about the application
Ques: 47 Can the action attribute of a server-side <form> tag be set to a value and if not how can you possibly pass data from a form page to a subsequent page.
Ans:No, You have to use Server.Transfer to pass the data to another page.
Ques: 48 Can you give an example of when you might use it?
Ans:When you want to inherit (use the functionality of) another class. Base Class Employee. A Manager class could be derived from the Employee base class.
Ques: 49 Can you explain the difference between an ADO.NET Dataset and an ADO Recordset?
Ans:1. A DataSet can represent an entire relational database in memory, complete with tables, relations, and views.
2. A DataSet is designed to work without any continuing connection to the original data source.
3. Data in a DataSet is bulk-loaded, rather than being loaded on demand.
Ques: 50 What is the difference between Server.Transfer and Response.Redirect?
Ans:1. Server.Transfer() performs server side redirection of the page avoiding extra round trip. While The Response .Redirect () method can be used to redirect the browser to specified url.
2. Server.Transfer is used to post a form to another page. Response.Redirect is used to redirect the user to another page or site.
No comments:
Post a Comment