Thursday 10 August 2017

ASP.NET

Interview Question Bank.

1.What is the difference between user controls and custom controls?
CUSTOM CONTROLS are DLL'S.It can be placed in the toolbox.Drag and drop controls.
USER CONTROLS: are pages (.ascx).It can not be placed in the tool box.

2.what are the 3 types of session state modes?
a.Inproc-session kept as live object in the web server(aspnet_wp.exe)
b.Stateserver-Session serialized and stored in memory in a seperate process(aspnet_state.exe),we can use for webform architecture.
c.SQLServer-Session serialized and stored in sql server.

3. what are the 6 types of validation controls in ASP.NET?
1.Required Field validator.2.Range validator.3.Regular Expression validator.4.compare validator.5custom validator.
6.validation summary.

4.What are the 3 types of caching in ASP.NET?
1. Output Caching(Page Caching)- stores the responses from an asp.net page(aspx) or user control(.ascx).
2.Fragment Caching(Partial Caching)- Only stores the portion of a page.
3. Data Caching is the programmatic way to your objects to a managed cache.
//Add item
Cache["TopProducts"] = objTopProductsDataset;
//Retrieve item
objDataset = Cache["TopProducts"];

5.How to Manage state in ASP.NET?
we can manage the state in two ways
Clent based techniques are
Viewstate, Query strings and Cookies.
Server based techniques are
Application and Session

6.What is the difference between overloading and shadowing?
Overloading ----------- A Member has the name, but something else in the signature is different.
Shadowing --------- A member shadows another member if the derived member replaces the base member
7.what is the difference between overloading and overriding?
Overloading : Method name remains the same with different signatures.
Overriding : Method name and Signatures must be the same.
8.what is the difference between Manifest and Metadata?
Manifest:
Manifest describes assembly itself.
Assembly Name,version number,culture,strongname,listof all all files,Type references,and referenced assemblies.
MetaData:
Metadata describes contents in an assembly
classes, interfaces, enums, structs, etc., and their containing namespaces, the name of each type,
its visibility/scope, its base class, the interfaces it implemented, its methods and their scope
, and each method’s parameters, type’s properties, and so on.

9.What is Boxing and Unboxing?
Boxing is an implicit conversion of a value type to the type object
int i = 123; // A value type
Object box = i // Boxing
CASTING : casting is the process of converting a variable from one type to another (from a string to an integer )
Unboxing is an explicit conversion from the type object to a value type
int i = 123; // A value type
object box = i; // Boxing
int j = (int)box; // Unboxing

10.what are the method parameter in c#?
C# is having 4 parameter types which are
1.Value Parameter. default parameter type. Only Input
2.Reference(ref) Parameter. Input\Output
3.Output(out) Parameter.
4.Parameter(params) Arrays

11.what are value types and reference types?
Value type
bool, byte,chat, decimal,double,enum , float, int, long, sbyte, short, strut, uint, ulong, ushort
Value types are stored in the Stack
Reference type
class, delegate, interface, object, string
Reference types are stored in the Heap

12.what are the two activation modes for .NET Remoting?
1. Singleton 2. Singlecall

13.what's singlecall Activation mode used for ?
The Server Object is instantiated for responding to just one single request

14.what's the singleton Activation mode used for?
The server object is instantiated for responding number of clients

15.what are the channels and Formatters?
Channels
HTTP and TCP
Binay Over TCP is most efficient
SOAP over HTTP is most interoperable
Formatters
Binary and SOAP

16.What are the two Authentication modes for SQL server connection?
1. Trusted Connection - Windows Authentication
2. Non trusted Connection - Sql Server Authentication(its preferable for webservices)

17.What is typed dataset?
Data Access is normally done using indexes on collectionsin object model.
In ADO.NET it is possible to create a variation on a Dataset that does support
such syntax.Such Dataset is called "Typed Dataset".
Errors in the syntax are detected during compile time rather than runtime.
Advantages of Typed Dataset:
1.The data designer tool generates typed Datasets.
2.When we type the name of a dataset while writing a code,
weget a list of all available tables in the dataset.No need to
remember the table names.
For (eg) instead of typing
myDataset.Tables("products")
we can type
myDataset.products.

18.what is DataReader?

