Saturday, December 20, 2008

CERTIFICATION PAPERS

ASP.NET PAPER CODE NO:1
1) Which of the following languages can be used to write server side scripting in ASP.NET?
a) C-sharp
b) VB
c) C++
d) a and b


2) When an .aspx page is requested from the web server, the out put will be rendered to browser in following format.
a) HTML
b) XML
c) WML
d) JSP

3) The Asp.net server control, which provides an alternative way of displaying text on web page, is
a) <>
b) <>
c) <>

4) The first event to be triggered in an aspx page is.
a) Page_Load()
b) Page_Init()
c) Page_click()

5) Postback occurs in which of the following forms.
a) Winforms
b) HTMLForms
c) Webforms

6) What namespace does the Web page belong in the .NET Framework class hierarchy?
a) System.web.UI.Page
b) System.Windows.Page
c) System.Web.page


7) Which method do you invoke on the Data Adapter control to load your generated dataset?
a) Fill( )
b) ExecuteQuery( )
c) Read( )

8) How do you register a user control?
a) Add Tag prefix, Tag name
b) Add Source, Tag prefix
c) Add Src, Tagprefix, Tagname

9) Which of the following is true?
a) User controls are displayed correctly in the Visual Studio .NET Designer
b) Custom controls are displayed correctly in VS.Net Designer
c) User and Custom controls are displayed correctly in the Visual Studio .NET Designer.

10) To add a custom control to a Web form we have to register with.
a) TagPrefix
b) Name space of the dll that is referenced
c) Assemblyname
d) All of the above

11) Custom Controls are derived from which of the classes
a) System.Web.UI.Webcontrol
b) System.Web.UI.Customcontrol
c) System.Web.UI.Customcontrols.Webcontrol

12) How ASP.Net Different from classic ASP?
a) Scripting is separated from the HTML, Code is interpreted seperately
b) Scripting is separated from the HTML, Code is compiled as a DLL, the
DLLs can be executed on server
c) Code is separated from the HTML and interpreted Code is interpreted separately

13) What's the difference between Response.Write() andResponse.Output.Write()?
a) Response.Output.Write() allows you to flush output
b) Response.Output.Write() allows you to buffer output
c) Response.Output.Write() allows you to write formatted output
d) Response.Output.Write() allows you to stream output

14) Why is Global.asax is used?
a) Implement application and session level events
b) Declare Global variables
c) No use

15) There can be more than 1 machine.config file in a system
a) True
b) False

16) What is the extension of a web user control file?
a) .Asmx
b) .Ascx
c) .Aspx

17) Which of the following is true?
a) IsPostBack is a method of System.UI.Web.Page class
b) IsPostBack is a method of System.Web.UI.Page class
c) IsPostBack is a readonly property of System.Web.UI.Page class

8) The number of forms that can be added to a aspx page is.
a) 1
b) 2
c) 3
d) More than 3
19) How do you manage states in asp.net application
a) Session Objects
b) Application Objects
c) Viewstate
d) All of the above

20) Which property of the session object is used to set the local identifier?
a) SessionId
b) LCID
c) Item
d) Key

21) Select the caching type supported by ASP.Net
a) Output Caching
b) DataCaching
c) a and b
d) none of the above

22) Where is the default Session data is stored in ASP.Net?
a) InProcess
b) StateServer
c) Session Object
d) al of the above

23) Select the type Processing model that asp.net simulate
a) Event-driven
b) Static
c) Linear
d) Topdown

24) Does the EnableViewState allows the page to save the users input on a form?
a) Yes
b) No

25) Which DLL translate XML to SQL in IIS?
a) SQLISAPI.dll
b) SQLXML.dll
c) LISXML.dll
d) SQLIIS.dll

26) What is the maximum number of cookies that can be allowed to a web site?
a) 1
b) 10
c) 20
d) More than 30

27) Select the control which does not have any visible interface.
a) Datalist
b) DropdownList
c) Repeater
d) Datagrid
28) How do you explicitly kill a user session?
a) Session.Close( )
b) Session.Discard( )
c) Session.Abandon
d) Session.End
e) Session.Exit

29) Which of the following is not a member of ADODBCommand object?
a) ExecuteReader
b) ExecuteScalar
c) ExecuteStream
d) Open
e) CommandText

30) Which one of the following namespaces contains the definition for IdbConnection?
a) System.Data.Interfaces
b) System.Data.Common
c) System.Data
d) System.Data.Connection

ANSWEARS PAPER NO:1
http://mohandotnet.wordpress.com/papers/

Monday, September 29, 2008

connection strings in .NET

