Beruflich Dokumente
Kultur Dokumente
FAQ
1.
2.
3.
4.
1 / 318
5.
Suppose you have an application for credit card validation. What steps will you
6. Write the code snippet for fetching data from a table and populating in a list box control of an asp page.
7.
8. You have a table containing information about empid, empname, emailid, emailname and emailtext. How will you normalize the table?
9. You have a table containing empid, empname, managerid. Write an SQL to display the emp name along with his manager's name.
2 / 318
10.
MS interview.
1.
2. In depth explanation of stack and Heap with respect to .NET and other languages like C++
3 / 318
3. What r the advantages comparatively, Value types are derived from which namespace and reference types as well.
4.
Why u have chosen C#, what r the reasons behind in choosing this in my last project.
5.
How this is more advantageous then other languages as well when ur targeting
6.
7.
8.
Diff b/w ASP and ASP.NET (Only this question came from list)
4 / 318
9.
Explain any 3 ASP.NET features u know in ASP.NET which u have used in project
1.
2.
3.
4. do?
If you have to replicate a set of controls(UI) across a number of web pages, what will you
5 / 318
5.
6. How can you pass values between two pages in asp?how will you do the same in ASP.net?
7.
8.
How will you upload a file to IIS in Asp and how will you do the same in ASP.net?
9.
What is Attribute Programming? What are attributes? Where are they used?
6 / 318
10.
11.
12.
13.
14.
What are the new object introduced in ado.net that are nor there in ADO?
15.
7 / 318
16.
17.
18.
19.
What is Reflection?
8 / 318
20.
21.
22.
23.
24.
9 / 318
25.
26.
27.
28.
29.
30.
10 / 318
31.
What is fillfactor?
32.
Pillars of OO Progg
33.
What is a Constructor?
34.
What is a Destructor?
35.
11 / 318
36.
37.
38.
39.
40.
41.
12 / 318
COM
1.
What is COMInterop?
2.
3.
13 / 318
4.
5.
6.
7.
What is IDispatch?
8.
9.
How will you choose between activex exe and activex dll?
14 / 318
10.
OLE
11.
ActiveX.exe example.
ASP
1.
15 / 318
2.
Modeling languages.
3.
4.
16 / 318
SQL
1.
2.
17 / 318
3.
4.
5.
6.
7.
8.
18 / 318
9.
10.
11.
12.
13.
Types of triggers?
14.
19 / 318
15.
16.
What is fillfactor?
17. You have a table containing information about empid, empname, emailid, emailname and emailtext. How will you normalize the table.
18. You have a table containing empid, empname, managerid. Write an SQL to display the emp name along with his manager's name.
19.
20.
20 / 318
21.
22.
23.
24.
25.
21 / 318
XML
1.
2.
3.
4.
22 / 318
23 / 318
OO Programming
1.
Pillars of OO Progg
2.
What is a Constructor?
3.
What is a Destructor?
4.
5.
What is Polymorphism?
6.
Say you have identified a set of objects how will identify a base class?
7.
8.
24 / 318
9.
Modeling languages.
ASP
1.
2.
3.
4.
5.
6. Suppose you have an application for credit card validation. What steps will you take to restrict unauthorized users from using the application.
7. Write the code snippet for fetching data from a table and populating in a list box control of an asp page.
25 / 318
8.
9. Say you are designing a product page the products list is constant? How will you design this page? (will you go to db each time to retrieve the list of products for each user?)
10.
11.
12.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnserv/html/server03272000.asp
26 / 318
VB & COM
1.
2.
What are the various ways in which you instantiate an object in VB?
3. What are the threading models that you can choose in VB? Which one will you recommend and why?
4.
Can you store a VB object in ASP session variable? Is it recommended? Why not?
5.
6.
7.
8.
27 / 318
9.
10.
11.
How will you choose between activex exe and activex dll?
12.
ActiveX.exe example.
13.
What is COMInterop?
14.
15.
16.
17.
18.
19.
What is IDispatch?
28 / 318
.NET
1.
2.
3.
29 / 318
4.
5.
6.
7.
8.
Question on Reflection?
9.
What is Attribute Programming? What are attributes? Where are they used?
10.
11.
12. How can you pass values between two pages in asp?how will you do the same in ASP.net?
13.
14.
15.
30 / 318
16. do?
If you have to replicate a set of controls(UI) across a number of web pages, what will you
17.
18.
19.
How will you upload a file to IIS in Asp and how will you do the same in ASP.net?
20.
21.
22.
23.
24.
What are the new object introduced in ado.net that are nor there in ADO?
25.
26. What is the difference between new and override keywords in c# in the context of inheritance?
31 / 318
27.
28.
Security in ASP.NET
1.
2.
3. If you have only 2 weeks for release and you know that the project cannot be completed in 2 weeks what would you do?(answer is to prioritize tasks)
4.
You have a weak member in the team what will you do?
5.
You have a problematic member in the team what will you do?
6.
Traceability matrix?
32 / 318
7.
1.
2.
What is Namespace?
3.
What is class?
4.
What is Component?
5.
What is Control?
6.
7.
8.
9.
10.
33 / 318
11.
12.
13.
14.
15.
What is Interface?
16.
17.
18.
Class A
Int I =10;
Void new()
34 / 318
I = 20 ;
19. Class B inherited from Class A. Class B is used in Class C. I created an object for class C. Tell me the order of Constructors invoked?
20.
21.
22.
23.
24.
35 / 318
25.
26.
27.
I can write the same page in VB/ASP also. Whats the difference?
28.
29.
30.
What is COM?
31.
32.
33.
34.
35.
36 / 318
36.
37.
38.
39.
40.
41.
Can you tell me the case where four tier (Multi tier) architecture is present?
42.
43.
44.
45.
46.
Dim RS as Recordset.
47.
37 / 318
48.
Dim Rs as Recordset
49.
Dim RS as Recordset
50.
51.
52.
53.
How can u write a java script for a server control at client side?
54.
What is the difference between server side HTML controls and ASP Server Controls.
55.
Tell me the ASPX page request cycle. How HTML output comes to the client?
56.
38 / 318
57.
58.
59.
60.
61.
What is Reflection?
62.
What is Remoting?
63.
64.
65.
66.
67.
68.
39 / 318
69.
70.
71. Why SQLClient and OLEDB classes are given in Data namespace? Which one is optimistic?
72.
73.
74.
Does GC collects Value Types? If not, what happen to them after scope is over?
75. When GC moves memory addresses while collecting unused objects, what happen to the addresses of unmanaged objects and their addresses?
76.
77. My database server and Application server are different. When I connect to database server from Application, I use connection string. So, it passes through network I think definining like server=xx;databse=pubs;uid=pqr;pwd=abc is insecure. Is there any methodology to make safe while pass through network.
78.
40 / 318
79.
80.
Is there any relation to the Linked server with the Distributed database?
81.
82.
What is Lock?
83.
What is Trace?
84.
85.
86.
Explain joins
87.
88.
89.
90.
What is a trigger?
41 / 318
91.
92.
93.
What is cursor?
94.
95.
96. In a stored proc, string variable is consisting SQL statement. How do you run it? Is there any other alternative to run it?
97.
98.
99. My table doesnt have key. So many duplicate rows exists in the table. I want to eliminate all the duplicate rows and keep only one unique row. Can u accomplish this task in a single query? If not, how do you do it?
100.
101.
What are the must present databases to work with SQL server?
42 / 318
102.
What is UNICODE?
103.
104.
105.
106.
107.
108.
109.
If error comes in the middle of stored proc, does remaining part execute?
110.
111. My SP has three DML statements in an order. Insert, Delete and Update. I am not maintaining transaction. Some how I got error while running a Delete statement. Does Update statement execute? Does earlier(Insert) statement committed?
112.
How do you write code for the above case using transactions?
43 / 318
113.
114. What do you observe in Execution Plan to know the performance of the query/statement?
115.
116.
117.
118.
119.
120.
44 / 318
Question on ASP.NET
45 / 318
Programmable Controls
ASP .NET contains a large set of HTML controls. Almost all HTML elements on a page can be defined as ASP .NET control objects that can be controlled by scripts.
ASP .NET also contains a new set of object oriented input controls, like programmable list boxes, validation controls.
A new data grid control supports sorting, data paging, and everything you expect from a dataset control.
46 / 318
All ASP .NET objects on a Web page can expose events that can be processed by ASP .NET code.
Load, Click and Change events handled by code makes coding much simpler and much better organized.
ASP .NET components are heavily based on XML. Like the new AD Rotator, that uses XML to store advertisement information and configuration.
47 / 318
ASP .NET supports forms-based user authentication, including cookie management and automatic redirecting of unauthorized logins.
(You can still do your custom login page and custom user checking).
ASP .NET allows for user accounts and roles, to give each user (with a given role) access to different server code and executables.
Higher Scalability
48 / 318
Much has been done with ASP .NET to provide greater scalability.
Server to server communication has been greatly enhanced, making it possible to scale an application over several servers. One example of this is the ability to run XML parsers, XSL transformations and even resource hungry session objects on other servers.
The first request for an ASP .NET page on the server will compile the ASP .NET code and keep a cached copy in memory. The result of this is greatly increased performance.
49 / 318
Configuration files can be uploaded or changed while the application is running. No need to restart the server. No more metabase or registry puzzle.
Xcopy deployment. No more server restart to deploy or replace compiled code. ASP .NET simply redirects all new requests to the new code.
50 / 318
2. How will you upload a file to IIS in Asp and how will you do the same in ASP.net?
In asp we had to read binary data posted by the form and parse the headers etc.
In asp.net we can use the same html input file (html control but run at server) and can save the file by simply calling controlname.postedFile.saveAs(filename)
51 / 318
HTML server controls HTML elements exposed to the server so you can program them. HTML server controls expose an object model that maps very closely to the HTML elements that they render.
Web server controls Controls with more built-in features than HTML server controls. Web server controls include not only form-type controls such as buttons and text boxes, but also special-purpose controls such as a calendar. Web server controls are more abstract than HTML server controls in that their object model does not necessarily reflect HTML syntax.
Validation controls Controls that incorporate logic to allow you to test a user's input. You attach a validation control to an input control to test what the user enters for that input control. Validation controls are provided to allow you to check for a required field, to test against a
52 / 318
specific value or pattern of characters, to verify that a value lies within a range, and so on.
User controls Controls that you create as Web Forms pages. You can embed Web Forms user controls in other Web Forms pages, which is an easy way to create menus, toolbars, and other reusable elements.
RequiredFieldValidator
53 / 318
Ensures that the user does not skip a required field when entering data on a Web Forms page
CompareValidator
Compares a user's entry against a constant value, against the property value of another control, or against a database value
RangeValidator
Ensures that a user's entry is between specified upper and lower bounds
RegularExpressionValidator
54 / 318
Ensures check that a user's entry matches a pattern defined by a regular expression.
CustomValidator
Ensures that a user's entry matches validation logic you create yourself.
5. If you have to replicate a set of controls(UI) across a number of web pages, what will you do?
55 / 318
This directive is used explicitly to import namespace onto the page. This will allow all the classes and interfaces of the namespace to be accessible within the code.
We can use the classes and interface in the code without importing namespaces also but we need to prefix complete namespace to the class that we are going to use.
For example
56 / 318
<%
%>
<%
%>
57 / 318
Each computer where the common language runtime is installed has a machine-wide code cache called the global assembly cache. The global assembly cache stores assemblies specifically designated to be shared by several applications on the computer.
You should share assemblies by installing them into the global assembly cache only when you need to.
There are several ways to deploy an assembly into the global assembly cache:
Use an installer designed to work with the global assembly cache. This is the preferred option for installing assemblies into the global assembly cache.
Use a developer tool called the Global Assembly Cache tool (Gacutil.exe) provided by the .NET Framework SDK.
Use Windows Explorer to drag and drop assemblies into the cache.
58 / 318
Needs to discuss
Using querystrings
59 / 318
Response.redirect(url?name=abc)
60 / 318
Session(name) = abc
Using Server.Transfer
61 / 318
We create read only property (that returns the value which u want to access across pages) in the source file
Get
Return first.text
End Get
End Property
Server.Transfer("secondpage.aspx")
62 / 318
On the Web Forms page that receives the information, add an @ Reference directive at the top of the page, with the Page attribute set to the source Web Forms page (the Web Forms page that contains the information you want to pass).
Declare a variable in server-side script to store an instance of the class defined in the Web Forms page sending the information.
[Visual Basic]
<script runat="server">
63 / 318
Dim fp As FirstPageClass
</script>
Assigns the IHttpHandler implemented object for the current HTTP request to the variable declared in the previous step when the Web Forms page does not post back to itself.
The IHttpHandler implemented object contains an instance of the handler that first received the HTTP request. Because the IHttpHandler implemented object is not the same type of object as the variable declared in the previous step, it must be converted to the class encapsulating the information sent from the first Web Forms page before it can be assigned to the variable. Retrieve the handler object by using the Handler property of the HttpContext object.
[Visual Basic]
64 / 318
<script runat="server">
Sub Page_Load()
fp = CType(Context.Handler, FirstPageClass)
End If
End Sub
</script>
The variable declared in the second step now contains an instance of the class encapsulating the information from the previous Web Forms page.
<%=fp.FirstName%>
65 / 318
Question on ADO.NET
Two key elements are .net data provider (set of components) and dataset.
Objects in ADO.Net
66 / 318
DataReader : For reading a forward-only stream of data records from a data source.
DataSet : For storing, remoting and programming against flat data, XML data and relational data.
DataAdapter: For pushing data into a DataSet, and reconciling data against a database.
67 / 318
ADO
ADO.NET
68 / 318
Number of Tables
A recordset looks like a single table. If a recordset is to contain data from multiple database tables, it must use a JOIN query, which assembles the data from the various database tables into a single result table.
A dataset is a collection of one or more tables. The tables within a dataset are called data tables; specifically, they are DataTable objects. If a dataset contains data from multiple database tables, it will typically contain multiple DataTable objects. That is, each DataTable object typically corresponds to a single database table or view. In this way, a dataset can mimic the structure of the underlying database. A dataset usually also contains relationships. Because the dataset can hold multiple, separate tables and maintain information about relationships between them, it can hold much richer data structures than a recordset, including self-relating tables and tables with many-to-many relationships.
Data Navigation
In ADO you scan sequentially through the rows of the recordset using the ADO MoveNext method In ADO.NET, rows are represented as collections, so you can loop through a table as you would through any collection, or access particular rows via ordinal or primary key index. DataRelation objects maintain information about master and detail records and provide a
69 / 318
method that allows you to get records related to the one you are working with.
In ADO the recordset can provide disconnected access, but ADO is designed primarily for connected access.
In ADO.NET you open connections only long enough to perform a database operation, such as a Select or Update. You can read rows into a dataset and then work with them without staying connected to the data source.
To transmit an ADO disconnected recordset from one component to another, you use COM marshalling.
70 / 318
Transmitting an ADO.NET dataset between applications is much easier than transmitting an ADO disconnected recordset.
To transmit data in ADO.NET, you use a dataset, which can transmit an XML stream.
The transmission of XML files offers the following advantages over COM marshalling
COM marshalling provides a limited set of data types those defined by the COM standard. Because the transmission of datasets in ADO.NET is based on an XML format, there is no restriction on data types. Thus, the components sharing the dataset can use whatever rich set
71 / 318
Performance
Transmitting a large ADO recordset or a large ADO.NET dataset can consume network resources; as the amount of data grows, the stress placed on the network also rises. Both ADO and ADO.NET let you minimize which data is transmitted. But ADO.NET offers another performance advantage, in that ADO.NET does not require data-type conversions. ADO, which requires COM marshalling to transmit records sets among components, does require that ADO data types be converted to COM data types.
72 / 318
Penetrating Firewalls
A firewall can interfere with two components trying to transmit disconnected ADO recordsets. Remember, firewalls are typically configured to allow HTML text to pass, but to prevent system-level requests (such as COM marshalling) from passing.
Because components exchange ADO.NET datasets using XML, firewalls can allow datasets to pass.
73 / 318
In asp.net
<%
cn.open
%>
In ASP
74 / 318
<%
dim cnString
dim cn
set cn = server.createobject(adodb.connection)
cn.open cnString
75 / 318
%>
4. What are the new object introduced in ado.net that are nor there in ADO
76 / 318
Datareader need all the time to be connected to the datasource but dataset is disconnected one.
77 / 318
Dataset, Datatable
78 / 318
Database Transactions
79 / 318
Cn.open()
objTran = cn.BeginTransaction
objCommand.Transaction = objTran
finally you can call the following statements according to your conditions
80 / 318
objTran.Commit()
or
objTran.Rollback()
81 / 318
8. Which class you have commonly used from the System.Data namespace
82 / 318
Basic concepts
Authentication is a process of discovering the individual identity of users, and making them prove that they are who they say they are.
Authorization is the process of determining if a particular user is entitled to access the resource they have requested.
Impersonation is the process whereby the resource is accessed under a different identity usually the context of a remote user.
Data or functional security is the process of securing the system through physical means, OS
83 / 318
Windows 2000 maintains a list of users that are allowed to access resource on a machine. This is either stored on the machine itself, or on a domain controller elsewhere. The list is managed through computer management tool or active directory users and computers tool on a domain controller.
Authentication in IIS
84 / 318
Here we can allow/deny access to the web application for a particular IP address or domain.
Anonymous Access : Any user can access the application unless his IP address or domain is unrestricted. This uses IUSR_MachineName account to access the resource.
Basic Authentication : If anonymous access is disabled, users will be presented with logon dialog. Username and password are Base 64 encoded and passed to IIS that checks with the accounts in windows, and will only allow the user to access the resource if the account is valid and has appropriate permission for that resource. Base64 encoding is not very secure.
Digest Authentication : If anonymous access is disabled, users will be presented with logon dialog. The browser combines this with other information stored on the client and send an encoded hash to the server. The server already has a copy of information, and so can get original details from its own hash. This only works with IE an d.NET webservices. Finally IIS checks with the accounts in windows, and will only allow the user to access the resource if the account is valid and has appropriate permission for that resource. This works fine in
85 / 318
proxy/firewalls.
Integrated Windows Authentication : This also know as NTLM authentication or challenge Response authentication. This is the same method used when you log onto your local network. This also uses hash algorithm to code and decode the client credentials. This does not work with most proxy/ firewalls. This is also very secure way. Finally IIS checks with the accounts in windows, and will only allow the user to access the resource if the account is valid and has appropriate permission for that resource.
Access control list(ACL) defines which user has got what rights (Full control, read , write). Right
86 / 318
Authorization in IIS
You can set Script Source Access, Log Visits, Read, Index this resource, Write, directory browsing.
This applies to all the users who have access to this application.
ASP.net impersonation
87 / 318
Windows
Passport
Forms
88 / 318
<configuaration>
<system.web>
<credentials passwordFormat=clear>
</credentials>
</forms>
</authentication>
</system.web>
</configuaration>
89 / 318
In the forms based authentication, we can use credentials or use xml file that has username/password or database in order to authenticate.
Windows based
<configuaration>
<system.web>
<authorization>
90 / 318
</authorization>
</system.web>
</configuaration>
ASP.NET
91 / 318
1.
When an object is allocated from the managed heap, the new operator returns the memory address of the object. You usually store this address in a variable. This is called a reference type variable because the variable does not actually contain the object's bits; instead, the variable refers to the object's bits
There are some performance issues to consider when working with reference types. First, the memory must be allocated from the managed heap, which could force a garbage collection to occur. Second, reference types are always accessed via their pointers. So every time your code references any member of an object on the heap, code must be generated and executed to dereference the pointer in order to perform the desired action. This adversely affects both size and speed.
Error! Unknown switch argument.In addition to reference types, the virtual object system supports lightweight types called value types. Value type objects cannot be allocated on the garbage-collected heap, and the variable representing the object does not contain a pointer to an object; the variable contains the object itself. Since the variable contains the object, a pointer
92 / 318
does not have to be dereferenced in order to manipulate the object. This, of course, improves performance
The main advantage of value types is that they are not allocated in the managed heap. Of course, value types have several limitations compared with reference types. Here are some of the ways in which value types and reference types differ.
Error! Unknown switch argument.Value type objects have two representations: an unboxed form and a boxed form. Reference types are always in a boxed form.
Boxing is an implicit conversion of a value type to the type object or to any interface type implemented by this value type. Boxing a value of a value allocates an object instance and copies the value into the new object.
Unboxing is an explicit conversion from the type object to a value type or from an interface type to a value type that implements the interface. An unboxing operation consists of:
93 / 318
Checking the object instance to make sure it is a boxed value of the given value type.
Copying the value from the instance into the value-type variable.
2.
Dataset ? The ADO.NET DataSet is the core component of the disconnected architecture of ADO.NET. The DataSet is explicitly designed for data access independent of any data source. As a result it can be used with multiple and differing data sources, used with XML data, or used to manage data local to the application. The DataSet contains a collection of one or more DataTable objects made up of rows and columns of data, as well as primary key, foreign key, constraint, and relation information about the data in the DataTable objects
94 / 318
DataTableCollection
DataTable
DataRowCollection
DataColumnCollection
ConstraintCollection
DataRelationCollection
95 / 318
Command: Executes a command against a data source. Exposes Parameters and can execute within the scope of a Transaction from a Connection.
DataAdapter: Populates a DataSet and resolves updates with the data source.
i. ADO .NET does not replace ADO rather it provides .Net programmer with access to relational data sources, XML and Appln data.
ii. ADO .NET similar to ADO + several new concepts in design + better interoperability and scalable data access
iii.
96 / 318
iv.
Improved support for disconnected model (ADO had the same using cursor location)
v.
vi. ADO u have a single obj that behaves in many diff ways viz recordset (keeps object model simple)
vii. vii. ADO .NET has object viz; DataReader (forward only readonly), DataSet (in memory relational representation of data), DataAdapter (bridge betw data source and dataset)
viii.
ADO .NET has command obj that supports ExecuteNonQuery () and ExecuteScalar
ix.
x. In ADO communication to b happens thro OLE DB provider, where as in ADO .NET the communication happens thro DataAdapter which in turn makes calls to OLE DB providers or APIs provided
xi. Using ADO .NET it is possible to transmit data betwn applns where as in ADO u need to use disconnected recordsets to pass recordsets betwn components and u need to use COM marshalling (and requires the data types to be converted to COM data types when marshalling)
xii. Firewalls prevent transmit of data between components using COM Marshalling where as in ADO .NET firewalls does not create a problem as the data is passed in XML format.
xiii.
97 / 318
Web Services are programmable business logic components that serve as black boxes to provide access to functionality via internet using standard protocols such as HTTP. Web services are based upon an application of XML called SOAP
SOAP stands for Simple Object Access Protocol. It is a communication protocol for sending information between application over internet via HTTP.
98 / 318
It is as xml based language for describing web services & how to access the web service. It specifies the location of the service and the operations (or methods) the service exposes.
Universal Description, Discovery and Integration (UDDI) is a directory service where businesses can register and search for Web services. It is a directory for storing web services and communicated via SOAP.
3.
State management is the persistence of object or values through out the life of a web application or for the duration of a users interface within the application.
User State(Session)? User State is controlled through the session object. Session Allows us to maintain data for a limited duration of time, for a particular user and isolate that data from the other users.
99 / 318
Application State ? Application state is controlled through the application object. Application allows us to maintain data for a given ASP.NET application. Setting should be done to access the data for all the resources like web services, ASP.NET page and so on.
Transient Application State(cache)? Transient Application State is maintained by the cache object. Cache is similar to the application, it is accessible for our entire application but has extra functionality like in the form of dependencies, callbacks and expiration
Static Variables ?Only one copy of the variable is created no matter how many instances of the classes are created and these are available through out the application in more efficient way than the Application.
100 / 318
4.
5. How can you pass values between two pages in asp? How will you do the same in ASP.net?
In ASP values can be passed between two pages using request object.
101 / 318
Web form page whose information needs to be send to the second page
1.
specify ClassName attribute with the class name in the @page directive.
2. Next, create a property with a get accessor, in the class for each value that to be shared. This get accessor returns the value that need to passed
3. Then transfer the control of the web application to other web form page using transfer method of the server object.
1.
Add @reference directive at the top of the page instead of @page attribute.
102 / 318
2.
Create an instance of the class defined in the web form page sending the information.
3. Can access the information by creating the instance of the handler that first received the HTTP request from the handler property of the Context object which in turn is converted in to an instance of the class which contains the passed information. After conversion the passed values can be accessed through the properties of the converted object.
When using code-behind files, the code-behind file contains a class declaration for the code associated with the Web Forms page. In the code-behind file for the Web Forms page sending the information, first create a property with a get accessor, in the class, for each value you want to share. The get accessor should return the value you want to pass, such as the value of a text box. To send the information, transfer control of the application to a different Web Forms page by using the Transfer method of the Server object.
On the receiving Web Forms page, reference the class declared in the sending page by adding an @Reference directive, at the top of the page, with the Page attribute set to the sending page. You can then retrieve an instance of the handler that first received the HTTP request from the Handler property of the Context object.
103 / 318
6.
a.
b. In ASP is a mixture of code & content but in asp.net code can be separated from the content using codebehind concept.
c. ASP supports scripting language like vbscript/jscript but ASP.NET supports multiple languages.
d.
e. Asp is browser compatibility not a device compatability whereas in ASP.net can be compatability to any device/browser
f. Apart from this ASP.NET has many features like Multiple languages, server processing, enhanced controls, configuration, Deployment.
7.
104 / 318
8.
9. do?
If you have to replicate a set of controls(UI) across a number of web pages, what will you
10.
HTMLServerControls
Web Controls
List controls
105 / 318
Rich Controls
Validation Controls
Custom Controls
Mobile Controls
11.
Validation server controls are the collection of controls that validates the user input server control and display a custom message when validation fails .These controls are available at system.web.UI.WebControls
i.
106 / 318
ii.
iii. CompareValidator Checks if the value is acceptable compared to a given value or compared to the content of another control.
iv.
v.
vi.
12.
How will you upload a file to IIS in Asp and how will you do the same in ASP.net?
In ASP.NET usinfg server side file input control and filecontrol.PostedFile object
107 / 318
13.
Connection
Command
DataReader
DataAdapter
14.
108 / 318
15.
In ADO.NET you open connections only long enough to perform a database operation, such as a Select or Update. You can read rows into a dataset and then work with them without staying connected to the data source. In ADO the recordset can provide disconnected access, but ADO is designed primarily for connected access.
There is one significant difference between disconnected processing in ADO and ADO.NET. In ADO you communicate with the database by making calls to an OLE DB provider. In ADO.NET you communicate with the database through a data adapter (an OleDbDataAdapter, SqlDataAdapter, OdbcDataAdapter, or OracleDataAdapter object), which makes calls to an OLE DB provider or the APIs provided by the underlying data source. The important difference is that in ADO.NET the data adapter allows you to control how the changes to the dataset are transmitted to the database by optimizing for performance, performing data validation checks, or adding any other extra processing.
16.
A recordset looks like a single table. If a recordset is to contain data from multiple database tables, it must use a JOIN query, which assembles the data from the various database tables into a single result table.
In contrast, a dataset is a collection of one or more tables. The tables within a dataset are called data tables; specifically, they are DataTable objects. If a dataset contains data from multiple database tables, it will typically contain multiple DataTable objects. That is, each DataTable object typically corresponds to a single database table or view. In this way, a dataset can mimic the structure of the underlying database.
109 / 318
A dataset usually also contains relationships. A relationship within a dataset is analogous to a foreign-key relationship in a database that is, it associates rows of the tables with each other. For example, if a dataset contains a table about investors and another table about each investor's stock purchases, it could also contain a relationship connecting each row of the investor table with the corresponding rows of the purchase table.
17.
What are the new object introduced in ADO.NET that are not there in ADO?
18.
Security in ASP.NET
110 / 318
ANS: The import directive specifies another IDL, ODL, or header file containing definitions you wish to reference from your main IDL file.
20. Which class you have commonly used from the System.Data namespace.
22. When should we consider the Session states and application states. where do we declare them?
111 / 318
.asmx
112 / 318
UDDI is a platform-independent framework for describing services, discovering businesses, and integrating business services by using the Internet.
113 / 318
.NET
11.
12.
13.
14. What r the advantages comparatively, Value types are derived from which namespace and reference types as well.
15.
114 / 318
16.
How many types of access modifiers r there in vb.net and explain internal
17.
What is Attribute Programming? What are attributes? Where are they used?
18.
What is Reflection?
19.
What is a Constructor?
20.
What is a Destructor?
21.
22.
23.
What is Polymorphism?
24.
Say you have identified a set of objects how will identify a base class?
25.
26. What is the difference between new and override keywords in c# in the context of inheritance?
27.
115 / 318
a.
No.
ADO.NET
1.
a.
116 / 318
2.
3.
4.
5.
6.
7.
What are the new object introduced in ADO.NET that are nor there in ADO?
The stack is an orderly first-in last-out memory structure, and is used for storing value-type objects.
Objects that own resources other than memory (in particular handles, such as Windows handles, file handles and SQL handles) need to be told explicitly to release those resources when the object is no longer required. This includes all Windows controls, since they all own Windows handles! You might ask, why not put the code to release those resources in the objects destructor? There are two reasons for this:
117 / 318
The automatic garbage collector, which is responsible for initiating the destructor (by identifying and deleting dead objects) is concerned with memory issues and not resource issues. Hence if running on a PC with a few gigabytes of free RAM, it may wait an hour or two before even getting out of bed!
There is no guarantee that the destructor will ever get called, even once memory is released.
The last point is very important due to the complexities of automatic garbage collection, you cant rely on destructors, and this is an inherent limitation in the CLR.
While destructors do not work properly, memory management does. You can be sure that the memory belonging to an orphaned object will always be released, even though its destructor may never be called.
The other effect of adding it to the Controls collection is that the .NET framework will deterministically call a method called Dispose on all of its members the instant theyre no longer needed. And in this Dispose method, the control can release its Windows handle, as well as dropping the textbox off the screen.
118 / 318
All classes descending from MarshalByRefComponent (including all Windows Forms controls) have a Dispose method. This method must be called when an object is no longer needed in order to release resources other than memory. There are two ways this happens:
- automatically: by adding the object to a .NET container, such as a Form, Panel, TabPage or UserControl. The container will ensure that when its Disposed, so are all of its members. Of course, the container itself must be Disposed (or in turn, be part of another container).
In the case of Windows Forms controls, we nearly always add them to a container and hence rely on automatic disposal.
Class objects have an extra storage and execution overhead in that they require a pointer, which must be de-referenced at runtime. This overhead, while quite small, is not desirable with a type so fundamental as Size or Point
119 / 318
1.
DataReader
DataSet
DataAdapter
120 / 318
ADO .NET does not replace ADO rather it provides .Net programmer with access to relational data sources, XML and Appln data.
ADO .NET similar to ADO + several new concepts in design + better interoperability and scalable data access
Improved support for disconnected model (ADO had the same using cursor location)
ADO u have a single obj that behaves in many diff ways viz recordset (keeps object model simple)
ADO .NET has object viz; DataReader (forward only readonly), DataSet (in memory relational representation of data), DataAdapter (bridge betw data source and dataset)
121 / 318
In ADO communication to b happens thro OLE DB provider, where as in ADO .NET the communication happens thro DataAdapter which in turn makes calls to OLE DB providers or APIs provided
Using ADO .NET it is possible to transmit data betwn applns where as in ADO u need to use disconnected recordsets to pass recordsets betwn components and u need to use COM marshalling (and requires the data types to be converted to COM data types when marshalling)
Firewalls prevent transmit of data between components using COM Marshalling where as in ADO .NET firewalls does not create a problem as the data is passed in XML format.
122 / 318
A delegate is a class that can hold reference to a method. It has a signature (unlike class). It can hold reference only to method that matches its signature. Therefore delegate is a type safe function pointer.
event
By default it wud need two parameters, viz; source that raised the event + data for the
Event delegates are multicast; i.e they can hold reference to more than one event handling methods
123 / 318
5. Suppose you have an application for credit card validation. What steps will you take to restrict unauthiorised users from using the application.
6. Write the code snippet for fetching data from a table and populating in a list box control of an asp page.
8. You have a table containing information about empid, empname, emailid, emailname and emailtext. How will you normalize the table.
9. You have a table containing empid, empname, managerid. Write an SQL to display the emp name along with his manager's name.
124 / 318
1.
Value types single space allocated where as reference type two space allocated (one for the object and the other for the reference of the object)
Value type directly deals with underlying data where as ref type is a pointer to the actual object
When copy a reference type both point to the same obj where as in case of value type we get two independent var
When passing a value by ref to a function the local obj (of a function) even if set to null does not effect the actual obj.. but the changes made to the obj properties remain .. as both the variables point to the same obj. one is a copy of the other
If we use the key word ref while passing the variable (objs/structs).. then assigning a null to the local var of func makes nullifies original obj .. as this time we deal with the original reference var and not a copy
In case of obj.. actual pbject is always placed on heap.. whereas the obj ref cud be placed on heap or stack depending on whether its a part of heap obj or local variable
125 / 318
Mem allocated for value type freed when out of scope where as for ref type they r freed when they are no longer being referenced
Mem allocation of stack is faster than that of heap (ideal for small objs)
Incase of large objs avoid value type allocation as an assignment of it to another variable will create a copy the entire obj consuming additional mem
Boxing is converting value type to reference type and unboxing is converting reference type to value type
It is interesting to note that the runtime type of box is returned as the boxed value type;
int i = 123;
126 / 318
Boxing allocates memory for the value being boxed on heap, copies the value into this memory and stores its reference in an object type. Consider the following code.
int i = 12 ;
The WriteLine( ) method is written to accept objects. When we pass a variable of value type, int in this case, it gets boxed into an object. Using this object a method ToString( ) is called, which returns the string equivalent of the value stored in a variable. WriteLine( ) then displays this string.
The primitive data types in C# are mapped to underlying structures defined by the .NET base class library. This is done to ensure that code written in C# can be used in other .NET compliant languages.
Implicit type conversion is allowed so long as there is no loss of data. If we want to convert a data type into another for which implicit conversion is not possible, we can do so by type casting.
127 / 318
Reference types actually hold the value of a memory address occupied by the object they reference. Consider the following piece of code, in which two variables are given a reference to the same object (for the sake of the example, this object is taken to contain the numeric property 'myValue').
x.myValue = 10;
object y = x;
y.myValue = 20; // after this statement both x.myValue and y.myValue equal 20
This code illustrates how changing a property of an object using a particular reference to it is reflected in all other references to it. Note, however, that although strings are reference types, they work rather more like value types. When one string is set to the value of another, eg
string s1 = "hello";
string s2 = s1;
Then s2 does at this point reference the same string object as s1. However, when the value of s1 is changed, for instance with
128 / 318
s1 = "goodbye";
what happens is that a new string object is created for s1 to point to. Hence, following this piece of code, s1 equals "goodbye", whereas s2 still equals "hello".
The reason for this behaviour is that string objects are 'immutable'. That is, the properties of these objects can't themselves change. So in order to change what a string variable references, a new string object must be created.
You can find out whether an Object variable is acting as a reference type or a value type by passing it to the IsReference method on the Information class in the Microsoft.VisualBasic namespace. Microsoft.VisualBasic.Information.IsReference returns True if the content of the Object variable represents a reference type.
2. In depth explanation of stack and Heap with respect to .NET and other languages like C++
129 / 318
3. What r the advantages comparatively, Value types are derived from which namespace and reference types as well.
4.
Why u have chosen C#, what r the reasons behind in choosing this in my last project.
VB .Net has project level setting to check for integer over flow (can be turned on or off)
C# can run in checked or unchecked context.. in checked arithmetic overflow raises exception else the data gets truncated.
C# allows use of XML Documentation (can be translated to HTML using XSLT/ create web site using comments/ convert to CHM)
5.
How this is more advantageous then other languages as well when ur targeting
6.
130 / 318
7.
8.
Diff b/w ASP and ASP.NET (Only this question came from list)
9.
Explain any 3 ASP.NET features u know in ASP.NET which u have used in project
1.
2.
3.
4. do?
If you have to replicate a set of controls(UI) across a number of web pages, what will you
5.
6. how can you pass values between two pages in asp?how will you do the same in ASP.net?
131 / 318
7.
8.
how will you upload a file to IIS in Asp and how will you do the same in ASP.net?
9.
What is Attribute Programming? What are attributes? Where are they used?
1.
2.
3.
4.
5.
14.what are the new object introduced in ado.net that are nor there in ADO?
6.
7.
132 / 318
8.
9.
10.
11.
20.question on Reflection?
12.
13.
14.
15.
24.If a database is in 3NF, how many minimum number of tables should it have?
16.
17.
133 / 318
18.
19.
20.
21.
22.
23.
32.what is fillfactor?
24.
33.Pillars of OO Progg
25.
34.What is a Constructor?
26.
35.What is a Destructor?
27.
28.
134 / 318
29.
30.
31.
32.
33.
34.
43.what is COMInterop?
35.
36.
37.
135 / 318
38.
IUnknown
39.
Add ref (whenever an object is instantiated the counter for the obj gets increased by 1)
Release
The IUnknown interface lets clients get pointers to other interfaces on a given object through the QueryInterface method, and manage the existence of the object through the IUnknown::AddRef and IUnknown::Release methods. All other COM interfaces are inherited, directly or indirectly, from IUnknown. Therefore, the three methods in IUnknown are the first entries in the VTable for every interface.
136 / 318
QueryInterface
AddRef
Release
40.
49.What is IDispatch?
Interface that exposes objects, methods and properties to programming tools and applications that support automation
137 / 318
IDispatch Methods
Description
GetTypeInfoCount
Retrieves the number of type information interfaces that an object provides (either 0 or 1).
GetTypeInfo
GetIDsOfNames
Maps a single member and an optional set of argument names to a corresponding set of integer DISPIDs.
Invoke
Located on oleauto.h header file for 32 bit system and Dispatch.h on 16- bit and Machintosh system.
138 / 318
41.
42.
51.how will you choose between activex exe and activex dll?
43.
52.OLE
44.
53.ActiveX.exe example.
45.
46.
55.Modeling languages.
47.
48.
49.
50.
139 / 318
51.
52.
53.
threading in .net.
54.
55.
There are two ways to use Automation (or OLE Automation) to programmatically control another application.
Late binding uses CreateObject to create and instance of the application object, which you can then control. For example, to create a new instance of Excel using late binding:
140 / 318
On the other hand, to manipulate an existing instance of Excel (if Excel is already open) you would use GetObject (regardless whether you're using early or late binding):
To use early binding, you first need to set a reference in your project to the application you want to manipulate. In the VB Editor of any Office application, or in VB itself, you do this by selecting Tools + References, and selecting the application you want from the list (e.g. Microsoft Excel 8.0 Object Library).
141 / 318
In either case, incidentally, you can first try to get an existing instance of Excel, and if that returns an error, you can create a new instance in your error handler.
1. Your code will run considerably faster, because it can all be compiled up front. With late binding, the code relating to an application you declared as an object has to, in effect, be compiled as it runs.
2. Because your code can all be compiled up front, debugging is far easier select Debug + Compile, and the compiler will be able to spot syntax errors which would have been missed had you used late binding.
142 / 318
3. You have full access in your project to intellisense (type a keyword and a dot to get a popup list of properties and methods supported by that keyword, select one to insert it; pe a keyword and press F1 to launch the Help topic on that keyword).
ty
4. You have full access to the application's object model via the Object Browser and VBA Help.
5. You have access to the application's built-in constants. For instance, if you are automating Word from Excel, you can use:
With objWord
143 / 318
.Visible = True
.Activate
.WindowState = wdWindowStateMaximize
.Documents.Open ("c:temptemp.doc")
End With
.WindowState =
you'll get a pop-up list of the supported constants, and can simply pick wdWindowStateMaximize from the list.
.WindowState = 1
.. and you would need to know (by looking it up in Word's Object Browser) that the value of the constant wdWindowStateMaximize happens to be 1.
144 / 318
All this makes programming using early binding immeasurably easier than using late binding.
1. The main advantage is that code which uses late binding is more certain to be version-independent
If you set a reference in a Word 97 project to Microsoft Excel 8.0 Object Library, then the project willrun OK on a machine which has Office 2000 installed. Word 2000 changes the reference on the fly to the crosoft Excel 9.0 Object Library.
Mi
But as they famously say, YMMV. Problems have been found in certain circumstances. For instance, if you run a Word 97 project containing a reference to the Excel 8.0 object library on a machine with Office 2000 installed, it will run OK, but you may get the occasional cannot open macro storage error unless you save the project in Word 2000. If you do save it in Word 2000, the reference will change to the Excel 9.0 object library. So if you use early binding and support a mixed environment, it may be safest to create separate Word 97 and Word 2000 versions of your addins, despite the maintenance overhead.
145 / 318
2. The more references your project contains, the larger the file size and the longer it takes to compile.
3. Some programming environments don't allow you to create references to another application.
Summary
Personally, as someone who finds programming difficult at the best of times, I would never dream of using late binding why make life harder for yourself than it has to be? But some programming geniuses prefer to use late binding, because of the peace of mind it gives them regarding version independence or maybe some of them just enjoy the challenge! <g> But you pays your money and makes your choice ...
To those unfortunate souls using programming environments in which you have to use late binding, all I can say is: Look on the bright side you could have ended up as an Assembly language programmer ...
146 / 318
You can author new controls by combining existing controls using class composition. A composite control renders a user interface that reuses the functionality of existing controls. A composite control can synthesize properties from the properties of its child controls and handle events raised by its child controls. It can also expose custom properties and events.
There are two different ways of implementing OLE Automation: VTBL (virtual method table, pronounced V-Table) binding, and the IDispatch (pronounced EYE-Dispatch) interface. Using VTBL binding is similar to programming the speed dialer on your phone. You look up the number once and program it into the phone. Once you verify that it's valid, a single button dials the number. All the work of looking up the phone number is handled long before you use the
147 / 318
phone number. Using the IDispatch interface is similar to looking up the phone number in a phone book before each call, and then dialing the phone. Both will get the intended results, but the speed dialer is much more efficient when you need to make the call. However, looking up the number each time verifies its correctness.
A VTBL is a data structure containing the addresses (pointers) for the methods and properties of each object in an Automation server. Using the VTBL is generally known as early binding in VBA. Frequently, early binding requires type information provided in the form of a type library. This type information allows VBA to perform compile-time syntax and type checking. At run time, this type of binding is faster, as the entry points for the Automation server are already known and the data types and syntax have already been verified.
Using the IDispatch interface is a way to call member functions within an object without knowing the exact location of their entries in the VTBL. An IDispatch implementation is frequently referred to as late binding. With IDispatch, VBA has no preexisting information about the server it will be calling. It assumes during its compile phase that the code is correct. It then attempts at run time to execute the code and trap for run-time errors. This is much less elegant and represents a step backward from the familiar syntax and type checking we have come to expect
148 / 318
from VBA. An IDispatch call also requires both the client and the server to marshal their arguments into a consistent form that is understood by both. In most cases, this means that arguments are copied into and out of variants. This not only slows down IDispatch, but it also limits the data types that can be passed using this technique. In all future discussions VTBL binding will be referred to as early binding and IDispatch as late binding.
What does this mean to you as a developer using VBA? If possible you should attempt to early bind when using Automation objects from VBA. Early binding not only increases performance, but you get syntax and type checking at compile-time. If you can't early bind you must use late binding, which is slower and doesn't allow you to catch simple errors (such as type mismatches) until run time.
Early binding should be used whenever possible. However, there are programming situations in which late binding is preferred. If you are implementing polymorphic code (one call can represent multiple different objects), then late binding is required. For example, you can create three classes widgets, gidgets, and gadgets all with a Create method. By defining your variable as an object, you can call the Create method for any of the three classes based on run-time conditions.
When testing this type of late-bound strategy, it's generally best to test a single object, early bind to get the syntax and type checking, and then switch to late binding after you've tested each object individually.
Binding in VBA
149 / 318
What does early binding versus late binding look like in VBA? The main difference is in how you declare your variables. The following code snippet declares an object variable that refers to an instance of Microsoft Word. This example represents late binding, since we have used the generic Object data type. VBA doesn't know what type of object it is and will use late binding at run time to handle it. This is like running to the phone book before dialing the phone.
In the following code snippet, we declare the same object variable and specifically type it as Word.Application. This can be done only after we have referenced the Microsoft Word type library using Tools/References. Since VBA knows about the type of this object, it attempts to use early binding when dealing with it.
How you declare the object variable is the factor that determines whether an object is early or late bound. How you create the object has no bearing on the type of binding VBA does, but it does have some performance implications.
To create an object, you can use either the New keyword or the CreateObject method. The
150 / 318
CreateObject method is typically used when you don't know the Program ID (ProgID) of the object you are going to create until run time. Excel.Application is an example of a ProgID. Typically, a ProgID is composed of the application name followed by a period and then the class name (for example, Application.Class). To arrive at the ProgID for a particular object, use this method and then look at HKEY_CLASSES_ROOT in the registry to verify that you are correct. If you are correct, the ProgID should show up in this hive as a key. It's often assumed that if you use CreateObject you are using late binding, but this is not always the case. The declaration of the object variable is the overriding factor. CreateObject does have a slight performance disadvantage when compared to New. CreateObject assumes there is no reference to the object it is trying to instantiate and loads all the type information from the registry. This process is slower than using the type information available in a type library.
The New keyword has two syntaxes. The following example declares and instantiates the object in separate lines:
This is the recommended syntax. The following example shows how New can be used to declare and instantiate an object at the same time:
This ensures that wrd always contains a valid instance of Word.Application. You don't have to worry about checking to see if wrd has been initialized yet. But there is a minor penalty for this,
151 / 318
since the VBA compiler adds some overhead to be sure the object was loaded. This is transparent to you, but your compiled code will be slightly larger compared with the previous syntax.
CreateObject can also be used, and it retrieves the type information for Word.Application from the referenced type library. The results of the following are identical with but slightly slower than using the similar construct with the New keyword:
New is the recommended method for instantiating objects if you have access to the object's type library.
Early binding: associating with every variable its abstract data type -- enables type checking
Late binding: attributes data types are not known until run time. Polymorphism allows to select the implementation at run-time.
The main advantage of late binding is that programs look simpler, the disadvantage is that many type errors are not caught until run-time (if at all).
152 / 318
OLE Automation objects are instantiated in two different manners: in-process and cross-process. An in-process Automation object is loaded as a DLL into the process space (the memory of the application) of the controller. This has a distinct performance advantage, since the controller and object are in the same process space and direct function calls may be made between them. However, there are some drawbacks. When loading servers in-process, each controller must load its own copy of the object. There is no sharing of objects between processes. When an object is in-process, a bug in the object can bring down both the controller and the object. Despite the pitfalls, in-process object communication is fastest and is typically the method you want to use.
Cross-process objects load in separate process spaces and use remote procedure calls (RPC) to communicate. There is a certain amount of overhead involved in cross-process RPC, and as a result this method is typically slower than the in-process implementation. It does, however, have the advantage of partitioning the processes, and it allows a single object to be shared by multiple controllers.
The Capability Maturity Model for Software describes the principles and practices underlying software process maturity and is intended to help software organizations improve the maturity of their software processes in terms of an evolutionary path from ad hoc, chaotic processes to mature, disciplined software processes. The CMM is organized into five maturity levels:
153 / 318
1) Initial. The software process is characterized as ad hoc, and occasionally even chaotic. Few processes are defined, and success depends on individual effort and heroics.
2) Repeatable. Basic project management processes are established to track cost, schedule, and functionality. The necessary process discipline is in place to repeat earlier successes on projects with similar applications.
3) Defined. The software process for both management and engineering activities is documented, standardized, and integrated into a standard software process for the organization. All projects use an approved, tailored version of the organization's standard software process for developing and maintaining software.
4) Managed. Detailed measures of the software process and product quality are collected. Both the software process and products are quantitatively understood and controlled.
5) Optimizing. Continuous process improvement is enabled by quantitative feedback from the process and from piloting innovative ideas and technologies.
154 / 318
Except for Level 1, each maturity level is decomposed into several key process areas that indicate the areas an organization should focus on to improve its software process.
The key process areas at Level 2 focus on the software project's concerns related to establishing basic project management controls. They are Requirements Management, Software Project Planning, Software Project Tracking and Oversight, Software Subcontract Management, Software Quality Assurance, and Software Configuration Management.
The key process areas at Level 3 address both project and organizational issues, as the organization establishes an infrastructure that institutionalizes effective software engineering and management processes across all projects. They are Organization Process Focus, Organization Process Definition, Training Program, Integrated Software Management, Software Product Engineering, Intergroup Coordination, and Peer Reviews.
The key process areas at Level 4 focus on establishing a quantitative understanding of both the software process and the software work products being built. They are Quantitative Process Management and Software Quality Management.
The key process areas at Level 5 cover the issues that both the organization and the projects must address to implement continual, measurable software process improvement. They are Defect Prevention, Technology Change Management, and Process Change Management.
155 / 318
ASP
28.
a. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnproasp2/html/implement ingaspsecurity.asp
29.
http://www.learnasp.com/freebook/learn/differences.aspx
30.
a.
#include file
31. How can you pass values between two pages in ASP?how will you do the same in ASP.net?
156 / 318
a.
Query String
b.
Post/Hidden members
c.
Session Variables
32.
a. Microsoft has one free DLL, namely CPSHOST.DLL, with which you can upload files. It requires a folder with write permissions since it is there where the file(s) will be posted (saved) when they arrive to the Web server (IIS). Another drawback is that you are focusing only on file uploading and not on other uploading possibilities. Remember, when you upload a file, you can also upload (post) any other inputs, such as the input file, input checkbox, input password, and input image, etc. And you can check their value just as if you were posting an ordinary form. So when you upload a file you are really posting a form's content to the browser by using a different encoding type (enctype) in your form. That encoding is specified as enctype="multipart/form-data" as an attribute of your form.
b.
http://www.15seconds.com/issue/001003.htm
157 / 318
33.
a.
Request
b.
Response
c.
Session
d.
Application
e.
Server
f.
ObjectContext
g.
Error
34.
a.
Variant
158 / 318
35.
a.
36.
There are many things that you can do to optimise ASP applications but the follow list is a good starting point;
Be careful where you store COM objects, especially those written in VB.
159 / 318
VB
42.
There are two different ways of implementing OLE Automation: VTBL (virtual method table, pronounced V-Table) binding, and the IDispatch (pronounced EYE-Dispatch) interface.
A VTBL is a data structure containing the addresses (pointers) for the methods and properties of each object in an Automation server. Using the VTBL is generally known as early binding in VBA. Frequently, early binding requires type information provided in the form of a type library. This type information allows VBA to perform compile-time syntax and type checking. At run time, this type of binding is faster, as the entry points for the Automation server are already known and the data types and syntax have already been verified.
160 / 318
Using the IDispatch interface is a way to call member functions within an object without knowing the exact location of their entries in the VTBL. An IDispatch implementation is frequently referred to as late binding. With IDispatch, VBA has no preexisting information about the server it will be calling. It assumes during its compile phase that the code is correct. It then attempts at run time to execute the code and trap for run-time errors. This is much less elegant and represents a step backward from the familiar syntax and type checking we have come to expect from VBA. An IDispatch call also requires both the client and the server to marshal their arguments into a consistent form that is understood by both. In most cases, this means that arguments are copied into and out of variants. This not only slows down IDispatch, but it also limits the data types that can be passed using this technique. In all future discussions VTBL binding will be referred to as early binding and IDispatch as late binding.
Early binding not only increases performance, but you get syntax and type checking at compile-time. If you can't early bind you must use late binding, which is slower and doesn't allow you to catch simple errors (such as type mismatches) until run time.
Early binding should be used whenever possible. However, there are programming situations in which late binding is preferred. If you are implementing polymorphic code (one call can represent multiple different objects), then late binding is required. For example, you can create three classes widgets, gidgets, and gadgets all with a Create method. By defining your variable as an object, you can call the Create method for any of the three classes based on run-time conditions.
161 / 318
When testing this type of late-bound strategy, it's generally best to test a single object, early bind to get the syntax and type checking, and then switch to late binding after you've tested each object individually.
43.
a.
b.
On Error GoTo
c.
On Error GoTo 0
44.
a.
162 / 318
45.
a.
Type
46.
What are the various ways in which you instantiate an object in VB?
To create an object, you can use either the New keyword or the CreateObject method. The CreateObject method is typically used when you don't know the Program ID (ProgID) of the object you are going to create until run time. Excel.Application is an example of a ProgID. Typically, a ProgID is composed of the application name followed by a period and then the class name (for example, Application.Class). To arrive at the ProgID for a particular object, use this method and then look at HKEY_CLASSES_ROOT in the registry to verify that you are correct. If you are correct, the ProgID should show up in this hive as a key. It's often assumed that if you use CreateObject you are using late binding, but this is not always the case. The declaration of
163 / 318
the object variable is the overriding factor. CreateObject does have a slight performance disadvantage when compared to New. CreateObject assumes there is no reference to the object it is trying to instantiate and loads all the type information from the registry. This process is slower than using the type information available in a type library.
The New keyword has two syntaxes. The following example declares and instantiates the object in separate lines:
This is the recommended syntax. The following example shows how New can be used to declare and instantiate an object at the same time:
This ensures that wrd always contains a valid instance of Word.Application. You don't have to worry about checking to see if wrd has been initialized yet. But there is a minor penalty for this, since the VBA compiler adds some overhead to be sure the object was loaded. This is transparent to you, but your compiled code will be slightly larger compared with the previous syntax.
CreateObject can also be used, and it retrieves the type information for Word.Application from
164 / 318
the referenced type library. The results of the following are identical with but slightly slower than using the similar construct with the New keyword:
New is the recommended method for instantiating objects if you have access to the object's type library.
47. What are the threading models that you can choose in VB? Which one will you recommend and why?
Because in this model the COM object is instantiated only on the first call to it.
165 / 318
48.
Can you store a VB object in ASP session variable? Is it recommended? Why not?
Code that places objects in session or even application scope on the basis that it is more efficient to only create the object once and that this has the advantage of persisting not only data but also business logic as well. Whilst it is true that the creation of an object can be time consuming and the idea of persisted business logic is tempting, placing the VB object in session scope has a peculiar side effect it can seriously impair the performance of the application.
To understand this problem we have to lift the lid and examine how ASP actually works. The core of the ASP runtime executes in an MTA process which enables it to do many things at once, however requests for ASP pages are placed into a queue which then distributes the requests to a number of STA worker threads each of which can only deal with one request at a time. ASP uses up to 25 STA worker threads at any one time (per processor). The problem with the VB components is that they exhibit thread affinity. Once a object has been created in session scope by an ASP script that was processed by STA worker number 6, that session is pinned to worker number 6 for its life cycle. This means that when the client places a subsequent request it can only be processed by worker thread number 6, even if all the rest of the workers are idle the request will stay in the queue until worker thread 6 becomes free. You can see how detrimental this side effect can be with session scope objects but placing VB
166 / 318
objects
application scope is even worse as it will pin all requests for your application to one single worker thread effectively only using one 25th of your servers capability.
49.
The Compatibility setting allows you to determine the Visual Basic project's compatibility to older versions of the ActiveX Components generated from the project.
The ActiveX Components you create contain a default interface (for example, CName_D where CName is the ClassName for the ActiveX Component) that contains all of the methods and properties you have created. If your Class raises events, you also have an additional interface called IConnectionPointContainer. When you build an ActiveX Control or Server, these Interfaces are given a unique identifier. If you modify your control or server, these interfaces may change. Any applications using an older version of your component may fail at this point. To ensure that your new and old interfaces will work with all applications, you need to set the appropriate Compatibility setting.
167 / 318
You can set the Project's Compatibility in the ProjectProperties dialog box, under the Component tab.
No compatibility.
Project compatibility.
Binary compatibility.
168 / 318
No Compatibility
With this setting, no compatibility is enforced. Visual Basic creates new Interface IDs and Class IDs every time you build or compile your project. Each version built can only be used with applications created to work with that specific build of the component.
Project Compatibility
With this setting, you can make your project compatible to a specific component project. While new type library information is generated, the type library identifier is maintained so that test projects can still refer to the component project. This setting is for maintaining compatibility during testing. Therefore, once the component is released, it behaves the same as the No Compatibility setting.
Binary Compatibility
When you compile your project, Visual Basic only creates new Class and Interface IDs when necessary. It preserves the class and interface IDs from the previous version(s) so that programs compiled using an earlier version will continue to work. If you are making a change that will result in an incompatible version, Visual Basic will warn you. If you want to maintain compatibility with older, released versions of an ActiveX component, this is the setting you need to use.
50.
169 / 318
a.
COM
12.
a.
b.
COM is a Specification
c.
DCOM is a Model/Implementation
13.
a.
IUnKoown
14.
170 / 318
a.
15.
What is IDispatch?
a.
16.
Components are characterized by their location relative to clients. An out-of-process component is an .exe file that runs in its own process, with its own thread of execution. Communication between a client and an out-of-process component is therefore called cross-process or out-of-process communication.
An in-process component, such as a .dll or .ocx file, runs in the same process as the client. It provides the fastest way of accessing objects, because property and method calls dont have to be marshaled across process boundaries. However, an in-process component must use the clients thread of execution.
In-process components execute in the process space of the calling application; out-of-process components execute in their own distinct process space. When an application (any .exe file) starts, Windows creates a process space in which the application runs. This process space gets its own memory address space that's inaccessible to other processes. When an application instantiates an object from an in-process component (DLL, OLE custom controlOCX), code executes in the calling application. This calling application is called the client. The in-process
171 / 318
component can share the memory address space of the client application.
17.
How will you choose between activex exe and activex dll?
18.
ActiveX.exe example.
a.
DLLHHost.exe
XML
5.
Structured information contains both content (words, pictures, etc.) and some indication of what role that content plays (for example, content in a section heading has a different meaning from
172 / 318
content in a footnote, which means something different than content in a figure caption or content in a database table, etc.). Almost all documents have some structure.
A markup language is a mechanism to identify structures in a document. The XML specification defines a standard way to add markup to documents.
XML is to data as what HTML is to text. One thing to note is that XML is NOT a replacement for HTML.
XML
HTML
Users define their own tags Users have to utilize the pre-defined tags
While there are differences between XML and HTML, in syntax they are very similar, although XML demands that the user pay attention to the little details. Next I will explain some of the new rules that XML uses that make its use slightly different from that of HTML.
173 / 318
6.
XSL is a language for expressing style sheets. An XSL style sheet is, like with CSS, a file that describes how to display an XML document of a given type. XSL shares the functionality and is compatible with CSS2 (although it uses a different syntax). It also adds:
A transformation language for XML documents: XSLT. Originally intended to perform complex styling operations, like the generation of tables of contents and indexes, it is now used as a general purpose XML processing language. XSLT is thus widely used for purposes other than XSL, like generating HTML web pages from XML data.
Advanced styling features, expressed by an XML document type which defines a set of elements called Formatting Objects, and attributes (in part borrowed from CSS2 properties and adding more complex ones.
174 / 318
http://www.w3.org/Style/XSL/WhatIsXSL.html
7.
a.
MSXML
8.
a. SAX (Simple API for XML) like DOM (Document Object Model) gives access to the information stored in XML documents using any programming language (and a parser for that language). However, both of them take very different approaches to giving you access to your information: DOM creates a tree of nodes (based on the structure and information in your XML document) and you can access your information by interacting with this tree of nodes. DOM gives you access to the information stored in your XML document as a hierarchical object model. The textual information in your XML document gets turned into a bunch of tree nodes. With SAX, the parser tells the application what is in the document by notifying the application of a stream of parsing events. Application then processes those events to act on data. SAX is very useful when the document is large.
175 / 318
b. http://msdn.microsoft.com/library/en-us/xmlsdk30/ htm/sax2_gettingstarted_saxordom.asp
ASP
Application
ASPError
ObjectContext
Request
176 / 318
Response
Server
Session
The Application object shares, stores, and retrieves information in response to requests from users to the application.
COLLECTION PROPERTIES
Contents Object
177 / 318
A collection of all of the items which have been created and added to the Application object during client sessions through script commands, such as the Server.CreateObject, rather than by using the HTML <OBJECT> tag.
StaticObjects Object
A collection of all of the items which have been created and added to the Application object during client sessions by using the HTML <OBJECT> tag, rather than using script commands.
METHODS
178 / 318
The Contents.Remove method is used to remove a single item from a Contents collection.
The Contents.RemoveAll method is used to remove all items from a Contents collection.
Lock Method
The Lock method prevents all other users from making changes in the Application object.
Unlock Method
The Unlock method allows any user to have access to any of the Application object properties in order to make changes.
179 / 318
EVENTS
OnEnd Event
The OnEnd event occurs when the Application quits. This should not occur unless all user sessions are over. The signal of this event will run a handler script in the Global.asa file, if the script exist.
OnStart Event
180 / 318
The OnStart event occurs before the start of any new session by a user (i.e., before the Application object is first referenced). The signal of this event will run a handler script in the Global.asa file, if the script exist.
ASPError
The ASPError object is used to obtain detailed information on an error condition. This information, provided by the nine read-only properties of ASPError, can only be accessed by using the Server.GetLastError method.
PROPERTIES
181 / 318
ASPCode Property
ASPDescription Property
The ASPDescription property returns a string that provides more detailed description of the error as compared to the short description returned by the Description property. (Not available for all errors.)
Category Property
The Category property returns a string indicating if the error was generated by IIS, an object, or a scripting language.
Column Property
182 / 318
The Column property returns a long integer defining the column position inside the ASP file where the error occurred.
Description Property
The Description property returns a string that is a short description of the error. If you desire a longer description, use the ASPDescription property.
File Property
The File property returns the name of the ASP (Active Server Page) file in which the error occurred.
Line Property
The Line property returns an long integer defining the line number inside the ASP file where the error occurred.
183 / 318
Number Property
The Number property returns a long integer defining the standard COM error code returned by a COM component.
Source Property
The Source property returns a string with the actual line from the source code where the error occurred (if available).
ObjectContext object
The ObjectContext object is used to control Active Server Pages transactions which are managed by the Microsoft Transaction Server (MTS). You may either complete (commit) or abort a transaction.
The @Transaction directive must be on the first line of the .asp file in order to use this object (see code examples). The @Transaction directive causes a transaction to run to completetion unless an abort occurs.
184 / 318
METHODS
SetAbort Method
The SetAbort method declares that a transaction has not been completed and resources should not be updated.
SetComplete Method
The SetComplete method declares that the transaction has been completed and resources can be updated.
185 / 318
EVENTS
OnTransactionAbort Event
The OnTransactionAbort event occurs when a transaction has been aborted for some kind of processing error. The signal of this event will run a handler script in the same file, if it exist.
OnTransactionCommit Event
The OnTransactionCommit event occurs when a transaction has been successfully completed. The signal of this event will run a handler script in the same file, if it exist.
Request object
The Request object provides access to all of the information that is passed in a request from the browser to the server. This information is stored among five types of Request collections. A collection is similar to a data structure or array. Individual items in the collection are accessed via a unique key assigned to that item.
186 / 318
All variables can be accessed directly by calling Request(variable) without the collection name. In this case, the Web server searches the collections in the following order: QueryString, Form, Cookies, ClientCertificate, then ServerVariables.
PROPERTY
TotalBytes Property
The TotalBytes property specifies the total number of bytes sent in the body of the HTTP request.
187 / 318
COLLECTION PROPERTIES
The ClientCertificate collection property contains the values of the client certification fields of the request.
The Cookies collection property contains the values of the cookies sent in the request.
The Form collection property contains the values of the <FORM> elements posted to a form using the POST method.
188 / 318
The QueryString collection property contains the values of the variables in the HTTP query string, which are the statements that follow a question mark.
The ServerVariables collection property contains the values of server environmental variables. This allows access to the HTTP headers.
METHOD
The BinaryRead method retrieves the data that was sent to the server from the browser as part of a POST request, and returns the number of bytes read.
189 / 318
Response object
PROPERTIES
The Buffer property tells whether the page output being sent to the browser is buffered.
190 / 318
CacheControl Property
The CacheControl property determines whether a proxy server can cache the Active Server Page.
Charset Property
The Charset property appends the name of the character set being used to the content-type header contained in the response object.
ContentType Property
The ContentType property specifies the HTTP content type/subtype for the response header.
Expires Property
The Expires property specifies the length of time in minutes until a cached page on the browser expires.
191 / 318
ExpiresAbsolute Property
The ExpiresAbsolute property specifies a date and time when a cached page on the browser will expire.
The IsClientConnected property indicates whether the browser has disconnected from the server since the last Response.Write.
PICS Property
The PICS property specifies the value of a PICS rating label for a document or a site.
Status Property
The Status property specifies the value of the status line returned by the server.
192 / 318
COLLECTION PROPERTIES
The Cookies collection property allows you to add a cookie to a browser and add values to the cookie.
METHODS
The AddHeader method adds a new named HTTP header with a specific value to the response.
193 / 318
The AppendToLog method adds a string to the end of an entry in the Web server log for this request.
The BinaryWrite method sends specific data to the current HTTP output without any character conversions.
Clear Method
End Method
194 / 318
The End method causes the web server to stop processing the script and to return the current results without processing the rest of the file.
Flush Method
195 / 318
Server object
The Server object provides access to the utility functions of the server.
PROPERTY
196 / 318
ScriptTimeout Property
The ScriptTimeout property is the amount of runtime in seconds for a script before it terminates.
METHODS
The CreateObject method creates an instance of an object to use in an Active Server Page.
The Execute method allows you to call another ASP page from inside an ASP page. When the called ASP page completes its tasks, you are then returned to the calling ASP page.
197 / 318
The GetLastError method returns an ASPError object that describes any pre-processing, runtime, or script compiling errors that occurred.
The HTMLEncode method applies HTML syntax to a specified string of ASCII characters.
The Transfer method allows you to transfer all of the state information for all of the built-in objects from one ASP page to another. Unlike the Execute method, when the ASP page that you have transferred to is finished, you do not return the original ASP page.
198 / 318
The URLEncode method applies URL rules to a specified string of ASCII characters.
Session Object
Session object is assigned to the user and it is used to store, share, and retrieve information concerning the user session. By default, the Session object is destroyed after a session has been idle for twenty minutes.
PROPERTIES
CodePage Property
The CodePage property specifies the server codepage that will be used to display dynamic content.
199 / 318
LCID Property
The LCID property specifies the location identifier that will be used to display dynamic content.
SessionID Property
The SessionID property returns the unique identifier for a user session.
Timeout Property
The Timeout property is the length of time in minutes before an idle session is terminated.
COLLECTION PROPERTIES
200 / 318
The Contents collection property contains all of the items that have been created and added to the Session object through script commands, rather than using the HTML <OBJECT> tag.
The StaticObjects collection property contains all of the items created in the Global.asa file using the HTML <OBJECT> tag within the scope of the Session object.
METHODS
Abandon Method
The Abandon method terminates a user session, destroys all data and objects in the current Session object, and releases its resources.
201 / 318
The Contents.Remove method is used to remove a single item from a Contents collection.
The Contents.RemoveAll method is used to remove all items from a Contents collection.
EVENTS
OnEnd Event
The OnEnd event occurs when the Session quits. The signal of this event will run a handler script in the Global.asa file, if the script exists.
OnStart Event
202 / 318
The OnStart event occurs before the start of any new Session by a user. The signal of this event will run a handler script in the Global.asa file, if the script exists.
VBScript has only one data type and it's called a Variant. A Variant is a special kind of data type that can contain different kinds of information, depending on how it's used. Because Variant is the only data type in VBScript, it's also the data type returned by all functions in VBScript.
203 / 318
At its simplest, a Variant can contain either numeric or string information. A Variant behaves as a number when you're using it in a numeric context and as a string when you use it in a string context. That is, if you're working with data that looks like numbers, VBScript assumes that it is numbers and does the thing that is most appropriate for numbers. Of course, you can always make numbers behave as strings, by enclosing them in quotation marks. Similarly, if you're working with data that can only be string data, VBScript treats it as string data.
Beyond the simple numeric or string classifications, a Variant can make further distinctions about the specific nature of numeric information. For example, you can have numeric information that represents a date or a time. When used with other date or time data, the result is always expressed as a date or a time. Of course, you can also have a rich variety of numeric information ranging in size from Boolean values to huge floating-point numbers. These different categories of information that can be contained in a Variant are called subtypes. Most of the time, you can just put the kind of data you want in a Variant and it behaves in a way that is most appropriate for the data it contains.
The following table shows the various subtypes of data that a Variant can contain.
204 / 318
Subtype
Description
Empty Variant is uninitialized. Value is either 0 for numeric variables or a zero-length string ("") for string variables.
Null
Boolean
Byte
Integer
Currency
-922,337,203,685,477.5808 to 922,337,203,685,477.5807.
Single Contains a single-precision, floating-point number in the range -3.402823E38 to -1.401298E-45 for negative values; 1.401298E-45 to 3.402823E38 for positive values.
205 / 318
Double Contains a double-precision, floating-point number in the range -1.79769313486232E308 to -4.94065645841247E-324 for negative values; 4.94065645841247E-324 to 1.79769313486232E308 for positive values.
Date (Time) Contains a number that represents a date between January 1, 100 to December 31, 9999.
String Contains a variable-length string that can be up to approximately 2 billion characters in length.
If you want to convert from one subtype to another, there is a rich set of conversion functions you can use. In addition, the VarType function returns information about how your data is stored within a Variant.
206 / 318
1. A language is strongly typed if type annotations are associated with variable names, rather than with values. If types are attached to values, it is weakly typed.
2. A language is strongly typed if it contains compile-time checks for type constraint violations. If checking is deferred to run time, it is weakly typed.
3. A language is strongly typed if there are compile-time or run-time checks for type constraint violations. If no checking is done, it is weakly typed.
4. A language is strongly typed if conversions between different types are forbidden. If such conversions are allowed, it is weakly typed.
5. A language is strongly typed if conversions between different types must be indicated explicitly. If implicit conversions are performed, it is weakly typed.
6. A language is strongly typed if there is no language-level way to disable or evade the type system. If there are casts or other type-evasive mechanisms, it is weakly typed.
7. A language is strongly typed if it has a complex, fine-grained type system with compound types. If it has only a few types, or only scalar types, it is weakly typed.
207 / 318
8. A language is strongly typed if the type of its data objects is fixed and does not vary over the lifetime of the object. If the type of a datum can change, the language is weakly typed.
208 / 318
Active Server Pages is a component of Internet Information Server, and thus uses Windows NT Security. ASP files can be easily restricted to just certain users through secure Windows NT authentication, basic Web authentication, or client-side certificates. For additional security, all client-to-server communications can be secured with Secure Sockets Layer (SSL).
* Suppose you have an application for credit card validation. What steps will you take to restrict unauthorized users from using the application
SSL
* Write the code snippet for fetching data from a table and populating in a list box control of an asp page.
Open ADO connection and go thru the table and keep in a variable and assign to the listbox
209 / 318
* Say you are designing a product page the products list is constant? How will you design this page? (will you go to db each time to retrieve the list of products for each user?)
Session
Session
Using Database
210 / 318
Visual Basic and other Single-Threaded Apartment (STA) objects should be used only at page scope. Storing STAs in a Session variable locks the object down to the thread that created the object, defeating the purpose of a thread pool. Storing an STA in Application scope serializes access for all users.
211 / 318
The Scripting.Dictionary is Apartment threaded and should be used only at page scope, or your application will suffer serious serialization issues . This limitation usually raises the question of what dictionaries can be used at Session or Application scope. Options are somewhat limited, but include the Commerce Dictionary and the LookupTable Object.
Script is interpreted line by line, so eliminating redundant script or creating more efficient script can improve performance. If you have hundreds of lines of ASP script in a single page, perhaps you can better partition your user, business, and data services.
There are no hard and fast rules for include-file sizes, but knowing how includes work can help you gauge whether you are using them efficiently. When ASP processes includes, it reads the entire file into memory. Because ASP will cache the entire expanded code (your page + the
212 / 318
include), not just the functions you call, you may end up with large, inefficient namespaces that ASP must search when calling methods or looking up variables. Note that this process occurs for each page that uses the include. A good guide is to create fine-grained includes, so that you can be more selective about which pages will include them
Global variables increase the namespace used by ASP to retrieve values from memory. Variables declared within subroutines or functions are faster.
Keep blocks of ASP server-side script together, rather than switching back and forth between server-side and client-side code. This switching usually happens when concatenating HTML with simple values from ASP, as when you are writing out an HTML table:
Buffering is on by default in Windows 2000, but may be off if you've upgraded from Internet Information Server (IIS) 4.0.
When buffering is on, ASP will wait until processing is complete before sending down the response, reducing network roundtrips and server-processing delays. When buffering is off, ASP waits for TCP acknowledgements from clients, which can really hurt performance,
213 / 318
Note that while buffering may improve throughput, it may reduce perceived performance. If perceived performance is an issue, you can turn off buffering with Response.Buffer = False or you can call Response.Flush.
ASP Sessions are a convenient facility, but they limit scalability. Sessions limit the scalability of a single box because they consume resources for each user. While Session size is largely determined by what you stuff into the Session variable, the real cost is resource contention. Sessions also limit your application's ability to scale out across multiple machines, because each Session is Web-server specific.
214 / 318
If the application doesn't rely on Sessions, disable Session state for the Web or virtual directory through the ISM (Internet Services Manager). Disabling Session state allows ASP to skip an extensive amount of source code, reducing overhead
Caching is one of the most difficult aspects of Web application development, because it threatens the scalability of your application. Determining what to cache is based on data volatility and scope. Data that is static or used application-wide can be a good candidate for caching. Data that changes frequently or is user-specific would not be a good candidate.
Determining where in your application you should cache your data is based on your application goals, and you need to know the trade-offs. For example, caching an ActiveX Data Objects (ADO) Recordset offers flexibility, because you can still grab an array or save the recordset as XML. However, if your application will be rendering the same HTML repeatedly, such as to display a list box of countries, you might cache the HTML string in Application scope, rather than just the data
It is generally more expensive to redimension arrays than it is to grab more than you need up front. Redimensioning arrays requires Visual Basic Scripting Edition (VBScript) to allocate space for the new array -- and, if you've used the Preserve modifier to preserve the contents of the array, to copy the data from the old array into the new. This means that not only are you
215 / 318
spending extra processor cycles to redimension the array, but also that the process initially requires twice as much memory for the copy. However, if you allocate more space than you need initially (you need only five elements initially, but allocate space for 128), then adding more data to the array requires VBScript to insert only the new values into the existing array.
Multiple languages on a given page mean multiple script engines for that page. Script engines use Thread Local Storage (TLS), so multiple threads cannot use an instance of a script engine concurrently. Therefore, five simultaneous requests to the same page will cause ASP to instantiate five script engines. More engines means more overhead, so you may be able to gain some performance by limiting your number of languages used on a given page.
By testing Response.IsClientConnected your application can avoid wasting CPU cycles by quitting methods if the client is no longer connected. Note that IIS 5.0 overcomes a limitation in IIS 4.0 (the need to send content to the browser before checking the property).
216 / 318
When you request Server.MapPath, you are generating an additional request for the server to process. To improve performance, replace Server.MapPath with a fully qualified path when deploying your Web site.
Use regular expressions in validation routines, in formatting functions, and instead of looping through strings
VBScript 5.0 provides the With statement. The With statement allows you to execute a series of statements on a specific object without requalifying the name of the object
Stripping out empty Session events reduces the amount of source code that ASP must traverse, and improves performance
Component Performance
217 / 318
Storing references to objects in ASP's Session or Application scope will cause many performance and scalability issues if those objects aren't designed to be shared across threads or activities. Only agile components -- or, in Windows 2000, components marked Neutral -- can be referenced in Session or Application variables with direct access by client threads
If you need to cache data that is read frequently and seldom updated in the middle-tier, use SQL Server rather than a roll-your-own solution. SQL Server provides high-performance middle-tier caching
Use fixed-length strings in Visual Basic for string concatenation. Don't just keep adding to a string, or you'll reallocate it multiple times -- and reallocation is expensive.
218 / 318
Transactions provide a service -- and that service can add a performance hit. Evaluate whether methods actually need transactions. For example, if you're grabbing a recordset to hand off to a browser client for reading data, you don't need a transaction. By factoring out operations that read data into separate components from operations that perform updates, you have more flexibility in marking your components for transactions.
Calling SetComplete and SetAbort in each method of your Microsoft Transaction Server (MTS) components will release resources earlier, and will ensure that a component does not live outside the scope of its transaction. In Windows 2000, COM+ provides the setting 'Automatically deactivate this object when this method returns,' which performs the equivalent code. You can enable this setting on a per-method basis in the Component Services console.
219 / 318
Minimizing marshaling overhead and reducing network calls are keys to improving performance of distributed applications. Use early binding in your components to minimize expensive network round trips by eliminating the extra call to GetIdsOfNames that late binding incurs. You can further reduce network trips by bundling your parameters into arguments for method calls, instead of setting a bunch of properties individually. Rather than pass parameters ByRef, pass ByVal where you can to minimize marshaling overhead.
Indexes provide immediate impact on your application's performance. Poor indexes will slow your application to a crawl, while good indexes will help optimize your application's performance.
Using stored procedures prevents your database from having to recompile your SQL statements repeatedly. Use stored procedures or parameterized SQL strings.
Check your SELECT statements to ensure that you're returning only the required columns and only the necessary rows. If you have queries that can potentially return a lot of records, consider paging through your recordsets.
220 / 318
This defeats the purpose of connection pooling and creates resource contention. Create connection at page scope or within the functions that need them, and set the connections to nothing to free the connection back to the pool.
Recordsets need to be closed if they are going to be reused (but reusing recordsets is discouraged). Closing Connection variables as soon as you can releases them back to the pool, so that they can be pooled for reuse. It is always good practice to explicitly close your object variables.
Create new Recordset and Command variables rather than reusing existing ones. This won't necessarily improve your application's performance but it will make your application more reliable and easier to maintain.
Disconnecting recordsets frees the Connection object back to the pool, allowing the Connection to be closed and reused sooner.
Are you using the right cursor and lock-type for the job?
221 / 318
Use "Firehose" (forward-only, read-only) cursors when you need to make a single pass through the data. Firehose cursors, the default in ADO, provide the fastest performance and have the least amount of overhead.
In general, DSN-less connections are faster than System DSNs (data source names), which are faster than File DSNs.
IIS Settings
Check the ISM. If ASP debugging is enabled, the application is locked down to a single thread of execution
Secure Sockets Layer (SSL) is expensive in terms of bandwidth and CPU usage. If you're using SSL, it's because of security needs. Your best bet is to restrict SSL usage to where you need it, and keep the pages simple.
222 / 318
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnserv/html/server03272000.asp
223 / 318
VB & COM
There are two ways to use Automation (or OLE Automation) to programmatically control another application.
Late binding uses CreateObject to create and instance of the application object, which you can then control. For example, to create a new instance of Excel using late binding:
224 / 318
On the other hand, to manipulate an existing instance of Excel (if Excel is already open) you would use GetObject (regardless whether you're using early or late binding):
To use early binding, you first need to set a reference in your project to the application you want to manipulate. In the VB Editor of any Office application, or in VB itself, you do this by selecting Tools + References, and selecting the application you want from the list (e.g. Microsoft Excel 8.0 Object Library).
225 / 318
In either case, incidentally, you can first try to get an existing instance of Excel, and if that returns an error, you can create a new instance in your error handler.
* What are the various ways in which you instantiate an object in VB?
* What are the threading models that you can choose in VB? Which one will you recommend and why?
In Visual Basic, apartment-model threading is used to provide thread safety. In apartment-model threading, each thread is like an apartment all objects created on the thread live in this apartment, and are unaware of objects in other apartments.
226 / 318
Visual Basics implementation of apartment-model threading eliminates conflicts in accessing global data from multiple threads by giving each apartment its own copy of global data
* Can you store a VB object in ASP session variable? Is it recommended? Why not?
Storing references to objects in ASP's Session or Application scope will cause many performance and scalability issues if those objects aren't designed to be shared across threads or activities. Only agile components -- or, in Windows 2000, components marked Neutral -- can be referenced in Session or Application variables with direct access by client threads
227 / 318
When an ActiveX component is compiled, there are three possible project compatibility settings:
No Compatibility
Project Compatibility
Binary Compatibility
No Compatibility
With this setting, new class IDs, new interface IDs and a new type library ID will be generated by VB each time the ActiveX component project is compiled. This will cause any compiled client components to fail (with error 429!) and report a missing reference to the 'VB ActiveX Test Component' when a client project is loaded in the VB IDE.
TIP: Use this setting to compile the initial release of a component to other developers.
Project Compatibility
228 / 318
With this setting, VB will generate new interface IDs for classes whose interfaces have changed, but will not change the class IDs or the type library ID. This will still cause any compiled client components to fail (with error 429!) but will not report a missing reference to the 'VB ActiveX Test Component' when a client project is loaded in the VB IDE. Recompilation of client components will restore them to working order again.
TIP: Use this setting during the initial development and testing of a component within the IDE and before the component is released to other developers.
Binary Compatibility
VB makes it possible to extend an existing class or interface by adding new methods and properties etc. and yet still retain binary compatibility. It can do this, because it silently creates a new interface ID for the extended interface and adds registration code to register the original interface ID but with a new Forward key containing the value of this new interface ID. COM will then substitute calls having the old ID with the new ID and hence applications built against the old interface will continue to work (assuming the inner workings of the component remain backward compatible!).
229 / 318
With this setting, VB will not change any of the existing class, interface or type library IDs, however in order that it can do so, VB requires the project to specify an existing compiled version that it can compare against to ensure that existing interfaces have not been broken.
TIP: Use this setting following the release of a component to other developers.
Breaking Compatibility
When the need to break compatibility arises, be sure to tackle it head on and make a clean break. To do so, create a new version of the project with compatibility set to 'No Compatibility'. Next, change the project 'Name' attribute and compile to a different component name. Taking this approach ensures that existing applications can continue to work with the old component while new versions can use the new component.
230 / 318
The first time an ActiveX component is built for release then the 'No Compatibility' setting should be selected thereby causing new class, interface and type library IDs to be generated. (Only use 'Project Compatibility' during the initial development of a component within the IDE and before releasing the component to other developers.)
A copy of the released component should then be placed into a sub-folder (preferably named 'Compat') beneath the project folder and the compatibility setting changed to 'Binary Compatible' with the compatible image being set to the component in the 'Compat' sub-folder.
231 / 318
The names and data types of elements in public user-defined types cannot change.
If a public class implements user-defined interfaces then the 'Implements' statement cannot change.
Whenever the component is amended, always update the component's version information to
232 / 318
allow different versions to be correctly distinguished. You should also update the compatible image in the 'Compat' folder with the latest compiled component binary once the component has been successfully tested and released to other developers. It is a good habit to do this even when interfaces remain unchanged.
Enables the error-handling routine that starts at line specified in the required line argument. The line argument is any line label or line number. If a run-time error occurs, control branches to line, making the error handler active. The specified line must be in the same procedure as the On
233 / 318
Specifies that when a run-time error occurs, control goes to the statement immediately following the statement where the error occurred where execution continues. Use this form rather than On Error GoTo when accessing objects
Type
End Type
234 / 318
On Error Resume Next causes execution to continue with the statement immediately following the statement that caused the run-time error, or with the statement immediately following the most recent call out of the procedure containing the On Error Resume Next statement. This statement allows execution to continue despite a run-time error. You can place the error-handling routine where the error would occur, rather than transferring control to another location within the procedure. An On Error Resume Next statement becomes inactive when another procedure is called, so you should execute an On Error Resume Next statement in each called routine if you want inline error handling within that routine.
ActiveX Exe runs in another process than the calling app; an ActiveX DLL runs in the same process.
If Calling app ends. Reference to the ActiveX DLL has gone, and the instance of the Dll should be destroyed, automatically.
235 / 318
On the other hand, an instance of the ActiveX Exe would still run when the calling app ends, as it runs in a seperate process.
* ActiveX.exe example.
Winword.exe, Dllhost.exe
* what is COMInterop?
236 / 318
Most COM components will work with ASP.NET. As with previous versions of ASP, you can still make late-bound calls to your components using Server.CreateObject.
While late binding to components is still supported, early binding is a better choice for performance reasons. A utility named the Type Library Importer (TlbImp), included with the .NET Framework SDK in the file Tlbimp.exe, converts standard COM components in DLL files to equivalent .NET Framework assemblies by building managed wrappers around the components. The converted components can be early-bound to managed code for greatly increased performance
Once the COM component is converted to a .NET assembly, you can import it into an ASP.NET page by placing a directive at the top of the page. For example, the following directive imports the namespace MyNewNamespace, which was created by the Tlbimp utility:
<%@Import Namespace="MyNewNamespace"%>
237 / 318
The assembly file generated by Tlbimp.exe must be placed in the ASP.NET application's bin directory. The original COM component file must be registered for the directory in which it resides.
When using single-threaded (STA) COM components, such as components developed using Visual Basic, from an ASP.NET page, you must include the compatibility attribute aspcompat=true in an <%@ Page > tag on the ASP.NET page. For example:
The aspcompat attribute forces the page to execute in STA mode. The runtime throws an exception if the compatibility tag is omitted and an STA component is referenced on the page. If you convert the STA component to an assembly using TlbImp, the runtime does not detect that the component uses the STA model and does not throw an exception, but your application can suffer from poor performance and possible deadlocks. STA components cannot be used from .NET Framework code modules (compiled .NET assemblies); they can be used only from ASP.NET pages.
238 / 318
COM is the general term (Component Object Model). It is a general term that represents all objects that follow this modle.
DCOM is just Distributed COM . It is really just a COM object that may be located on another machine on a network or even over the internet. The idea is, you dont need the COM object on your machine to run...you can have it run from another location and still use it.
COM+ really refers to another package that encapsulates COM. COM + provides means of providing security to your COM objects (only certain people can access them) and allowing them to participate in transactions with other programs/COM Objects.
239 / 318
The IUnknown interface lets clients get pointers to other interfaces on a given object through the QueryInterface method, and manage the existence of the object through the IUnknown::AddRef and IUnknown::Release methods. All other COM interfaces are inherited, directly or indirectly, from IUnknown. Therefore, the three methods in IUnknown are the first entries in the VTable for every interface.
240 / 318
QueryInterface
AddRef
Release
241 / 318
* What is IDispatch?
Interface that exposes objects, methods and properties to programming tools and applications that support automation
IDispatch Methods
Description
GetTypeInfoCount
Retrieves the number of type information interfaces that an object provides (either 0 or 1).
GetTypeInfo
242 / 318
GetIDsOfNames
Maps a single member and an optional set of argument names to a corresponding set of integer DISPIDs.
Invoke
Problem with using Global vars in VB components developed for Web Apps:
http://www.microsoft.com/msj/defaultframe.asp?page=/msj/0598/activex0598.htm&nav=/msj/05 98/newnav.htm
243 / 318
http://www.vbug.co.uk/vbug99/multithread.doc
General Threading:
http://www.devarticles.com/art/1/182/2
Glossary of COM/DCOM:
http://www.innovatia.com/software/papers/com.htm
244 / 318
Changes in VB.Net
ASP.NET does not support Visual Basic Scripting Edition (VBScript), but it does support Visual Basic .NET, which is very similar to VBScript. However, most existing ASP pages that contain VBScript will still have to be rewritten to some extent to run under ASP.NET.
Specific Visual Basic changes that might affect existing ASP pages containing VBScript include changes to Visual Basic syntax and changes in the threading model.
The following list describes specific changes in Visual Basic .NET that may require changes to existing Visual Basic or VBScript applications.
The data type Variant no longer exists. It has been replaced with the type Object. Object types must be explicitly cast to other primitive data types.
Parentheses are now required around the parameter list in all method calls, even for methods that do not take parameters. For example:
245 / 318
DisplayMessage()
End If
By default, arguments are passed by value, not by reference as in previous versions of Visual Basic. If you want to pass arguments by reference, you must use the ByRef keyword in front of the argument, as in the following example:
Set and Let are no longer supported. Objects can be assigned by a simple assignment operation:
Object1 = Object2
To set a default property of an object, you must now explicitly reference the property. For
246 / 318
example:
Object1.Name = Object2.Name
Most objects no longer have default properties. All nonindexed properties must be explicitly referenced. In previous versions of Visual Basic, if you wanted to access the default property of an object, specifying the name of the property was optional. For example, if you wanted to access the Text property of a TextBox control, you could use the following code:
Using Visual Basic .NET, the above code must be modified as follows:
As another example, you must explicitly reference the Value property of the Field object when retrieving fields from a Recordset (RS in the following example):
Response.Write (RS("au_fname").Value)
Indexed default properties are still supported, however. The Fields property, a default collection property of the Recordset, does not have to be explicitly referenced because it is an indexed property and the argument provides sufficient information to the compiler to evaluate the expression. The preceding line of code is functionally equivalent to the following line:
Response.Write (RS.Fields("au_fname").Value)
247 / 318
The Integer data type is now 32 bits; the Long data type is 64 bits.
Multipart Boolean expressions are short-circuited. If the first part of a multiple AND expression evaluates to False, evaluation of the expression terminates and the entire expression returns False. If the first part of a multiple OR expression evaluates to True, evaluation terminates and the entire expression returns True.
Data types should always be explicitly cast to other data types. For instance, always cast numerical values to String if a string is expected:
Variables created within the same Dim statement will be of the same type. For example, in Visual Basic .NET, the Dim statement Dim i, j, k As Integer creates each of the three objects (i, j, and k) as an Integer. Previous versions of Visual Basic would create i and j as Variants and k as an Integer.
Class property syntax has changed and no longer includes Property Let, Property Get, and Property Set. The new property syntax is similar to that in C#.
[Visual Basic]
Get
ThisProperty = InternalValue
248 / 318
End Get
Set
InternalValue = value
End Set
End Property
Spaces must always be included around the & operator when concatenating strings. VBScript allowed you to write a&b&c; in Visual Basic. NET this must be written as a & b & c to avoid a syntax error.
All If statements must be constructed on multiple lines. With VBScript, it was possible to write a single-line If statement such as If x Then y. In Visual Basic .NET, this must be written as follows:
If x Then
End if
249 / 318
Option Explicit is on by default, so all variables must be declared before they can be used.
COM type definitions usually reside in a type library. In contrast, CLS-compliant compilers produce type metadata in an assembly. The two sources of type information are quite different. This topic describes techniques for generating metadata from a type library. The resulting assembly is called an interop assembly.
When available, always use the primary interop assembly published by the author of the COM component you intend to incorporate in your managed code. Types in the primary interop assembly have been imported for you and are ready to activate and call from managed code.
Generating Metadata
250 / 318
COM type libraries can be standalone TLB files, such as Loanlib.tlb. Some type libraries are embedded in the resource section of a DLL or EXE file. Other sources of type-library information are OLB and OCX files.
After locating the type library containing the implementation of your target COM type, you have the options described in the following table for generating an interop assembly containing type metadata.
Option Description
251 / 318
Provides command-line switches to adjust metadata in the resulting interop file, imports types from an existing type library, and generates an interop assembly and a namespace.
TypeLibConverter Class
Exposes methods that perform conversion-related actions. Can convert in-memory type library information to metadata.
Custom Wrappers
As a less-desirable option, you can create type definitions from scratch. Requires advanced programming skills.
For details about the COM interop import process, see Type Library to Assembly Conversion Summary.
252 / 318
Visual Studio .NET generates an interop assembly containing metadata when you add a reference to a given type library.
1. Install the COM DLL or EXE file on your computer, unless a Windows Setup.exe performs the installation for you.
2.
3.
4.
Select the type library from the Available References list, or browse for the TLB file.
5.
Click OK.
The Type Library Importer (Tlbimp.exe) is a command-line tool that converts the coclasses and interfaces contained in a COM type library to metadata. This tool creates an interop assembly and namespace for the type information automatically. After the metadata of a class is available, managed clients can create instances of the COM type and call its methods, just as if it were a .NET instance. Tlbimp.exe converts an entire type library to metadata at once and cannot generate type information for a subset of the types defined in a type library.
253 / 318
Use the following command to produce the Loanlib.dll assembly in the Loanlib namespace.
c:>tlbimp Loanlib.dll
Adding the /out: switch produces an interop assembly with an altered name, such as LOANLib.dll. Altering the interop assembly name can help distinguish it from the original COM DLL and prevent problems that can occur from having duplicate names.
TypeLibConverter Class
254 / 318
The TypeLibConverter Class (in the System.Runtime.InteropServices namespace) provides methods to convert coclasses and interfaces in a type library to metadata within an assembly. This API produces the same metadata output as Tlbimp.exe. However, unlike Tlbimp.exe, the TypeLibConverter class can convert an in-memory type library to metadata.
Custom Wrappers
When a type library is unavailable or incorrect, one option is to create a duplicate definition of the class or interface in managed source code. You then compile the source code with a compiler that targets the runtime to produce metadata in an assembly.
To define COM types manually, you must have access to the following items:
A compiler, such as the C# compiler, that can generate the appropriate .NET Framework class definitions.
Writing a custom wrapper is an advanced technique that you seldom perform. For additional information on generating a custom wrapper, see the Customizing Standard Wrappers topic.
255 / 318
Operator overloading enables developers to define new struct types that behave much like the predefined value types. For instance, a Digit struct can support the same mathematical operations as the predefined integral types, and can define conversions between Digit and predefined types. The predefined types employ operator overloading themselves.
The following are the points to be remembered when using operator overloading
1. Only the operators mentioned in the list can be overloaded, other operators like new, typeof, sizeof etc. cannot be overloaded.
2.
3. At least one of the parameters for the operator overloading method should be the class for which the operator overloading is defined.
256 / 318
4. User defined operator implementations are given preference over predefined implementations.
5. When an arithmetic operator is overloaded it implicitly overloads the corresponding assignment operator. For example if we overload the "+" operator it implicitly overloads the "+=" operator.
6.
7. Comparison operators should be overloaded only in pairs. (i.e.) if < is overloaded then > should also overloaded.
257 / 318
What is a Destructor ?
Ans : A destructor is a member that implements the actions required to destruct an instance of a class. Destructors cannot have parameters, cannot have accessibility modifiers, and cannot be called explicitly. The destructor for an instance is called automatically during garbage collection.
Ans : An instance constructor is a member that implements the actions required to initialize an instance of a class.
A static constructor is used to initialize a class and is called automatically to initialize the class before the static members are accessed.
258 / 318
A static constructor is only called once throughout the application's lifetime. The static constructor method is called when any of the defining class' members are first accessed. The constructor is called once only
Ans : Static fields are not a perfect match for this scenario. The fields are initialized at some point before they are used, but after this initialization there is nothing to stop a client from changing them. Such a modification could cause unpredictable errors in other programs that use Color and assume that the values do not change. Readonly fields can be used to prevent such problems.
259 / 318
Thus, the Color class can be enhanced by adding the readonly modifier to the static fields:
class Color
260 / 318
redPart = red;
bluePart = blue;
greenPart = green;
261 / 318
What is a constant?
Constants are permitted to depend on other constants within the same program as long as there are no circular dependencies.
The example
262 / 318
class Constants
Even though constants are considered static members, a constant declaration neither requires nor allows the static modifier. Constants can be accessed through the class, as in
class Test
263 / 318
What is a method?
Ans : A method is a member that implements a computation or action that can be performed by an object or class. Methods have a list of formal parameters (which may be empty), a return value (or void), and are either static or non-static.
Non-static methods, which are also called instance methods, are accessed through instances of the class.
264 / 318
Methods can be overloaded, which means that multiple methods may have the same name so long as they have unique signatures.
The signature of a method consists of the name of the method and the number, modifiers, and types of its formal parameters.
What is a Property ?
265 / 318
of an object or a class.
Both are named members with associated types, and the syntax for accessing fields and properties is the same. However, unlike fields, properties do not denote storage locations.
Instead, properties have accessors that specify the statements to be executed when their values are read or written.
Ans : It suffices to simply state that a delegate is the object-oriented (and type-safe) equivalent of a function pointer.
266 / 318
Events are special constructs declared on a class that help to expose state changes to interested objects at run time.
An event represents a formal abstraction (supported by the CLR and various compilers)
of the registration, unregistration, and notification methods we used previously to implement the Observer pattern.
When the event is raised, all registered delegates are invoked so that they receive notification of the event.
2)What is response.buffer
267 / 318
16)what is the step to be done before making an instance of excel file using server.createobject
268 / 318
Database:
What is a cursor.
What is clustering
What is indexing
Types of indexes
269 / 318
ASP:
Types of objects
Types of authentication
C#:
CLR features
270 / 318
Memory management
Remoting concept
Webservices concept
271 / 318
Java:
RMI concepts
Multithreading concepts
272 / 318
Oops:
Difference between abstract classes and interfaces (Descriptive answer with example)
What is polymorphism
273 / 318
Patterns:
Types of Patterns
UML:
274 / 318
xMLXSL:
What is sort?
what is DTD?
what is xpath?
Advantages of oops?
what is inheritance,polymorphism?
275 / 318
.net features?
what is normalisation?
advantages of normalisation?
ado.net architecture?
276 / 318
7)what is the best form of validation (server side and client side)
10)what is the diff between sql 2000 and sql 7.0 in terms of triggers
1)What is usercontrols?
2)Can we have dynamic usercontrols and can we pass values from the usercontrols to the aspx pages?
277 / 318
10)what is web.config
14)threading
278 / 318
20)what is global assembly cache.how to put the components in the GAC and is there any steps before that
24)what is assembly
25)what is namespace and can we have nested namespace in a dll and where exactly the namespace is stored
279 / 318
30)oops,operator overloading(What happend when the return type is different and the signature is the same)
280 / 318
4)What is a join?what is the difference between inner joins and outer joins?
ASP
281 / 318
4)what are the ways on which we can access a COM component in an asp page?
COM/DCOM/COM+/MTS
282 / 318
5)Waht is COM+
283 / 318
XML/Schema/XSL
1)what is xml/schema/xsl?
.NET
1)what is an assembly?
284 / 318
4)What are the steps to be taken for porting a VB application to a VB.NET application?
1.
2.
3.
What is CTS?
4.
What is CLR?
5.
What are the presently available compilers of .NET (I know only JIT)
6.
8.
What is an Assembly?
285 / 318
9.
What is GAC?
10.
11.
12.
13.
How can we maintain .dll files with the same name in same folder?
14.
15.
16. I dont want to put an assembly in GAC. I put it in directory D:. How can I use it in multiple applications?
17.
18.
19.
286 / 318
20.
21. What is difference between Interface & Delegate?(With out any hesitance, I told him...that these two are not at all comparable. Two are different concepts. He argued with me. I think I was right)
22.
23.
24.
25.
26.
27.
28.
29. I have three different web applications. In all three I want to use same user control. Do I need to put .ASCX file in all applications? If no, where should I put?
30.
287 / 318
31. Is your own control in ASPX visible in Tool Box of Editor? (Answer: Yes, If we make custom control it will be visible by adding reference to it)
32.
33.
34.
35. I have more than one application. All applications have same settings. So Do you want me to write WEB.Config file for each application? If NO, where do I need to put my WEB.COnfig file?
36. I dont want to place my WEB.Config in application path. I'll put it in some directory. Can I do this?
37. Explain how do you do Forms authentication? (I explained him all the code and Implementation)
38.
39.
40.
41.
288 / 318
42.
43. Can I write Code behind file for the WEb.Config?( Ready with Machine.Config and Security.Config files also. He may ask them. Because I explained them even he is not asked.)
44.
What is reflection?
45.
46.
47.
What is Serialization?
48.
49.
50. Are U comfortable with XML?(I said yes. He not asked me any further regarding XML. Anyway prepare basics.)
51.
52.
What is the other name space we use connect to other databases? (Oledb)
289 / 318
53. Write Connection string for SQLConnection object.(remember --> Dont write Provider in the conn string)
54.
55.
56. U worked for 3 years on MS Tech. How confident u r in MTS? ( I said , I Used it but I dont have theoritcal knowledge. I used it in ASP applications to register a DLL)
57. Study about Interface, Inheritance, OverLoad and OverRide. He asked different simple q uestions on these.
58. What types of sessions we have in ASP.NET? (I dont know. Look at Cookie sessions, Cokkieless sessions).
59.
60.
290 / 318
One important point which I noticed was that, he was asking me whether I was sure about the answer very often to find that I am not bookish.
Q. Brief about yourself and about the roles and responsibilities for the past 1-2 years.
A. I explained him about my last project and the technologies involved and what was I doing off late (pre-sales activities like estimation etc., involved in the design of a Biztalk to SAP adapter project, have formed a team to do research on Tablet-PC to present a paper in Tech forum)
A. Value types are built-in data types in any .Net compliant language and they are stored on the application stack, whereas the Object types are user-defined types and are by default reference types and will be stored in the managed heap.
291 / 318
Note: A thread of discussion started here to know the depth of my understanding about the stack and heap implementation in .NET. This discussion went on for more than 12 minutes. Basically he wanted to know memory is managed in .NET by the CLR or runtime.
A. Value types are used for temporary storage. They are valid only in the scope of the function or the execution block in which they are declared. Whereas the reference types are used for user-defined types which need to retain the state across function calls and have a lifetime which is defined by the usage.
Note: I also explained him about the Garbage collection mechanism here and how GC works: Application roots, marking for removal, Compaction and Finalization etc.
292 / 318
Q. Given an unsigned 16 bit integer, what is the max value it can hold?
A. 65535
Q. What happens if I store more than max value in the previous scenario?
A. In .Net this scenario can be addressed in two ways: If the same is done in a checked context, the runtime will throw an OverflowException, whereas if run in unchecked context, the MSB is truncated and rest of the value is stored in the variable and the execution continues
Note: He asked whether I was sure about this and I said, yes. But he said Check this out to-night and you will be surprised to see the result. Which in fact I did and didnt find any surprise. May be theres some undocumented feature of .NET here.
293 / 318
A. 7-8.
A. Inheritance is a generalization relationship, used for code reuse. I cited an example of Shape as the base class and Circle, Rectangle as the derived classes. Explained him about generalization to specialization.
Composition is a strong form of containment, where the parts lifetime is dependent on the whole. Cited and example.
Q. What is polymorphism?
294 / 318
Q. Given a base class reference to a derived class can you access the derived class methods?
A. Object Polymorphism in other words: Cited the same shape ?Circle example and explained the behavior.
A. ADO.NET components. Connection, Command, DataReader, DataSet and DataView. Explained each.
A. Certainly the performance will improve as the abstraction layers are removed.
295 / 318
A. In a clustered-index, the data page and the index page are same whereas in a non-clustered index, the data pages and the index page is separate.
A. Left outer join will also involve the fields of the table on the left of the join query that are not specified in the SQL query.
Right outer join will also involve the fields of the table on the right of the join query that are not specified in the SQL query.
A. Execution plans are formed by the database engine to find the optimized way of executing a
296 / 318
A. What is the project all about? What stage it is in right now? What will be my role in the project?
He upfront informed me that he had a question before the interview starts and asked me whether I had VB knowledge. Since I didn't have any VB experience, I informed him about the same and briefed him about my skillset (VC++, C++, C#, COM etc.,). He was in a opinion that there was a miscommunication regarding job description and there is no point in continuing the interview
01.
What is GAC?
297 / 318
02.
Why GAC?
03.
04.
05.
06.
Types assemblies?
07.
08.
09.
10.
11.
How many boxing and unboxing operations happen in the below code
int32 i;
298 / 318
object o=i;
Console.WriteLine(i + , + int32(o));
12.
13.
14. If there are two similar connection strings with different passwords, how many connection pools will be there?
15.
16.
17.
18.
19.
20.
What is type safe language? How would you enforce type safety in .NET?
21.
299 / 318
22.
23.
24. A datasource is connected to DGrid. Do we need to rebind the datagrid if the datasource changes?
Analytical Question
1. We got 3 sealed boxes one with Red other with Blue and the other with Green balls. Each box has a label denoting the color of the balls that it contains. But the labels for all the boxes r pasted wrongly. Now how many boxes should u open to find the color of balls in all the 3 boxes?
Ans: 1
2)what is response.buffer
300 / 318
301 / 318
16)what is the step to be done before making an instance of excel file using server.createobject
Database:
What is a cursor.
302 / 318
What is clustering
What is indexing
Types of indexes
ASP:
Types of objects
Types of authentication
303 / 318
C#:
CLR features
Memory management
Remoting concept
304 / 318
Webservices concept
Java:
RMI concepts
Multithreading concepts
305 / 318
Oops:
What is polymorphism
Different keywords and thier access types static variables and static methos.
306 / 318
Patterns:
Types of Patterns
UML:
xMLXSL:
307 / 318
What is sort?
what is DTD?
what is xpath?
Advantages of oops?
what is inheritance,polymorphism?
.net features?
what is normalisation?
advantages of normalisation?
308 / 318
ado.net architecture?
dataset
309 / 318
client side)
10)what is the diff between sql 2000 and sql 7.0 in terms of
triggers
1)What is usercontrols?
2)Can we have dynamic usercontrols and can we pass values from the usercontrols to the aspx pages?
310 / 318
10)what is web.config
14)threading
311 / 318
20)what is global assembly cache.how to put the components in the GAC and is there any steps before that
24)what is assembly
25)what is namespace and can we have nested namespace in a dll and where exactly the namespace is stored
312 / 318
30)oops,operator overloading(What happend when the return type is different and the signature is the same)
overiding
object
313 / 318
314 / 318
ASP
4)what are the ways on which we can access a COM component in an asp page?
315 / 318
COM/DCOM/COM+/MTS
5)Waht is COM+
316 / 318
XML/Schema/XSL
1)what is xml/schema/xsl?
.NET
1)what is an assembly?
317 / 318
4)What are the steps to be taken for porting a VB application to a VB.NET application?
318 / 318