DataReader is a read only stream of data returned from
the database as the query executes.
It contains one row of data in memory at a time and is
restricted to navigating forward only in the results one record at a time.
Datareader supports access to multiple result sets but only one at a time and in the order retrieved.
In ADO data is no longer available through the Datareaderoncethe connection to the datasource is closed
which means a Datareader requires a connection to the Database throughout its usage.
o/p parameters or return values are only available thrugh the Datareader once the connection is closed.

19.Difference between Dataset and Recordset?
The Recordset was not XML-based and could not be serialized to XML easily or flexibly.
Finally, a Recordset was not independent of a data store because it tracked a Connection object
and through its methods could send queries to the data source to populate, update,
and refresh its data.
To that end, the Recordset contained functionality found in the ADO.NET DataSet,
data reader, and data adapter objects.

Similar to the DataSet, a Recordset could be disconnected from its data store
and therefore act as an in-memory cache of data.
Of course, it could also be used in a connected model depending on the cursor options that were set.
Although the Recordset object stored multiple versions of each column for each of its rows,
it was not by nature able to represent multiple tables without the use of the Data Shape Provider.
.
21.What is an Assembly, Private Assembly and SharedAssembly,Strong Name?
Assembly: Assemblies are basically the compiled code in .Net which contains the code in Microsoft Intermediate Language and one more thing that assemblies do for us as compared to dlls is they can maintain versioning with the help of the manifest.
You don’t need to register the assemblies after compiling like we needed in dlls. You can put the assemblies in the bin folder and refer the namespaces from there.
In short find the assembly description as:
Assemblies are the building blocks of .NET Framework applications; they form the fundamental unit of deployment, version control, reuse, activation scoping, and security permissions. An assembly is a collection of types and resources that are built to work together and form a logical unit of functionality. An assembly provides the common language runtime with the information it needs to be aware of type implementations. To the runtime, a type does not exist outside the context of an assembly.

Private assembly is used inside an application only and does not have to be identified by a strong name
Shared assembly can be used by multiple applications and has to have a strong name.
Strong Name: A strong name includes the name of the assembly, version number, culture identity, and a public key token.

22. What is an Delegate?
A strongly typed function pointer. A delegate object encapsulates a reference to a method.

23. What are webservices?
A Web Service is an application that delivers a service across the Internet using the standards and technologies defined in the Web Services architecture in a platform-independent and language-neutral fashion.
Web Services rely on several XML protocols based on open standards that are collectively known as the Web Services architecture

24.Define Automatic memory Management:
c# Provides Automatic memory Management.
Automatic memory Management increases code quality and enhances developer productivity without negatively impacting
either expressivenessor perfromance.Developers are freed from this burdensome task.

25.Define Threading:
It's a process of creating applications that can perform multiple tasks independently.

26 Difference Between XML AND HTML?
XML:
User definable tags.
Content driven
End tags required for well formed documents
Quotes required around attributes values
Slash required in empty tags
HTML :
Defined set of tags designed for web display
Format driven
End tags not required
Quotes not required
Slash not required

27.What is XSLT and what is it's use?
XSL Transformations (XSLT) is yet another popular W3C specification that defines XML-based syntax, used to transform XML documents to any other text format, such as HTML, text, XML, etc. XSLT stylesheets can be applied on the source XML document to transform XML into some other XML, or text, HTML, or any other text format.

28.What is Diffgram?
It's an XML format.
It's one of the two xml formats that use to render Dataset object contents to XML.
For reading database data to an XML file to be sent to a webservice.

29.what is the Role of XSL?
Querying a database and then formatting the result set so that it can be validated as an XML document allows developers to translate the data into an HTML table using XSLT rules. Consequently, the format of the resulting HTML table can be modified without changing the database query or application code since the document rendering logic is isolated to the XSLT rules

30.What is SAX?
Simple API for XML Processing (SAX) is an alternative to DOM, and can be used to parse XML documents. SAX is based on streaming model. The SAX parser reads input XML stream and generates various parsing events that an application can handle. With each parsing event, the parser sends sufficient information about the node being parsed. Unlike DOM, SAX does not build an in-memory representation of the source XML document, and hence it is an excellent alternative when parsing large XML documents, as SAX does not require that much memory (and resources). Unlike DOM, SAX is not defined/controlled by W3C. See http://www.saxproject.org/ for details.


32.Give a few examples of types of applications that can benefit from using XML.
XML allows content management systems to store documents independently of their format, which thereby reduces data redundancy. Another answer relates to B2B exchanges or supply chain management systems. In these instances, XML provides a mechanism for multiple companies to exchange data according to an agreed upon set of rules. A third common response involves wireless applications that require WML to render data on hand held devices.