What are the standard dot net framework data providers that are shipped with the Dot Net framework 1.1?
The Dot Net Framework 1.1 is shipped with four different data providers:
Dot Net Framework data provider for Microsoft SQL Server DBMS
Dot Net Framework data provider for Oracle DBMS (available only in Framework 1.1)
Dot Net Framework data provider for OLEDB supporting DBMS
Dot Net Framework data provider for ODBC supporting data sources (available only in Framework 1.1)
Why should one use a specialized data provider when the data can be accessed with general data providers?
The specialized data providers (e.g., SQL Server and Oracle) are built specially for a particular kind of DBMS and works much more efficiently than the general data providers (e.g., OLEDB and ODBC). In practice, the specialized data providers are many times efficient than the general data providers.
What is the Dot Net Framework data provider for SQL Server?
The dot net framework data provider for SQL Server is the optimized data provider for Microsoft SQL Server 7 or later. It is recommended to use SQL Server data provider to access the SQL Server DB than general provider like OLEDB. The classes for this provider are present in the System.Data.SqlClient namespace.
What is the Dot Net Framework data provider for Oracle?
The dot net framework data provider for Oracle is the optimized data provider for Oracle DBMS. It is recommended to use Oracle data provider to access the Oracle DB than general provider like OLEDB. It supports the Oracle Client version 8.1.7 and later. The classes for this provider are present in the System.Data.OracleClient namespace. This provider is included in the .Net framework 1.1 and was not available in the Dot Net framework 1.0.
What is the Dot Net Framework data provider for OLEDB?
The dot net framework data provider for OLEDB provides connectivity with the OLEDB supported database management systems. It is the recommended middle tier for the SQL Server 6.5 or earlier and Microsoft Access Database. It is a general data provider. You can also use it to connect with the SQL Server or Oracle Database Management Systems. The classes for this provider are present in the System.Data.OleDBClient namespace.
What is the Dot Net Framework data provider for ODBC?
The dot net framework data provider for ODBC provides connectivity with the ODBC supported database management systems and data sources. It is a general data provider. You can also use it to connect with the SQL Server or Oracle Database Management Systems. The classes for this provider are present in the System.Data.ODBCClient namespace. This provider is included in the .Net framework 1.1 and was not available in the Dot Net framework 1.0.
What are the basic steps involved in data access with ADO.Net in disconnected environment?
Data access using ADO.Net involves the following steps:
>>Defining the connection string for the database server
>>Defining the connection (SqlConnection, OleDbConnection, etc) to the database using the connection string
>>Defining the command (SqlCommand, OleDbCommand, etc) or command string that contains the query
>>Defining the data adapter (SqlDataAdapter, OleDbDataAdapter, etc) using the command string and the connection object
>>Creating a new DataSet object
>>If the command is SELECT, filling the dataset object with the result of the query through the data adapter
>>Reading the records from the DataTables in the datasets using the DataRow and DataColumn objects
>>If the command is UPDATE, INSERT or DELETE, then updating the dataset through the data adapter

>>Accepting to save the changes in the dataset to the database

How do I define a connection string for the database server?
For MS SQL Server, used with the SQL Server data provider, we can write the connection string like:
C# Version

// for Sql Serverstring connectionString = "server=P-III; database=programmersheaven;" +_"uid=sa; pwd=;";
VB.Net Version'

/ for Sql ServerDim

connectionString As String = "server=P-III; database=programmersheaven;" + _ "uid=sa; pwd=;"
First of all we have defined the instance name of the server, which is P-III on my system. Next we defined the name of the database, user id (uid) and password (pwd). Since my SQL server doesn't have a password for the System Administrator (sa) user, I have left it blank in the connection string. (Yes I know this is very dangerous and is really a bad practice - never, ever use a blank password on a system that is accessible over a network)
For Oracle Database Server, used with the Oracle data provider, we can write the connection string like:
C# Version

string connectionString = "Data Source=Oracle8i;User Id=username;" + "Password=pwd; Integrated Security=no;";
VB.Net Version

Dim connectionString As String = "Data Source=Oracle8i;User Id=username;" + _"Password=pwd; Integrated Security=no;"
For MS Access Database, used with the OLE DB data provider, we can write the connection string like:
C# Version

// for MS Accessstring

connectionString = "provider=Microsoft.Jet.OLEDB.4.0;" + "data source = c:\\programmersheaven.mdb";
VB.Net Version

' for MS Access

Dim connectionString As String = "provider=Microsoft.Jet.OLEDB.4.0;" + _ "data source = c:\programmersheaven.mdb"
First we have defined the provider of the access database. Then we have defined the data source which is the address of the target database.
For MS SQL Server, used with the ODBC data provider, we can write the connection string like:
C# Version

string connectionString = "Driver={SQL Server};Server=FARAZ;Database=pubs;Uid=sa;Pwd=;";
VB.Net Version

Dim connectionString As String = "Driver={SQL Server};Server=FARAZ;Database=pubs;Uid=sa;Pwd=;"

Data Base iN ADO.net

What is a dataset?
A dataset is the local repository of the data used to store the tables and disconnected record set. When using disconnected architecture, all the updates are made locally to dataset and then the updates are performed to the database as a batch.

What is a data adapter?

A data adapter is the component that exists between the local repository (dataset) and the physical database. It contains the four different commands (SELECT, INSERT, UPDATE and DELETE). It uses these commands to fetch the data from the DB and fill into the dataset and to perform updates done in the dataset to the physical database. It is the data adapter that is responsible for opening and closing the database connection and communicates with the dataset.

What is a database connection?
A database connection represents a communication channel between you application and database management system (DBMS). The application uses this connection to pass the commands and queries to the database and obtain the results of the operations from the database.
What is a database command?
A database command specifies which particular action you want to perform to the database. The commands are in the form of SQL (Structured Query Language). There are four basic SQL statements that can be passed to the database.
SQL SELECT Statement
This query is used to select certain columns of certain records from a database table.

SELECT * from emp// sql steaments
selects all the fields of all the records from the table name ‘emp’
SELECT empno, ename from emp
selects the fields empno and ename of all records from the table name ‘emp’

SELECT * from emp where empno <>
selects all those records from the table name ‘emp’ that have the value of the field empno less than 100
SELECT * from article, author where article.authorId = author.authorId
selects all those records from the table name ‘article’ and ‘author’ that have same value of the field authorId
SQL INSERT Statement
This query is used to insert a record to a database table.
INSERT INTO emp(empno, ename) values(101, ‘John Guttag’)
inserts a record to emp table and set its empno field to 101 and its ename field to ‘John Guttag’
SQL UPDATE Statement
This query is used to edit an already existing record in a database table.

UPDATE emp SET ename =‘Eric Gamma’ WHERE empno = 101
updates the record whose empno field is 101 by setting its ename field to ‘Eric Gamma’
SQL DELETE Statement
This query is used to delete the existing record(s) from the database table

