1). Difference between Abstract and Virtual functions?
Ans:-
Abstract function
1. An abstract function has no implementation. It can only be declared. This forces the derived class to provide the implementation of it i.e must be implemented in a child or derived class.
2. Abstract means we MUST override it in a child or derived class.
3. An abstract member is implicitly virtual. The abstract can be called pure virtual in some of the languages.
Virtual Function
1. Virtual Function has an implementation. When we inherit the class we can override the virtual function and provide our own logic.
2. We can change the return type of Virtual function while implementing the function in the child class(which can also call Shadowing).
3. Virtual means we CAN override it.
2). What are the 3 levels at which content pages can be attached to Master Page?
Ans:-
The 3 levels at which content pages can be attached to Master Page are as follows,
I. At the page level - You can use a page directive in each content page to bind it to a master page.
ii. At the application level - By making a setting in the pages element of the application's configuration file (Web.config), you can specify that all ASP.NET pages (.aspx files) in the application automatically bind to a master page.
iii. At the folder level - This strategy is like binding at the application level, except that you make the setting in a Web.config file in one folder only. The master-page bindings then apply to the ASP.NET pages in that folder.
3). What are Master Pages in ASP.NET? or What is a Master
Page?
Ans:-
ASP.NET master pages allow us to create a consistent layout for the pages in our application. A master page is the common page of the application. A single master page defines the look and feels and standard behavior that we want for all of the pages (or a group of pages) in our application. We can then create individual content pages that contain the content we want to display. When users request the content pages, they merge with the master page to produce output that combines the layout of the master page with the content from the content page.
4.) What is the difference between ReadOnly and Constant?
Ans:-
Const: A constant member is defined at compile-time and cannot be changed at runtime. Constants are declared as a field, using the const keyword and must be initialized as they are declared.
ReadOnly: A read only member is like a constant in that it represents an unchanging value. The difference is that a readonly member can be initialized at runtime, in a constructor as well being able to be initialized as they are declared.
5). What is difference between IEnumerable and IQueryable?
Ans:-
IEnumerable: IEnumerable is best suitable for working with in-memory collection (or local queries). IEnumerable doesn't move between items, it is forward only collection.
IQueryable: IQueryable best suits for remote data source, like a database or web service (or remote queries). IQueryable is a very powerful feature that enables a variety of interesting deferred execution scenarios (like paging and composition based queries).
So when we have to simply iterate through the in-memory collection, use IEnumerable, if we need to do any manipulation with the collection like Dataset and other data sources, use IQueryable
6). What is difference between Direct CAST and CType ?Ans:-
1. CType is capable of a *cast* or a *conversion*. DirectCast can only
*cast*
By "conversion" I mean converting one data type to another (e.g. string to
integer, decimal to integer, object to string etc).
By "cast" I mean changing one type of object into another type .
7). Difference between singleton and static?
Ans:-
Singleton class
only one time we need to create the object and access throughout globally
static class
not possible to create the object
8). Difference between static variable and application variables?
Ans:-
Application variables are stored at application level and also can be accessed at application-level.
but static varaiables are session-oriented and also can be access at session-level.
9). Difference Between ToString() and Convert.ToString() ?
Ans:
The basic difference between them is “Convert.ToString(variable)” handles NULL values even if variable value become null but “variable.ToString()” will not handle NULL values it will throw a NULL reference exception error. So as a good coding practice using “convert” is always safe.
Page?
Ans:-
ASP.NET master pages allow us to create a consistent layout for the pages in our application. A master page is the common page of the application. A single master page defines the look and feels and standard behavior that we want for all of the pages (or a group of pages) in our application. We can then create individual content pages that contain the content we want to display. When users request the content pages, they merge with the master page to produce output that combines the layout of the master page with the content from the content page.
4.) What is the difference between ReadOnly and Constant?
Ans:-
Const: A constant member is defined at compile-time and cannot be changed at runtime. Constants are declared as a field, using the const keyword and must be initialized as they are declared.
ReadOnly: A read only member is like a constant in that it represents an unchanging value. The difference is that a readonly member can be initialized at runtime, in a constructor as well being able to be initialized as they are declared.
5). What is difference between IEnumerable and IQueryable?
Ans:-
IEnumerable: IEnumerable is best suitable for working with in-memory collection (or local queries). IEnumerable doesn't move between items, it is forward only collection.
IQueryable: IQueryable best suits for remote data source, like a database or web service (or remote queries). IQueryable is a very powerful feature that enables a variety of interesting deferred execution scenarios (like paging and composition based queries).
So when we have to simply iterate through the in-memory collection, use IEnumerable, if we need to do any manipulation with the collection like Dataset and other data sources, use IQueryable
6). What is difference between Direct CAST and CType ?Ans:-
1. CType is capable of a *cast* or a *conversion*. DirectCast can only
*cast*
By "conversion" I mean converting one data type to another (e.g. string to
integer, decimal to integer, object to string etc).
By "cast" I mean changing one type of object into another type .
7). Difference between singleton and static?
Ans:-
Singleton class
only one time we need to create the object and access throughout globally
static class
not possible to create the object
8). Difference between static variable and application variables?
Ans:-
Application variables are stored at application level and also can be accessed at application-level.
but static varaiables are session-oriented and also can be access at session-level.
9). Difference Between ToString() and Convert.ToString() ?
Ans:
The basic difference between them is “Convert.ToString(variable)” handles NULL values even if variable value become null but “variable.ToString()” will not handle NULL values it will throw a NULL reference exception error. So as a good coding practice using “convert” is always safe.
No comments:
Post a Comment