33.When constructing an XML DTD, how do you create an external entity reference in an attribute value?
when using SGML, XML DTDs don't support defining external entity references in attribute values.

34.Give some examples of XML DTDs or schemas that you have worked with.
Although XML does not require data to be validated against a DTD, many of the benefits of using the technology are derived from being able to validate XML documents against business or technical architecture rules. Polling for the list of DTDs that developers have worked with provides insight to their general exposure to the technology.commonly used DTDs such as FpML, DocBook, HRML, and RDF, as well as experience designing a custom DTD for a particular project

35.What is SOAP and how does it relate to XML?
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.

36.What is WSDL?
Another key standard in the Web Services architecture is the Web Services Description Language, or WSDL for short. Whereas SOAP is responsible for providing a platform-neutral protocol for transporting data types and interapplication messaging, WSDL is an XML grammar responsible for exposing the methods, arguments, and return parameters exposed by a particular Web Service.

37.What’s the difference between authentication and authorization?
Authentication happens first. You verify user’s identity based on credentials. Authorization is making sure the user only gets access to the resources he has credentials for.
38.Explain loosely coupled events. Loosely coupled events enable an object (publisher) to publish an event. Other objects (subscribers) can subscribe to an event. COM+ does not require publishers or subscribers to know about each other. Therefore, loosely coupled events greatly simplify the programming model for distributed applications.

39.Define scalability.
The application meets its requirement for efficiency even if the number of users increases.

40.Define reliability.
The application generates correct and consistent information all the time.

41.Define availability.
Users can depend on using the application when needed.

42.Define security.
The application is never disrupted or compromised by the efforts of malicious or ignorant users

43.Define manageability.
Deployment and maintenance of the application is as efficient and painless as possible

44.Explain durability.
Make sure that the system can return to its original state in case of a failure.

45.Explain integrity.
Ensure data integrity by protecting concurrent transactions from seeing or being adversely affected by each other’s partial and uncommitted results.

46.Explain consistency.
We must ensure that the system is always left at the correct state in case of the failure or success of a transaction.

47.Explain JIT activation.
The objective of JIT activation is to minimize the amount of time for which an object lives and consumes resources on the server. With JIT activation, the client can hold a reference to an object on the server for a long time, but the server creates the object only when the client calls a method on the object. After the method call is completed, the object is freed and its memory is reclaimed. JIT activation enables applications to scale up as the number of users increases