DELETE FROM emp WHERE empno = 101
deletes the record whose empno field is 101 from the emp table

What is a data reader?
The data reader is a component that reads the data from the database management system and provides it to the application. The data reader works in the connected manner; it reads a record from the DB, pass it to the application, then reads another and so on.
How do different components of ADO.Net interact with each other in disconnected architecture?
The Data Adapter contains in it the Command and Connection object. It uses the connection object to connect to the database, execute the containing command, fetch the result and update the DataSet.
What does it mean by Dot Net Framework Data Provider?
Dot Net Framework Data Provider is a set of classes that establishes the database communication between an application and the database management system based on the standards of ADO.Net framework. Different data providers provide specialized and optimized connectivity to particular database management system or to a particular class of DBMS. For example, the MS SQL Server data provider provides the optimized connectivity between dot net application and MS SQL Server DBMS while the OLEDB data provider provides the uniform connectivity between dot net application and the OLEDB databases.

ADO.NET

What is ADO.Net?
Most of the today’s applications need to interact with database systems to persist, edit or view data. In .Net data access service is provided through ADO.Net (ActiveX Data Object in Dot Net) components. ADO.Net is an object oriented framework that allows you to interact with database systems. We usually interact with database systems through SQL queries or stored procedures. ADO.Net encapsulates our queries and commands to provide a uniform access to various database management systems.
ADO.Net is a successor of ADO (ActiveX Data Object). The prime features of ADO.Net are its disconnected data access architecture and XML integration.
What does it mean by disconnected data access architecture of ADO.Net?
ADO.Net introduces the concept of disconnected data architecture. In traditional data access components, you make a connection to the database system and then interact with it through SQL queries using the connection. The application stays connected to the DB system even when it is not using DB services. This commonly wastes the valuable and expensive database resource as most of the time applications only query and view the persistent data. ADO.Net solves this problem by managing a local buffer of persistent data called data set. Your application automatically connects to the database server when it needs to pass some query and then disconnects immediately after getting the result back and storing it in dataset. This design of ADO.Net is called disconnected data architecture and is very much similar to the connection less services of http over the internet. It should be noted that ADO.Net also provides the connection oriented traditional data access services.

What does it mean by disconnected data access architecture of ADO.Net?
ADO.Net introduces the concept of disconnected data architecture. In traditional data access components, you make a connection to the database system and then interact with it through SQL queries using the connection. The application stays connected to the DB system even when it is not using DB services. This commonly wastes the valuable and expensive database resource as most of the time applications only query and view the persistent data. ADO.Net solves this problem by managing a local buffer of persistent data called data set. Your application automatically connects to the database server when it needs to pass some query and then disconnects immediately after getting the result back and storing it in dataset. This design of ADO.Net is called disconnected data architecture and is very much similar to the connection less services of http over the internet. It should be noted that ADO.Net also provides the connection oriented traditional data access services.

What does it mean by connected data access architecture of ADO.Net?
In the connected environment, it is your responsibility to open and close the database connection. You first establish the database connection, perform the interested operations to the database and when you are done, close the database connection. All the changes are done directly to the database and no local (memory) buffer is maintained.
What's the difference between accessing data with dataset or data reader?
The dataset is generally used when you like to employ the disconnected architecture of the ADO.Net. It reads the data into the local memory buffer and perform the data operations (update, insert, delete) locally to this buffer.
The data reader, on the other hand, is directly connected to the database management system. It passes all the queries to the database management system, which executes them and returns the result back to the application.
Since no memory buffer is maintained by the data reader, it takes up fewer resources and performs more efficiently with small number of data operations. The dataset, on the other hand is more efficient when large number of updates are to be made to the database. All the updates are done in the local memory and are updated to the database in a batch. Since database connection remains open for the short time, the database management system does not get flooded with the incoming requests.
What are the performance considerations when using dataset?
Since no memory buffer is maintained by the data reader, it takes up fewer resources and performs more efficiently with small number of data operations. The dataset, on the other hand is more efficient when large number of updates are to be made to the database. All the updates are done in the local memory and are updated to the database in a batch. Since database connection remains open for the short time, the database management system does not get flooded with the incoming requests.
However, since the dataset stores the records in the local buffer in the hierarchical form, it does take up more resources and may affect the overall performance of the application.
How to select dataset or data reader?
The data reader is more useful when you need to work with large number of tables, database in non-uniform pattern and you need not execute the large no. of queries on few particular table.
When you need to work on fewer no. of tables and most of the time you need to execute queries on these fewer tables, you should go for the dataset.
It also depends on the nature of application. If multiple users are using the database and the database needs to be updated every time, you must not use the dataset. For this, .Net provides the connection oriented architecture. But in the scenarios where instant update of database is not required, dataset provides optimal performance by making the changes locally and connecting to database later to update a whole batch of data. This also reduces the network bandwidth if the database is accessed through network.
Disconnected data access is suited most to read only services. On the down side, disconnected data access architecture is not designed to be used in the networked environment where multiple users are updating data simultaneously and each of them needs to be aware of current state of database at any time (e.g., Airline Reservation System).
How XML is supported in ADO.Net?
The dataset is represented in the memory as an XML document. You can fill the dataset by XML and can also get the result in the form of XML. Since XML is an international and widely accepted standard, you can read the data using the ADO.Net in the XML form and pass it to other applications using Web Service. These data consuming application need not be the essentially Dot Net based. They may be written with Java, C++ or any other programming language and running on any platform.

MAIN LINKS IN .net

**** .net all effects of trail in live:


http://www.obout.com/grid/?gclid=CKPDoYyTqZYCFQdIegodmQvMyw



***This is a link to conevert to C#.net TO VB.net
http://www.developerfusion.com/tools/convert/csharp-to-vb/

All java Scripts link
http://www.dynamicdrive.com/dynamicindex1/slashdot.htm


***ajax.net action page:
Site:
http://www.dofactory.com/Framework/Framework.aspx

http://www.dofactory.com/Ajax/Source/AjaxSource.aspx?id=AjaxMessageText&file=

Ajax sites download:

http://asp.net/ajax/downloads/

http://blogs.msdn.com/kirti/


Ajax toolkit properties all:
http://asp.net/AJAX/AjaxControlToolkit/Samples/Rating/Rating.aspx



.net material 3tire,web services:
http://www.c-sharpcorner.com/UploadFile/ashok_kp/IntroductionToWebServicesT11252005045531AM/IntroductionToWebServicesT.aspx

.net controls site:

http://demos.devexpress.com/ASPxperienceDemos/PopupControl/Features.aspx

Java scripts:

http://www.dynamicdrive.com/dynamicindex1/slashdot.htm

a great software , update to 2.51 versiom

http://effectmatrix.com/Youtube_video_download_tool/index.htm


A_Programmers_Introduction_to_Visual_Basic.NET.pdf

http://rapidshare.com/files/91385783/A_Programmers_Introduction_to_Visual_Basic.NET.pdf

Applied_Microsoft.NET_Framework_Programming.pdf

http://rapidshare.com/files/91385956/Applied_Microsoft.NET_Framework_Programming.pdf

Apress.dot.NET.

2.0.Interoperability.Recipes.A.Problem.Solution.Approach.Mar.2006.pdf

http://rapidshare.com/files/91386689/Apress.dot.NET.2.0.Interoperability.Recipes.A.Problem.Solution.Approach.Mar.2006.pdf
Apress.Foundations.of.Object.Oriented.Programming.Using.dot.NET.
2.0.Patterns.Oct.2005.pdf

http://rapidshare.com/files/91386979/Apress.Foundations.of.Object.Oriented.Programming.Using.dot.NET.2.0.Patterns.Oct.2005.pdf


ASP.NET_2.0_Unleashed.chm

http://rapidshare.com/files/91388239/ASP.NET_2.0_Unleashed.chm


ASP.NET_for_Developers.pdf

http://rapidshare.com/files/91389149/ASP.NET_for_Developers.pdf


Beginning_Ajax_with_ASP.NET.pdf

http://rapidshare.com/files/91389410/Beginning_Ajax_with_ASP.NET.pdf


Beginning_ASP_.NET_3.5_in_C__2008_Second_Edition.pdf

http://rapidshare.com/files/91390785/Beginning_ASP_.NET_3.5_in_C__2008_Second_Edition.pdf


Beginning_ASP.NET_2.0__Wrox2006__by_Tantanoid.pdf

http://rapidshare.com/files/91391107/Beginning_ASP.NET_2.0__Wrox2006__by_Tantanoid.pdf


Beginning_ASP.NET_3.5_in_C__2008_Second_Edition.pdf

http://rapidshare.com/files/91392565/Beginning_ASP.NET_3.5_in_C__2008_Second_Edition.pdf



Microsoft.Press.Application.Interoperability.Microsoft.Dot.NET.and.J2EE.Dot.Patterns._.Practices.eBo

http://rapidshare.com/files/91392684/Microsoft.Press.Application.Interoperability.Microsoft.Dot.NET.and.J2EE.Dot.Patterns._.Practices.eBo


Pro_.NET_2.0_Code_and_Design_Standards_in_C_.pdf

http://rapidshare.com/files/91393152/Pro_.NET_2.0_Code_and_Design_Standards_in_C_.pdf


Pro_.NET_2.0_Windows_Forms_and_Custom_Controls_in_C_.pdf

http://rapidshare.com/files/91394280/Pro_.NET_2.0_Windows_Forms_and_Custom_Controls_in_C_.pdf


Pro_ADO.NET_2.0.pdf

http://rapidshare.com/files/91394597/Pro_ADO.NET_2.0.pdf


Pro_ASP.NET_2.0_in_C__2005.pdf

http://rapidshare.com/files/91395501/Pro_ASP.NET_2.0_in_C__2005.pdf


Pro_Scalable_.NET_2.0_Application_Designs.pdf

http://rapidshare.com/files/91397861/Pro_Scalable_.NET_2.0_Application_Designs.pdf


Professional_.NET_Framework_2.0.chm

http://rapidshare.com/files/91398772/Professional_.NET_Framework_2.0.chm



Professional_ADO.NET_2_Programming_with_SQL_Server_2005_Oracle_and_MySQL.pdf


http://rapidshare.com/files/91399412/Professional_ADO.NET_2_Programming_with_SQL_Server_2005_Oracle_and_MySQL.pdf


Professional_Web_Parts_and_Custom_Controls_with_ASP.NET_2.0.pdf

http://rapidshare.com/files/91400468/Professional_Web_Parts_and_Custom_Controls_with_ASP.NET_2.0.pdf


SAMS_ASP.NET_2.0_Unleashed_SourceCode.zip.001

http://rapidshare.com/files/91402148/SAMS_ASP.NET_2.0_Unleashed_SourceCode.zip.001


SAMS_ASP.NET_2.0_Unleashed_SourceCode.zip.002

http://rapidshare.com/files/91403458/SAMS_ASP.NET_2.0_Unleashed_SourceCode.zip.002


Teach_Yourself_ASP.NET_2.0_in_24_Hours.chm

http://rapidshare.com/files/91404750/Teach_Yourself_ASP.NET_2.0_in_24_Hours.chm

http://www.homeandlearn.co.uk/csharp/csharp_s1p5.html