48.Define Constructors and destructors
The create and destroy methods - often called constructors and destructors - are usually implemented for any abstract data type. Occasionally, the data type's use or semantics are such that there is only ever one object of that type in a program. In that case, it is possible to hide even the object's `handle' from the user. However, even in these cases, constructor and destructor methods are often provided.

Of course, specific applications may call for additional methods, e.g. we may need to join two collections (form a union in set terminology) - or may not need all of these.

ASP.NET

ASP.NET AJAX 

  1. Web developers work around these sorts of limitations using JavaScript, the only broadly supported client-side scripting language. In ASP.NET, many of the most powerful controls use a healthy bit of JavaScript. For example, the Menu control responds immediately as the user moves the mouse over different subheadings. When you use the Menu control, your page doesn’t post back to the server until the user clicks an item
  2. Restless web developers have responded to challenges like these by using more client-side code and applying it in more advanced ways. One of the most talked about examples today is Ajax (Asynchronous JavaScript and XML). Ajax is programming shorthand for a client-side technique that allows your page to call the server and update its content without triggering a complete postback. Typically, an Ajax page uses client-side script code to fire an asynchronous request behind the scenes. The server receives this request, runs some code, and then returns the data your page needs (often as a block of XML markup). Finally, the client-side code receives the new data and uses it to perform another action, such as refreshing part of the page. Although Ajax is conceptually quite simple, it allows you to create pages that work more like seamless, continuously running applications

ASP.NET


What's New in ASP.NET

  1. Navigation. ASP.NET’s navigation framework includes a mechanism for defining site maps that describe the logical arrangement of pages in a website. It also includes navigation controls (such as trees and breadcrumb-style links) that use this information to let users move through the site. 
  2. Data source controls: The data source control model allows you to define how your page interacts with a data source declaratively in your markup, rather than having to write the equivalent data access code by hand. Best of all, this feature doesn’t force you to abandon good component-based design—you can bind to a custom data component just as easily as you bind directly to the database
  3. Themes: Themes allow you to define a standardized set of appearance characteristics for web controls. Once defined, you can apply these formatting presets across your website for a consistent look. 
  4. Master pages: Master pages are reusable page templates. For example, you can use a master page to ensure that every web page in your application has the same header, footer, and navigation controls. 
  5. Profiles: Profiles allow you to store user-specific information in a database without writing any database code. Instead, ASP.NET takes care of the tedious work of retrieving the profile data when it’s needed and saving the profile data when it changes. 
  6. Web parts: One common type of web application is the portal, which centralizes different information using separate panes on a single web page. Web parts provide a prebuilt portal framework complete with a flow-based layout, configurable views, and even drag-and-drop support.  

ASP.NET

ASP.NET Supports all Browsers 

  1. The Best advantage of ASP.NET is all Browsers supports .One of the greatest challenges web developers face is the wide variety of browsers they need to support. Different browsers, versions, and configurations differ in their support of XHTML, CSS, and JavaScript. Web developers need to choose whether they should render their content according to the lowest common denominator, and whether they should add ugly hacks to deal with well-known quirks on popular browsers. 
  2. These ASP.NET server controls render their markup adaptively by taking the client’s capabilities into account. One example is ASP.NET’s validation controls, which use JavaScript and DHTML (Dynamic HTML) to enhance their behavior if the client supports it. Another example is the set of Ajax-enabled controls, which uses complex JavaScript routines that test browser versions and use carefully tested workarounds to ensure consistent behavior. These features are optional, but they demonstrate how intelligent controls can make the most of cutting-edge browsers without shutting out other clients. Best of all, you don’t need any extra coding work to support both types of client. 

ASP.NET

ADVANTAGES OF ASP.NET


  1. Structured error handling: .NET languages offer structured exception handling, which allows you to organize your error-handling code logically and concisely. You can create separate blocks to deal with different types of errors. You can also nest exception handlers multiple layers deep
  2. Type safety: When you compile an application, .NET adds information to your assembly that indicates details such as the available classes, their members, their data types, and so on. As a result, other applications can use them without requiring additional support files, and the compiler can verify that every call is valid at runtime. This extra layer of safety completely obliterates whole categories of low-level errors.
  3. Multithreading: The CLR provides a pool of threads that various classes can use. For example, you can call methods, read files, or communicate with web services asynchronously, without needing to explicitly create new threads. 
  4. Automatic memory management and garbage collection: Every time your application instantiates a reference-type object, the CLR allocates space on the managed heap for that object. However, you never need to clear this memory manually. As soon as your reference to an object goes out of scope (or your application ends), the object becomes available for garbage collection. The garbage collector runs periodically inside the CLR, automatically reclaiming unused memory for inaccessible objects. This model saves you from the low-level complexities of C++ memory handling and from the quirkiness of COM reference counting

AS.NET

 ASP.NET is Multilanguage

  1. you will probably opt to use one language over another when you develop an application, that choice won’t determine what you can accomplish with your web applications. That’s because no matter what language you use, the code is compiled into IL 
  2. IL is a stepping stone for every managed application. (A managed application is any application that’s written for .NET and executes inside the managed environment of the CLR.) In a sense, IL is the language of .NET, and it’s the only language that the CLR recognizes. 

Example


using System; 
 
namespace Exaple
 {   
  public class ExampleClass
  {        
 static void Main(string[] RJ)   
      {           
  Console.WriteLine("Hello ASP.NET");  
       } 
    } 
}


In VB Code


Imports System 
 
Namespace Example
   Public Class ExampleClass
Shared Sub Main(RJ() As String)     
        Console.WriteLine("Hello ASP.NET")    
     End Sub    
 End Class 
End Namespace 

ASP.NET

ASP.NET is Compiled, Not Interpreted 

  1. ASP.NET applications, like all .NET applications, are always compiled. In fact, it’s impossible to execute C# or Visual Basic code without it being compiled first.
  2. The second level of compilation happens just before the page is actually executed. At this point, the IL code is compiled into low-level native machine code. This stage is known as just-in-time (JIT) compilation, and it takes place in the same way for all .NET applications (including Windows applications )

Part 20 consuming rest api in ionic

in this video, I will show you that how you can consume the rest API. in the previous video we have implemented the asp.net web API projec...