http://www.ajla.net/Mee      

 http://www.homeandlearn.co.uk/BC/BeginnersComputing.html

 http://www.homeandlearn.co.uk/NET/vbNet.html

 http://www.homeandlearn.co.uk/csharp/csharp.html

 http://www.homeandlearn.co.uk/csharp/csharp_s16p1.html

 http://homepage.ntlworld.com/kayseycarvey/

 http://geekswithblogs.net/pakistan/archive/2004/11/28/16320.aspx

http://www.spsvietnam.gov.vn/Lists/Ti%20liu/Attachments/222/[BOOKS]%20Patrik%20Holsti%20-%20SharePoint%202007.pdf

Microsoft Certification:

MCTS certification info

http://www.microsoft.com/learning/mcp/mcts/default.mspx mcts

http://www.microsoft.com/learning/mcp/mcts/webapps/default.mspx   web apps

http://www.microsoft.com/learning/mcp/mcts/winapps/default.mspx



Friday, September 26, 2008

ASP REMOTING

What are possible implementations of distributed applications in .NET?
.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.

When would you use .NET Remoting and when Web services?
Use remoting for more efficient exchange of information when you controL both ends of the appLication. Use Web services for  open-protocoL-based information exchange when you are just a cLient or a server with the other end beLonging to someone eLse.

What’s a proxy of the server ob3ect in .NET Remoting?
ItIs a fake copy of the server object that resides on the cLient side and behaves as if it was the server. It handLes the  communication between reaL server object and the cLient object. This process is aLso known as marshaLing.

What are remotable ob3ects in .NET Remoting?
RemotabLe objects are the objects that can be marshaLed across the appLication domains. 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.

What are channels in .NET Remoting?

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.

What security measures exist for .NET Remoting in System.Runtime.Remoting?

None. Security shouLd be taken care of at the appLication LeveL. Cryptography and other security techniques can be appLied  at appLication or server LeveL.

What is a formatter?

A formatter is an object that is responsibLe for encoding and seriaLizing data into messages on one end, and deseriaLizing  and decoding messages into data on the other end.

Choosing between HTTP and TCP for protocols and Binary and SOAP for formatters, what are the trade-offs?

Binary over TCP is the most effiecient, SOAP over HTTP is the most interoperabLe.

What’s SingleCall activation mode used for?

If the server object is instantiated for responding to just one singLe request, the request shouLd be made in SingLeCaLL mode. 

What’s Singleton activation mode?

A singLe object is instantiated regardLess of the number of cLients accessing it. Lifetime of this object is determined by  Lifetime Lease. 

How do you define the lease of the ob3ect?

By impLementing ILease interface when writing the cLass code. 

Can you configure a .NET Remoting ob3ect via XML file?

Yes, via machine.config and appLication LeveL .config fiLe (or web.config in ASP.NET).

AppLication-LeveL XML settings take precedence over machine.config. 

How can you automatically generate interface for the remotable ob3ect in .NET with

Microsoft tools?

Use the Soapsuds tooL.



ASP.C# OOPS2

What do you mean by authentication and authorization?

Authentication is the process of vaLidating a user on the credentiaLs (username and password) and

authorization performs after authentication. After Authentication a user wiLL be verified for

performing the various tasks, It access is Limited it is known asauthorization.

What are different types of directives in .NET?

@Page: Defines page-specific attributes used by the ASP.NET page parser and compiler. Can be

included only in .aspx files <%@ Page AspCompat3”TRUE” language3”C#” %>

@ControL:Defines control-specific attributes used by the ASP.NET page parser and compiler. Can be

included only in .ascx files. <%@ Control Language3”VB” EnableViewState3”false” %>

@Import: Explicitly imports a namespace into a page or user control. The Import           directive

cannot have more than one namespace attribute. To import multiple      namespaces,      use

multiple @Import directives. <% @ Import Namespace3”System.web” %>

@ImpLements: Indicates that the current page or user control implements the specified .NET

framework interface.<%@ Implements Interface3”System.Web.UI.IPostBackEventHandler” %>

@Register: Associates aliases with namespaces and class names for concise notation in   custom

server control syntax.<%@ Register Tagprefix3”Acme” Tagname3”AdRotator”

Src3”AdRotator.ascx” %>

@AssembLy: Links an assembly to the current page during compilation, making all           the

assemblyIs classes and interfaces available for use on the       page. <%@ Assembly

Name3”MyAssembly” %><%@ Assembly Src3”MySource.vb” %>

@OutputCache: Declaratively controls the output caching policies of an ASP.NET page or a

user control contained in a page<%@ OutputCache Duration3”#ofseconds” Location3”Any I Client I

Downstream I Server I None” Shared3”True I False” VaryByControl3”controlname” VaryByCustom3”browser

I customstring” VaryByHeader3”headers” VaryByParam3”parametername” %>

@Reference: Declaratively indicates that another user control or page source file should be

dynamically compiled and linked against the page in which this directive is declared.

How do I debug an ASP.NET appLication that wasn’t written with VisuaL Studio.NET and that doesn’t 

use code-behind?

Start the DbgClr debugger that comes with the .NET Framework SDK, open the file containingthe code you want to debug, and set your breakpoints. Start the ASP.NET application.

Go back to DbgClr, choose Debug Processes from the Tools menu, and select  aspnet_wp.exe from  thelist of processes. (If aspnet_wp.exe doesnIt appear in the list,check the ”Show system

processes” box.) Click the Attach button to attach to aspnet_wp.exe and begin debugging.

Be sure to enable debugging in the ASPX file before debugging it with DbgClr. You can   enable tell

ASP.NET to build debug executables by placing a <%@ Page Debug3”true” %>    statement at the top of an ASPX file or a   statement in a Web.config file.

Can a user browsing my Web site read my Web.config or GLobaL.asax fiLes?

No. The section of Machine.config, which holds the master configuration settings for ASP.NET, contains entries that map ASAX files, CONFIG files, and selected  other file types to an

HTTP handler named HttpForbiddenHandler, which fails attempts to retrieve the associated file. You

can modify it by editing  Machine.config or including an section in a local Web.config file.

What’s the difference between Page.RegisterCLientScriptBLock and Page.RegisterStartupScript?

RegisterClientScriptBlock is for returning blocks of client-side script containing functions.RegisterStartupScript is for returning blocks of client-script not    packaged in functions-in other words, code thatIs to execute when the page is loaded. The latter positions script blocks near the end of the document so elements on the page that the script interacts are loaded before the script runs.<%@ Reference Control3”MyControl.ascx” %>

What event handlers can I include in Global.asax? 

AppLication_Start,AppLication_End,

AppLication_AcquireRequestState, AppLication_AuthenticateRequest, AppLication_AuthorizeRequest,

AppLication_BeginRequest, AppLication_Disposed,  AppLication_EndRequest, AppLication_Error,

AppLication_PostRequestHandLerExecute, AppLication_PreRequestHandLerExecute,

AppLication_PreSendRequestContent, AppLication_PreSendRequestHeaders,

AppLication_ReLeaseRequestState, AppLication_ResoLveRequestCache,

AppLication_UpdateRequestCache, Session_Start,Session_End

You can optionaLLy incLude ”On” in any of method names. For exampLe, you can name a BeginRequest

event handLer.AppLication_BeginRequest or AppLication_OnBeginRequest.You can aLso incLude event

handLers in GLobaL.asax for events fired by custom HTTP moduLes.Note that not aLL of the event

handLers make sense for Web Services (theyIre designed for ASP.NET appLications in generaL, whereas

.NET XML Web Services are speciaLized instances of an ASP.NET app). For exampLe, the

AppLication_AuthenticateRequest and AppLication_AuthorizeRequest events are designed to be used

with ASP.NET Forms authentication.

Remoting

What distributed process frameworks outside .NET do you know?

Distributed Computing Environment1Remote Procedure CaLLs (DEC1RPC), Microsoft Distributed Component Object ModeL  (DCOM), Common Object Request Broker Architecture (CORBA), and Java Remote Method Invocation (RMI).




ASP.NET AND C#OOPS1

What’s the difference between const and readonly?

You can initiaLize readonLy variabLes to some runtime vaLues. Let‘s say your program uses current

date and time as one of the vaLues that won‘t change. This way you decLare pubLic readonLy string

DateT 3 new DateTime().ToString().

What does \a character do?

On most systems, produces a rather annoying beep. 

Can you create enumerated data types in C#?

Yes. 

What’s different about switch statements in C#?

No faLL-throughs aLLowed. 

What happens when you encounter a continue statement inside the for loop?

The code for the rest of the Loop is ignored, the controL is transferred back to the beginning of

the Loop. 

What’s 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 it‘s being operated on, a new instance is created. 

Can you store multiple data types in System.Array?

No. 

What’s 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. 

What’s the .NET datatype that allows the retrieval of data by a unique key?

HashTabLe. 

What’s class SortedList underneath?

A sorted HashTabLe. 

Will finally block get executed if the exception had not occurred?

Yes. 

What’s the C# equivalent of C++ catch (A), 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 WX. 

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. 

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. 

What’s a sateLLite assembLyi

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 appLicationi

System.Globalization, System.Resources. 

What’s the difference between II comments, I* *I comments and III commentsi

Single-line, multi-line and XML documentation comments. 

How do you generate documentation from the C# fiLe commented properLy with a command-Line compiLeri

Compile it with a /doc switch. 

What’s the difference between the Debug cLass and Trace cLassi

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.TraceSwitcheri

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 redirectedi

To the Console or a text file depending on the parameter passed to the constructor. 

How do you debug an ASP.NET Web appLicationi

Attach the aspnet_wp.exe process to the DbgClr debugger. 

What are three test cases you shouLd go through in unit testingi

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# appLicationi

Yes, if you are debugging via Visual Studio.NET, just go to Immediate window. 

ExpLain Inheritance, EncapsuLation, PoLymorphismi

CLass: A class is a template or blueprint that defines an object’s attributes and operations and

that is created at design time.

Ob3ect: An object is a running  instance of a class that consumes memory and has a finite lifespan.

Inheritance: Inheritance is the concept of reusing common  attributes and operations from a

base class in a derived class.

EncapsuLation: Encapsulation is the process of hiding the details from the client. PoLymorphism:

The meaning of the word polymorphism is something like one name, many forms. Polymorphism is the

ability to call the same method on multiple objects that have been instantiated from different

subclasses and generate differing behaviour.

Abstraction: Abstraction is the practice of focusing  only on the essential aspects of an object.

It allows you to selectively ignore aspects that you deem unimprtant to the functionality provided

by the object.  A good abstraction only provides as many operations and attributes aas are required

to get the job done.

Interface: It‘s an abstract class with public abstract methods all of which must be implemented inthe inherited classes.

Abstract cLass: A class that cannot be instantiated.  An abstract class is a class that must be

inherited and have the methods overridden. An abstract class is essentially a blueprint for a class

without any implementation. 

When do you absoLuteLy have to decLare a cLass as abstracti

1.        When at least one of the methods in the class is abstract.

2.        When the class itself is inherited from an abstract class, but not all base abstract

methods have been overridden. 

Why can’t you specify the accessibiLity modifier for methods inside the interfacei

They all must be public.  Therefore, to prevent you from getting the false impression that you have

any freedom of choice,

you are not allowed to specify any accessibility, it‘s public by default. 

How is method overriding different from method overLoadingi

When overriding a method, you change the behavior of the method for the derived class. Overloading

a method simply  involves having another method with the same name within the class. 

Can you decLare an override method to be static if the originaL method is non-statici No. The

signature of the virtual method must remain the same, only the keyword virtual is changed to

keyword override. 

Can you override private virtuaL methodsi

No.  Private methods are not accessible outside the class. 

What’s the impLicit name of the parameter that gets passed into the cLass’ set methodi

Value, and it‘s datatype depends on whatever variable we‘re changing. 

How do you inherit from a cLass in C#i

Place a colon and then the name of the base class. Notice that it‘s double colon in C++.

 Does C# support muLtipLe inheritancei

No, use interfaces instead. 

When you inherit a protected cLass-LeveL variabLe, who is it avaiLabLe toi

Classes in the same namespace. 

What’s the top .NET cLass that everything is derived fromi

System.Object. 

What does the keyword virtuaL mean in the method definitioni

The method can be over-ridden. 

Can you decLare the override method static whiLe the originaL method is non-statici

No, you can‘t, the signature of the virtual method must remain the same, only the keyword virtual

is changed to keyword  override.Can you override private virtuaL methodsi

No, moreover, you cannot access private methods in inherited classes, have to be protected in the

base class to allow any sort of access.

Can you prevent your cLass from being inherited and becoming a base cLass for some other cLassesi

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-riddeni

Yes, just leave the class public and make the method sealed. 

Why can’t you specify the accessibiLity modifier for methods inside the interfacei

They all must be public. Therefore, to prevent you from getting the false impression that you have

any freedom of choice, you are not allowed to specify any accessibility, it‘s public by default. 

Types of PoLymorphismi

1) Compiletime Polymorphism, Early Binding (Method overloading)

2) Runtime Polymorphism, Late Binding(Method overriding through inheritance, Method overriding

through the C# interface)

With runtime polymorphism based on method overriding, the decision as to which version of a method

will be executed is based on the actual type of object whose reference is stored in the reference

variable, and not on the type of the reference variable on which the method is invoked. 

Can you inherit muLtipLe interfacesi

Yes, why not. 

And if they have confLicting method namesi

It‘s up to you to implement the method inside your own class, so implementation is left entirely up

to you. This might cause a problem on a higher-level scale if similarly named methods from

different interfaces expect different data, but as far as compiler cares you‘re

okay.

You can implement method like Interface1.GetName(), Interface2.GetName() with full qualified method

name. 

What’s the difference between an interface and abstract cLassi

In the interface all methods must be abstract, in the abstract class some methods can be concrete.

In the interface no accessibility modifiers are allowed, which is ok in abstract classes. 

-Interfaces are closely related to abstract classes that have all members abstract.

- For an abstract class, at least one method of the class must be an abstract method that means it

may have concrete methods.

- For an interface, all the methods must be abstract

- Class that implements an interface much provide concrete implementation of all the methods

definition in an interface or else must be declare an abstract class.

- In C#, multiple inheritance is possible only through implementation of multiple interfaces.

Abstract class can only be derived once.

- An interface defines a contract and can only contains four entities viz methods, properties,

events and indexes. An interface thus cannot contain constants, fields, operators, constructors,

destructors, static constructors, or types.

- Also an interface cannot contain static members of any kind. The modifiers abstract, public,

protected, internal, private, virtual, override is disallowed, as they make no sense in this

context.

- Class members that implement the interface members must be publicly accessible.

How can you overLoad a methodi

Different parameter data types, different number of parameters, different order of parameters. 

If a base cLass has a bunch of overLoaded constructors, and an inherited cLass has another bunch of

overLoaded constructors, can you enforce a caLL from an inherited constructor to an arbitrary base

constructori

Yes, just place a colon, and then keyword base (parameter list to invoke the appropriate

constructor) in the overloaded constructor definition inside the inherited class. 

What’s the difference between System.String and System.StringBuiLder cLassesi System.String is

immutable, System.StringBuilder was designed with the purpose of having a mutable string where a

variety of operations can be performed. 

Does C# support muLtipLe-inheritancei

No, use interfaces instead. 

When you inherit a protected cLass-LeveL variabLe, who is it avaiLabLe toi

Classes in the same namespace. 

Are private cLass-LeveL variabLes inheritedi

Yes, but they are not accessible.  Although they are not visible or accessible via the class

interface, they are inherited. 

Describe the accessibiLity modifier “protected internaL“.

It is available to derived classes and classes within the same Assembly (and naturally from the

base class it‘s declared in). 

What’s the top .NET cLass that everything is derived fromi

System.Object. 

What’s the advantage of using  System.Text.StringBuiLder over System.Stringi

StringBuilder is more efficient in cases where there is a large amount of string manipulation.

Strings are immutable, so each time it‘s being operated on, a new instance is created. 

Can you store muLtipLe data types in System.Arrayi

No. 

What’s a deLegatei

A delegate object encapsulates a reference to a method. 

What’s a muLticast deLegatei

It‘s a delegate that points to and eventually fires off several methods  

Windows Forms

Can you write a cLass without specifying namespacei Which namespace does it beLong to by defauLtii

Yes, you can, then the class belongs to global namespace which has no name. For commercial

products, naturally, you  wouldn‘t want global namespace.

 

You are designing a GUI appLication with a windows  and severaL widgets on it. The user then

resizes the app window  and sees a Lot of grey space, whiLe the widgets stay in pLace. What’s the

probLemi

One shouLd use anchoring for correct resizing. Otherwise the defauLt property of a widget on a form

is top-Left, so it stays at the same Location when resized. 

How can you save the desired properties of Windows  Forms appLicationi

.config fiLes in .NET are supported through the API to aLLow storing and retrieving information.

They are nothing more than simpLe XML fiLes, sort of Like what .ini fiLes were before for Win32apps. 

So how do you retrieve the customized properties of a .NET appLication from XML .config fiLei

InitiaLize an instance of AppSettingsReader cLass. CaLL the GetVaLue method of AppSettingsReader

cLass, passing in the name of the property and the type expected. Assign the resuLt to the

appropriate variabLe. 

Can you automate this processi

In VisuaL Studio yes, use Dynamic Properties for automatic .config creation, storage and retrievaL. 

My progress bar freezes up and diaLog window  shows bLank, when an intensive background process

takes over.

Yes, you shouLdIve muLti-threaded your GUI, with taskbar and main form being one thread, and the

background process being the other.

 

ASP.NET8

Value Type:

Value types are allocated on the stack just like primitive types in VBScript, VB6 and C/C++. Value

types are not instantiated using new go out of scope when the function they are defined within

returns.

Value types in the CLR are defined as types that derive from system.valueType. 

A data type that fully describes a value by specifying the sequence of bits that constitutes the

value‘s representation. Type information for a value type instance is not stored with the instance

at run time, but it is available in metadata. Value type instances can be treated as objects using

boxing. 

What is Boxing and unboxing   ?

Boxing:

The conversion of a value type instance to an object, which implies that the instance will carry

full type information at run time and will be allocated in the heap. The Microsoft intermediate

language (MSIL) instruction set‘s box instruction converts a value type to an object by making a

copy of the value type and embedding it in a newly allocated object. 

Un-Boxing:

The conversion of an object instance to a value type 

What is JIT and how is works ?

An acronym for ”just-in-time,” a phrase that describes an action that is taken only when it becomes

necessary, such as just-in-time compilation or just-in-time object activation 

What is portabLe executabLe (PE) ?

The file format used for executable programs and for files to be linked together to form executable

programs 

What is strong name?

A name that consists of an assembly‘s identityHits simple text name, version number, and culture

information (if provided)Hstrengthened by a public key and a digital signature generated over the

assembly. Because the assembly manifest

contains file hashes for all the files that constitute the assembly implementation, it is

sufficient to generate the digital signature over just the one file in the assembly that contains

the assembly manifest. Assemblies with the same strong name are expected to be identical 

What is gLobaL assembLy cache?

A machine-wide code cache that stores assemblies specifically installed to be shared by many

applications on the computer. Applications deployed in the global assembly cache must have a strong

name. 

What is difference between constants, readonLy and, static ?

Constants: The value can’t be changed

Read-only: The value will be initialized only once from the constructor of the class. Static: Value

can be initialized once. 

What is difference between shared and pubLic?

An assembly that can be referenced by more than one application. An assembly must be explicitly

built to be shared by giving it a cryptographically strong name. 

What is namespace used for Loading assembLies at run time and name the methods?

System.Reflection 

What are the types of authentication in .net?

We have three types of  authentication:

1. Form authentication

2.  Windows authentication

3.  Passport

This has to be declared in web.config file. 

What is the difference between a Struct and a CLass in C# ?

The struct type is suitable for representing lightweight objects such as Point, Rectangle, and

Color. Although it is possible to represent a point as a class, a struct is more efficient in some

scenarios. For example, if you declare an array of 1000 Point objects,

you will allocate additional memory for referencing each object. In this case, the struct is less

expensive.

When you create a struct object using the new operator, it gets created and the appropriate

constructor is called. Unlike classes, structs can be instantiated without using the new operator.

If you do not use new, the fields will remain unassigned and the object cannot be used until all of

the fields are initialized. It is an error to declare a default (parameterless) constructor for a

struct. A default constructor is always provided to initialize the struct members to their default

values.

It is an error to initialize an instance field in a struct.

There is no inheritance for structs as there is for classes. A struct cannot inherit from another

struct or class, and it cannot be the base of a class. Structs, however, inherit from the base

class Object. A struct can implement interfaces, and it does that exactly as classes do.

A struct is a value type, while a class is a reference type.

How big is the datatype int in .NET?

32 bits. 

How big is the char?

16 bits (Unicode). 

How do you initiate a string without escaping each backsLash?

Put an @ sign in front of the double-quoted string.

What’s the access level of the visibility type internal?

Current appLication. 

Explain encapsulation ?

The impLementation is hidden, the interface is exposed. 

What data type should you use if you want an 8-bit value that’s signed?

sbyte.

 Speaking of Boolean data types, what’s different between C# and C/C++?

There‘s no conversion between 0 and faLse, as weLL as any other number and true, Like in

C/C++. 

Where are the value-type variables allocated in the computer RAM?

Stack. 

Where do the reference-type variables go in the RAM?

The references  go on the stack, whiLe the objects themseLves go on the heap. 

What is the difference between the value-type variables and reference-type variables in terms of

garbage collection?

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. 

How do you convert a string into an integer in .NET?

Int32.Parse(string) 

How do you box a primitive data type variable?

Assign it to the object, pass an object. 

Why do you need to box a primitive variable?

To pass it by reference. 

What’s the difference between Java and .NET garbage collectors?

Sun Left the impLementation of a specific garbage coLLector up to the JRE deveLoper, so their

performance varies wideLy, depending on whose JRE you‘re using. Microsoft standardized on their

garbage coLLection. 

How do you enforce garbage collection in .NET?

System.GC.CoLLect(); 

Can you declare a C++ type destructor in C# like >MyClass()?

Yes, but what‘s the point, since it wiLL caLL FinaLize(), and FinaLize() has no guarantees when the

memory wiLL be cLeaned up,  pLus, it introduces additionaL Load on the garbage coLLector. 

What’s different about namespace declaration when comparing that to package declaration in Java?

No semicoLon.