ASP Interview Question and Answers
How can you disable the browser
to view the code?
We can use Query string to secure our page...... from
unauthorized person
What is a "Virtual
Directory"?
Virtual directories
are aliases for directory paths on the server.
It allows moving files on the disk between different folders,
drives or even servers without changing the structure of web pages. It avoids
typing an extremely long URL each time to access an ASP
page.
What is the maximum size of an
array?]
Up to 60 dimensions
What is Collection?
Collection is a set of name/value pairs where the
information supplied by the client is stored.
What is Request Object?
It gets information from the user. It has five collections
by which values can be accessed. They are: Query string, Form, Cookies, Server
Variables & Client Certificate.
What is Extranet?
Extranet is an area of a web site
available only to a set of registered visitors.
What are the collections of Application
Object?
* Contents collection? Contains all variables added via
scripts in global.asa.
* Static collection? Contains the names of all objects added via the
<OBJECT> tag in global.asa.
Which is the default Scripting
Language of ASP (server-side)?
VBScript
What is Query string collection?
This collection stores any values that are provided in the
URL. This can be generated by three methods:
By clicking on an anchor tag <A>
by sending a form to the server by the GET method
through user-typed HTTP address
What are the ASP
Scripting Objects?
The Dictionary object, the FileSystemObject object, Text
Stream objects
How many global.asa files can an
Application
have?
Only one global.asa file and it’s placed in the virtual
directory’s root.
When does the application
On End event handler fire?
A. After every request for an application document, since
web servers
are stateless servers.
B. As soon as there are no open connections to any application document.
C. When the web server
is stopped in an orderly fashion.
(Answer)
D. Twenty minutes after the last request for a document in the application.
E. When there are no application requests for the amount of time defined by the
Session Timeout variable.
What is a variable?
Variable is a memory location through which the actual
values are stored/retrieved. Its value can be changed.
Explain the POST & GET
Method or explain the difference between them?
POST METHOD:
The POST method generates a FORM collection, which is sent as a HTTP request
body. All the values typed in the form will be stored in the FORM collection.
GET METHOD:
The GET method sends information by appending it to the URL (with a question
mark) and stored as A Querystring collection. The Querystring collection is
passed to the server as name/value pair.
The length of the URL should be less than 255 characters.
What is Server Variables
collection?
The Server Variables collection holds the entire HTTP
headers and also additional items of information about the server.
How to include Active x controls
in ASP code?
You can include Activex Control
using OBJECT tag.
Syntax for including Activex control is...
<OBJECT id="id1" clsid ="give class id here"
codebase="path spec for activex
ocx"></OBJECT>
What is a Form collection?
The Form collection holds the values of the form elements
submitted with the POST method. This is the only way to generate a Form
collection.
What is the difference between
client-side script and server-side script?
Scripts executed only by the browser without contacting the server
are called as client-side script. It is browser dependent. The scripting code
is visible to the user and hence not secure. Scripts executed by the web server
. And processed by the server is called server-side script.
How to handle Error in ASP
A. Using On Error Goto <ErrorPart>
B. Using On Error Resume
C. Using On Error Resume
Next (Answer)
D. Using On Error Goto 0
How to Display images using
Response object?
A. Contenttype=Application/Brush
B. Contenttype=Image/JPG (Answer)
C. Contenttype=Application/paint
D. Contenttype=Image/WMF
What is Application-scope?
Application-scope means that variables (and objects) can be
accessed from any ASP
pages that are part of the application.
What is Server Object?
Server Object controls the ASP execution environment.
It can set the amount of time script can run before an error occurs. It
converts a virtual path to a physical path on the server.
Takes a user supplied string and encode it into proper format for a URL string.
How will you delete a Cookie?
By setting its Expires property to any date
prior to today Response.Cookies ("cookie name").Expires = Date? 1.
What are the attributes of the
<FORM> tags? What are their functions?
The two attributes are ACTION and METHOD
The ACTION gives the name of the ASP
file that should be opened next by which this file can access the information
given in the form
The METHOD determines which of the two ways (POST or GET) the browser can send
the information to the server
What is a Scripting Language?
It permits to create more interactive Web Pages. Validation,
formatting of web pages can be done. VBScript, JavaScript
are some examples.
What does Internet Information Server
(IIS) assume to be the default language for Active Server Pages?
A. Jscript
B. JavaScript
C. JAVA
D. VBScript
E. ECMAScript
Name the ASP
Objects?
1. Session Object
2. Application
Object
3. Server Object
4. Request Object
5. Response Object
6. Object Context
7. Error Object
What are the methods in Session
Object?
The Session Object has only one method, which is Abandon. It
destroys all the objects stored in a Session Object and releases the server
resources they occupied.
How can you change the primary
scripting language for a page?
Specify <%@ LANGUAGE = Scripting language %>
What is Server-Side includes?
It provides extra information by which it makes the site
easier to manage. It can include text files using the #include statement,
retrieve the size and last modification date
of a file, defines how variables and error messages
are displayed and inserts the values of HTTP variables in the page sent back to
the browser.
What is the difference between
Server-side validation and Client-side validation?
Client-side is faster than server-side as the networking
time from client to server
is saved
server-side is done on the server. Then the server converts the data into an
html page and sends to the browser. Server-side is more secure as the user
cannot see the code even he does a view-source.
What are the differences between
ASP and ASP.NET and is ASP.NET backward compatible to ASP?
ASP page is non compiled version i.e. the ASP compiler
(interpreter) executes each line of ASP page when the request for a particular
page is made, where as ASP.NET page is the pre-compiled version. When we
compile the ASP.NET page, the .NET compiler compiles the ASP.NET
page to the UI assembly.
What is an Err Object?
The ASP Error object is used to display detailed information
of any error that occurs in scripts in an ASP
page.
What are the event handlers of
Session Object?
Session _On Start? This event will be fired when a new user
begins a session with the web
site.
Session_OnEnd? This event is called whenever a session terminates.
What is the difference between
Cookies collection and Form/Querystring collection?
Cookie collection does not have the Count property.
Cookies can have multiple values for the same cookie name but each value can be
referred using a key whereas in a Form/Querystring cookie each value has to be
referred using an index value.
What is an .ASP file?
It is a Text File that contains the combination of the
following:
Text
HTML tags
Script Commands
What purpose is served by the
Application.Lock method?
A. It locks the Application
object, preventing other clients from altering any values in the Contents
collection. (Answer)
B. It locks the application, preventing the server from responding to any
requests for application documents.
C. It locks the application, preventing non-SSL requests from being processed.
D. It locks the Application object, preventing other clients from reading any
values in the Content collection.
E. It locks other clients from reading the Contents collection.
What is Global.asa file?
It is text file that contains details about an ASP application,
such as when it should begin and end.
What is ASP (Active Server
Pages)?
ASP is a server side-scripting environment
for building dynamic and interactive web pages. Since the scripts run on the server
side, the web server does all the processing.
An ASP file can contain text, HTML tags
. And scripts. Scripts in an ASP file are executed on the
server.
How Many Types of Cookies?
3
What is Session Object?
It stores information about a User’s session. It gives a
notification when a user session begins or ends.
What are LOCAL and GLOBAL
variables?
Local variables lifetime ends when the Procedure ends.
Global variables lifetime begins at the start of the script and ends at the end
of the script and it can be used by any procedure within the script. Declaring
a variable by using the keyword PRIVATE makes the variable global within the
script, but if declared using PUBLIC, then all scripts can refer the variable.
What are the tasks performed by
<FORM> tags?
<FORM> tags provides space for the user to input
values
the form has a button to submit information back to the server
It transfers control to another ASP
page
It carries the information in the fields to another ASP page
Which is the default Data types
in VBScript?
Variant is the default data type in VBScript, which can
store a value of any type.
What are Scripting Objects?
Objects that can enhance the application
are known as the Scripting Objects.
What is Response Object?
It controls the information sent to the user. The various
methods are:
Response.Write? Sends information directly to a browser
Response.Redirect? Directs a user to a URL other than the requested URL
Response.ContentType? Controls the type of content sent
Response.Cookies? Sets cookie values
Response.Buffer? To Buffer information
The ASP Response object is used to send output to the
user from the server.
What happens to ASP
pages?
The browser makes a HTTP request; the server
does the processing and gives a HTML response to the browser.
The browser makes a HTTP request; the server does the
processing and gives a HTML page to the browser.
Can be Arrays resized by using
the keyword REDIM?
Yes, we can resize using the word redim.
What is the function of Buffer
in Response Object?
Buffer controls the HTML output stream manually.
What is the command to display
characters to the HTML page?
Typically, a servlet class is instantiated the first time it
is invoked. The same instance will be used over several client requests, so all
members that are declared in that servlet are shared across clients. That is What
is meant by multi threaded model, multiple clients that access the same
instance.
There are situations where you want to protect your servlet member variables
from being modified by different clients. In this case, you can have your
servlet implement the marker
interface SingleThreadModel. Every time a client makes a request to a servlet
that implements this interface, the engine will create a new instance of the
servlet. For performance
reasons, the engine can also maintain an instance pool, handing out instances
as they are needed. Or it could also serialize client requests, executing one
after another.
How to insert the records in a
database table by using ASP?
<%
'Open a Connection with database
Dim DSN
DSN="Provider=SQLOLEDB.1; Persist security
info=false; user id=sa; password=main; initial catalog=database name Data
Source=localhost"
set objCon=Server.CreateObject("ADODB.Connection")
objCon.Open DSN
%>
<%
'Get the Query
Dim SQL
SQL="insert into tablename values('a','b','c')"
%>
<%
'Insert Into Database
objCon.Execute(SQL)
%>
What is http header?
HTTP headers expose a great deal of information about your
client as well as the server you are working, the application
you are designing, as well as the environment
you are in (SSL, etc.).The functionality for this is held in
"Request.ServerVariables", so you only need to access that. For
example, Request.ServerVariables("ALL_HTTP") or
Request.ServerVariables("HTTP_USER_AGENT"). You need to know the
specific name of the header that you want. It is extremely simple to display
all the HTTP headers in ASP. Here's a code snippit that will do it for you:
< % for each header in Request.ServerVariables response.write header &
" = " & Request.ServerVariables (header) & " <
br>< br> " next % >Just delete the spaces near the angle
brackets and run it on IIS. You'll get a list of all the HTTP headers along
with the actual value for the header. Make sure to try this with different
browsers and on different computers with different operating systems if you
can. You'll immediately see the differences.
What is MSMQ?What is N-tier
System?
Microsoft Message Queuing is a
window's component.
Explain life cycle of ASP page.
Active server pages are executed with
the help of compiler and then it sent to the MSIL (MICROSOFT INTERMEDIATE
LANGUAGE) and then it is sent to cache memory and finally it will be executed
in the portable device. Cache will be used between the MSIL to increase the
speed of the process. This is the process of the ASP life cycle.
What are the tools used for editing in IIS?
The MetaEdit 2.2 utility is used to
help to troubleshoot issues and to modify IIS metabase values. MtaEdt22.exe
file is a downloadable, self-extracting file that contains the IIS MetaEdit 2.2
utility.
How to include Active x controls
in ASP code?
You can include Activex Control using OBJECT tag.
Syntax for including Activex control is-
<OBJECT id="id1" clsid ="give class id here"
codebase="path spec for activex ocx"></OBJEC
What are the special sub-types
in VBScript?
Subtype Explanation
Empty Variant is not initialized. Value is either zero
for numeric variables or a zero-length string ("") for string
variables.
Null Variant intentionally contains no valid data.
Boolean Contains either True or False.
Byte Contains integer in the range zero to 255
Integer Contains integer in the range -32,768 to 32,767
Long Contains integer in the range -2,147,483,648 to
2,147,483,647
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.
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 about 2 billion characters in length
Object Contains an OLE Automation object.
Error contains an error number.
Explain the POST & GET
Method or explain the difference between them.
Get: With the get method the value is
send thru the query string appended with the URL. So you can see the Name value
description on the address bar when the page display in the browser.
Post: This method transfer the information thru the
complete form. You can not see the detail description on the address bar. When
the page display.
What is the command to display characters to the HTML page?
<%="Hello World"%>
What is a variable?
Variable is a memory location through
which the actual values are stored/retrieved. Its value can be changed.
What is a File System Object object?
The File System Object is used to
access the file system on the server. This object can manipulate files,
folders, and directory paths. It is also possible to retrieve file system
information with this object.
What is IIS?
Internet Information System
What is a Scripting Language?
It’s a high-level programming language that is interpreted by another program at runtime rather than compiled by the
computer’s processor as other programming languages (such as C and C++) are Thesetypes of languages are client-side scripting languages, affecting the
data that the end user sees in a browser window.
What does Server.Map Path do?
The Map Path method maps the specified relative or virtual path to the
corresponding physical directory on the server.
Name at least three methods of response object other than
Redirect.
Add Header, Append To Log, Binary Write, Clear, End, Flush, Write
What is ASP?
ASP stands for Active Server Pages. It is a server side technology which is used to display dynamic
content on web pages. For example you could write code that would give your
visitors different information, different images or even a totally different
page depending on What browser version they are using.
How can you disable the browser to view the
code?
Writing codes within the Tag
Question What is a "Virtual
Directory"?
Virtual directories are aliases for directory paths on the server. It allows moving files on the disk
between different folders, drives or even servers without changing the
structure of web pages. It avoids typing an extremely long URL each time to
access an ASP page.
Give the comment Tags for the following?
VBScript: REM & ‘(apostrophe)
JavaScript: // (single line comment)
/* */ (Multi-line comments)
which is the default Scripting Language of ASP
(server-side)?
VBScript
which is the default Data types in VBScript?
Variant is the default data type in VBScript, which can store a value of any
type.
What is a variable?
Variable is a memory location through which the actual values are
stored/retrieved. Its value can be changed.
What is the maximum size of an array?
Up to 60 dimensions.
What is Querystring collection?
This collection stores any values that are provided in the URL. This can be
generated by three methods:
By clicking on an anchor tag
by sending a form to the server by the GET method
through user-typed HTTP address
it allows you to extract data sent to the server using a GET request.
What are the attributes of the tags? What are
their functions?
The ACTION gives the name of the ASP file that should be opened next by which
this file can access the information given in the form The METHOD determines which
of the two ways (POST or GET) the browser can send the information to the
server
What are the methods in Session Object?
The Session Object has only one method, which is Abandon. It destroys all the
objects stored in a Session Object and releases the server resources they
occupied.
What is Server Variables collection?
The Server Variables collection holds the entire HTTP headers and also
additional items of information about the server.
What is a Form collection?
The Form collection holds the values of the form elements submitted with
the POST method. This is the only way to generate a Form collection.
What are the ASP Scripting Objects?
The Dictionary object, the FileSystemObject object, TextStream objects.
What happens to a HTML page?
The browser makes a HTTP request; the server gives a HTTP response to the
browser and the browser converts into a HTML page.
What happens to ASP pages?
The browser makes a HTTP request; the server does the processing and gives a
HTML response to the browser.
How can you change the primary scripting language for a page?
Specify
What is application
Object?
Shares information among users of an application. Gives a notification when an
application starts or ends.
What is the difference between client-side
script and server-side script?
Scripts executed only by the browser without contacting the server are called
client-side script. It is browser dependent. The scripting code is visible to
the user and hence not secure. Scripts executed by the web server and processed
by the server are called server-side script.
What is the command to display characters to
the HTML page?
Response.Write
Explain the POST & GET Method or Explain
the difference between them?
POST METHOD:
The POST method generates a FORM collection, which is sent as a HTTP request
body. All the values typed in the form will be stored in the FORM collection.
GET METHOD:
The GET method sends information by appending it to the URL (with a question
mark) and stored as A Querystring collection. The Querystring collection is
passed to the server as name/value pair.
The length of the URL should be less than 255 characters.
How many global.asa files can an Application
have?
Only one global.asa file and it’s placed in the virtual directory’s root.
How many global.asa files can an Application
have?
Only one global.asa file and it’s placed in the virtual directory’s root.
What are Scripting Objects?
Objects that can enhance the application are known as the Scripting Objects.
What is the Order of precedence for LOGICAL
Operators.
NOT, AND, OR, XOR, EQV, IMP
What is an Err Object?
Name it’s properties and methods.
What are LOCAL and GLOBAL variables?
Local variables lifetime ends when the Procedure ends. Global variables
lifetime begins at the start of the script and ends at the end of the script
and it can be used by any procedure within the script. Declaring a variable by
using the keyword PRIVATE makes the variable global within the script, but if
declared using PUBLIC, then all scripts can refer the variable.
Which is the default Scripting Language on the
client side?
JavaScript
What is HTML (Hypertext Markup Language)?
It’s a method by which web pages can be built and generally used for formatting
and linking text.
What is a Web Server?
It’s a Computer that provides Web services on the Internet or on a local Intranet. It is
designed to locate, address and send out simple HTML pages to all other users
who access these pages.
What is Session Object?
It stores information about a User’s session. Gives a notification when a user
session begins or ends.
What is Server-Side includes?
It provides extra information by which it makes the site easier to manage. It
can include text files using the #include statement, retrieve the size and last
modification date of a file, define how variables and error messages are
displayed and insert the values of HTTP variables in the page sent back to the
browser.
What is a FileSystemObject object?
It provides access to the physical file system of the web server. It gets and
manipulates information about all drives in a server, folders and sub-folders
on a drive and files inside a folder.
What is a Scripting Language?
It permits to create more interactive Web Pages. Validation, formatting of web
pages can be done. VBScript, JavaScript are some examples.
What is a Dictionary object?
It lets you store and retrieve information in a flexible data structure. Each
value or information stored in a Dictionary is associated with a key through
which the information can be retrieved.
What is Global.asa file?
It is text file that contains details about an ASP application, such as when it
should begin and end.
What is an .ASP file?
It is a Text File that contains the combination of the following:
Text
HTML tags
Script Commands
What is Response Object?
It controls the information sent to the user. The various methods are:
Response.Write - Sends information directly to a browser
Response.Redirect - Directs a user to a URL other than the requested URL
Response.ContentType - Controls the type of content sent
Response.Cookies - Sets cookie values
Response.Buffer - To Buffer information
Naming constraints for a variable ?
It can be up to 255 characters must start with an alphabet must not contain an
embedded period or full-stop
What is a TextStream object?
It allows you to access(read/write) the contents of text files stored on the
web server.
What is IIS?
IIS is a Web Server that provides Web services, not only for web pages but also
for ftp sites and video and audio services. It integrates with the database facilities of SQL Server.
What is Request Object?
Gets information from the user. It has five collections by which values can be
accessed. They are: Querystring, Form, Cookies, Server Variables & Client
Certificate
What are the special sub-types in VBScript?
EMPTY: has no value
NULL: Value does not exist (conjunction with database)
OBJECT:
What is Cookies collection?
Cookies are text files that store information about the user by which the web
server identifies and marks each different visitor to a web site and determines
where a user has been before. A cookie can store information only when the user
sends it. Individual cookies are limited to 4KB of data. The maximum number of
cookies allowed is 300.
Cookies are stored on client’s machine.
What is the difference between Cookies
collection and Form/Querystring collection?
Cookie collection does not have the Count property. Cookies can have multiple
values for the same cookie name but each value can be referred using a key
whereas in a Form/Querystring cookie each value has to be referred using an
index value.
What is Server Object?
Controls the ASP execution environment. It can set the amount of time script
can run before an error occurs. Converts a virtual path to a physical path on
the server. Takes a user supplied string and encode it into proper format for a
URL string.
What is Collection?
Collection is a set of name/value pairs where the information supplied by the
client is stored.
How will you delete a Cookie?
By setting its Expires property to any date prior to today
Response.Cookies("cookie name"). Expires = Date 1.
What is the function of Buffer in Response
Object?
Buffer controls the HTML output stream manually.
How are scripts executed?
ASP provides scripting engines that execute the corresponding scripting
languages on the server side. Scripts should be encoded within the Delimiters.
What is ASP (Active Server Pages)?
ASP is a server side-scripting environment for building dynamic and interactive
web pages. Since the scripts run on the server side, the web server does all
the processing.
What are ARRAYS?
Arrays are variables that store items of similar information. DIM ARRAY1(4)
(declares an array with the name array1 with 5 elements)
What is Application-scope?
Application-scope means that variables (and objects) can be accessed from any
ASP pages that are part of the application.
What is Extranet?
An area of a web site available only to a set of registered visitors.
What is a session?
A user accessing an application is known as a session.
What is ClientCertificate collection?
A ClientCertificate is an encrypted number that is stored in a file on the
user’s computer. These stores details of any security certificates included with the
request.
What do you need to run ASP?
A browser and a Web server
What is the order of execution for an ASP
application?
1) Global.asa
2) Server-side Includes
3) Jscript scripts tagged within
What are the types of HTML?
Static HTML Browser uses HTTP to request HTML file from the Web Server
Dynamic HTML Browser uses HTTP to request an executable application rather than
a Static HTML file
What are the properties of Session Object?
SessionID returns the session identification number for each user.
Timeout sets the timeout period assigned to the Session object for any
application, in minutes.
CodePage determines the code page that will be used to display content.
LCID a locale identifier, which determines time zone and language, rules for
the system
What are the event handlers of Session Object?
Session _On Start This event will be fired when a new user begins a session with
the web site.
Session_OnEnd This event is called whenever a session terminates.
Name the ASP Objects?
Request Object
Response Object
Server Object
Session Object
Application Object
What are the advantages of using ASP?
Minimizes network traffic by limiting the need for the browser and server to
talk to each other
Makes for quicker loading time since HTML pages are only downloaded
Allows to run programs in languages that are not supported by the browser
Can provide the client with data that does not reside on the client’s machine
Provides improved security measures since the script cannot be viewed by the
browser
What are the methods in Application Object?
Lock prevents clients from modifying the variables stored in the Application
object.
Unlock removes the lock from variables stored in the Application object.
What are the methods in Application Object?
Internet Information Server (IIS) on Windows NT
Personal Web Server (PWS) on Windows 95
Peer Web Services on Windows NT
What are the browsers that can access ASP
pages?
Internet Explorer (supports VBScript, JavaScript)
Netscape Communicator/ Navigator (supports only JavaScript, VBScript can be
also added too)
What are the methods by which output stream is
controlled?
Flush sends previous buffered output to the client immediately, but continues
processing the script.
Clear erases any already-buffered HTML.
End causes the server to stop processing the script.
What are the methods by which output stream is
controlled?
What are the properties used to control the expiration of the page?
Expires specifies the number of minutes before a page cached on a browser
expires.
Expires Absolute sets the date and time at which a page cached on a browser
expires.
What are the
collections of Session Object?
Contents collection contains all the variables established for a session
without using the tag.
Static collection contains all the objects created
What is the difference between ASP and HTML?
Or Why ASP is better than HTML?
- ASP executes code on the server side whereas the browser interprets HTML.
- ASP can use any scripting languages
- Gets feedback from the user and return information to the user
- Create pages that will be customized to display only things that will be of
interest to a particular user
- Can edit contents of a web page by updating a text file or a database rather
than the HTML code itself
What are the event handlers of Application
Object?
Application_OnStart- This event will be fired when the first visitor hits the
page.
Application_OnEnd- This event runs when the server is stopped.
Name some of the ASP components?
Ad Rotator component- a way to manage advertisements on the web site.
Content Linker component - a technique to direct users through a set of pages
on a web site by creating a list of URLs and description of the next and
previous pages.
Browser Capabilities component - allows to customize the page to the ability of
the browser viewing it.
Database Access component - allows to access data from the database
What are the tasks performed by <> tags?
tags provides space for the user to input
values
the form has a button to submit information back to the server
It transfers control to another ASP page
It carries the information in the fields to another ASP page
What are the tags necessary to be present
within the tag ?
-----tag: Provides input spaces (text boxes, combo boxes, radio button, etc.)
on a form called fields. It has three attributes TYPE, NAME and VALUE. TYPE
provides the characteristics of the field and the NAME specifies a name to the
field by which it can be referred.
What are the collections of Application
Object?
* Contents collection - contains all variables added via scripts in global.asa.
* Static collection - contains the names of all objects
How do you create a recordset object in
VBScript?
Answer1
//First of all declare a variable to hold the Recordset object, ex-
Dim objRs
//Now, Create this variable as a Recordset object, ex-
Set objRs=Server.CreateObject(ADODB.RECORDSET)
Answer2
” rs.MoveNext
wend
end if
%’>
*. Create Recordset object
*. Place form field value in a variable named “param”
*. Define query by concatenating strings and variable value
*. Open RecordSet Object. Note that the first parameter is the Command Text.
The second parameter is the Connection String. The Command Object and
Connection Object are created implicitly.
*. Make sure the RecordSet isn’t empty
*. Begin executing a loop which goes through all records in the RecordSet.
*. Write each record’s “firstname” and “lastname” fields to the page on a
separate line.
*. Move to Next Record.
Explain the difference between POST and GET
Method.
GET requests are string data that is visible to the end user via the URL and a
limit of 2kb, POST requests have no limit on total data and the user can’t see
the data in a query string.
Why do we use Option Explicit?
Answer1
to avoid multiple variables of the same name.
Answer2:
Correct answer is - This statement forces the declaration of variables in VB
before using them.
How do you write an SQL insert statement?
insert into tablename (field, fieldB, fieldC)Values(’dataA’, ‘dataB’, ‘dataC’);
How can you have different number of cells for
each row of a table in HTML?
Using colspan and rowspan
What variable can you use to share info across
the whole application for one user?
Use the sessions object
What is string concatenation function in
VBScript?
The ampersand symbol and ampersand space underscore across multiple lines
how do you get the value of a combo box in Javascript?
Answer1.
Document. Forms [’forename’].elements[’combo Name’].options[I].value
Answer2.
document.form_name.element_name.value
What is a class in CSS?
Answer1
A class allows you to define different style characteristics to the same HTML
element.
Answer2
class is a child to the id, id should be used only once, a css class can be
used multiple times:
div id=”banner”
p class=”alert”
When inserting strings into a SQL table in ASP
What is the risk and how can you prevent it?
SQL Injection, to prevent you probably needs to use Stored Procedures instead
of inline/incode SQL
Difference between SAP R/2 and R/3
1)R/2 runs on a mainframe, R/3 runs on Client / Server
2) R/3 has a GIU (thanks to windows) where as R/2 looks more like DOS
3)R/3 has more functionality than R/2 making it the preferable choice
4) SAP will support R/3 after 2004!
What are the stored procedure and why they are needed??
Stored Procedure is the Concept.Lot of Related sql Queries are Stored inside the Server Database.
The Queries are executed by the user explicitly. The Stored Procedure is used to make the sequence Transactions
File System Object is used to Create, delete, copy, move folders and files in web applications. To use this file system object we have to create object by using Server.CreateObject ("File System Object") command.
How to refresh an asp page on a single click of a button?
We can refresh an ASP page to press F5 key.
What is a Text Stream object?
It allows you to access [read/write] the contents of text files stored on the web server.
What is Server Object?
It Controls the ASP execution environment. It can set the amount of time script can run before an error occurs. It converts a virtual path to a physical path on the server. Takes a user supplied string and encode it into proper format for a URL string.
What’s the difference between
Response.Write() andResponse.Output.Write()?
Response.Output.Write() allows you to write formatted output.
What methods are fired during
the page load?
Init() - when the page is instantiated
Load() - when the page is loaded into server memory
PreRender() - the brief moment before the page is displayed to the user as HTML
Unload() - when page finishes loading.
When during the page
processing cycle is ViewState available?
After the Init() and before the Page_Load(), or OnLoad() for a control.
What namespace does the Web page
belong in the .NET Framework class hierarchy?
System.Web.UI.Page
Where do you store the
information about the user’s locale?
System.Web.UI.Page.Culture
What’s a bubbled event?
When you have a complex control, like DataGrid, writing an event processing
routine for each object (cell, button, row, etc.) is quite tedious. The
controls can bubble up their eventhandlers, allowing the main DataGrid event
handler to take care of its constituents.
Suppose you want a certain
ASP.NET function executed on MouseOver for a certain button.
Where do you add an event handler?
Add an OnMouseOver attribute to the button. Example: btnSubmit.Attributes.Add("onmouseover","someClientCodeHere();");
What data types does the
RangeValidator control support?
Integer, String, and Date.
Explain the differences between
Server-side and Client-side code?
Server-side code executes on the server. Client-side code
executes in the client's browser.
What type of code (server or
client) is found in a Code-Behind class?
The answer is server-side code since code-behind is executed on the
server. However, during the code-behind's execution on the server,
it can render client-side code such as JavaScript to
be processed in the clients browser. But just to be clear,
code-behind executes on the server, thus making it server-side code.
Should user input data
validation occur server-side or client-side? Why?
All user input data validation should occur on the server at a
minimum. Additionally, client-side validation can be performed where
deemed appropriate and feasable to provide a richer, more responsive experience
for the user.
What is the difference between
Server.Transfer and Response.Redirect? Why would I choose one over the
other?
Server.Transfer transfers page processing from one page directly
to the next page without making a round-trip back to the client's
browser. This provides a faster response with a little less overhead on
the server. Server.Transfer does not update the clients url
history list or current url. Response.Redirect is used to redirect
the user's browser to another page or site. This performas a trip
back to the client where the client's browser is redirected to the new
page. The user's browser history list is updated to reflect the new
address.
Can you explain the difference
between an ADO.NET Dataset and an ADO Recordset?
Valid answers are:
· A DataSet can represent an entire relational database in memory,
complete with tables, relations, and views.
· A DataSet is designed to work without any continuing connection to the
original data source.
· Data in a DataSet is bulk-loaded, rather than being loaded on demand.
· There’s no concept of cursor types in a DataSet.
· Datasets have no current record pointer you can use For Each loops to
move through the data.
· You can store many edits in a DataSet, and write them to the original
data source in a single operation.
· Though the DataSet is universal, other objects in ADO.NET come in
different versions for different data sources.
What is the Global.asax
used for?
The Global.asax (including the Global.asax.cs file) is used to implement
application and session level events.
What are the
Application_Start and Session_Start subroutines used for?
This is where you can set the specific variables for the Application and
Session objects.
Can you explain What inheritance
is and an example of when you might use it?
When you want to inherit (use the functionality of) another class.
Example: With a base class named Employee, a Manager class could be
derived from the Employee base class.
What is an assembly?
Assemblies are the building blocks of the .NET framework.
Overview of assemblies from MSDN
Describe the difference between
inline and code behind.
No, it just reads the information from its data source.
What property must you set, and What
method must you call in your code, in order to bind the data from a data
source to the Repeater control?
You must set the Data Source property and call the Data Bind method.
What base class do all Web Forms
inherit from?
The Page class
Name two properties common in
every validation control?
Control to validate property and Text property
Which property on a Combo Box do
you set with a column name, prior to setting the Data Source, to display data
in the combo box?
Data Text Field property
Which control would you use if
you needed to make sure the values in two different controls matched?
Compare Validator control.
How many classes can a single .NET DLL contain?
It can contain many classes.
What is ViewState?
ViewState allows the state of objects (serializable) to be
stored in a hidden field on the page. ViewState is transported to the
client and back to the server, and is not stored on the server or any other external
source. ViewState is used the retain the state of server-side objects
between postabacks.
What is the lifespan for
items stored in ViewState?
Item stored in ViewState exist for the life of the current
page. This includes postbacks (to the same page).
What does the
"EnableViewState" property do? Why would I want it on or off?
It allows the page to save the users input on a form across
postbacks. It saves the server-side values for a given control into
ViewState, which is stored as a hidden value on the page before sending the
page to the clients browser. When the page is posted back to the
server the server control is recreated with the state stored in
viewstate.
What are the different
types of Session state management options available with ASP.NET?
ASP.NET provides In-Process and Out-of-Process state
management. In-Process stores the session in memory on the web
server. This requires the "sticky-server" (or no
load-balancing) so that the user is always reconnected to the same web server.
Out-of-Process Session state management stores data in an external data
source. The external data source may be either a SQL Server or a State
Server service. Out-of-Process state management requires that all objects
stored in session are serializable.
What is the common type system (CTS)?
The common type system is a rich type system, built into the common language runtime that supports the types and operations found in most programming languages. The common type system supports the complete implementation of a wide range of programming languages.
What is the Common Language Specification (CLS)?
The Common Language Specification is a set of constructs and constraints that serves as a guide for library writers and compiler writers. It allows libraries to be fully usable from any language supporting the CLS, and for those languages to integrate with each other. The Common Language Specification is a subset of the common type system. The Common Language Specification is also important to application developers who are writing code that will be used by other developers. When developers design publicly accessible APIs following the rules of the CLS, those APIs are easily used from all other programming languages that target the common language runtime.
What is the Microsoft Intermediate Language (MSIL)?
MSIL is the CPU-independent instruction set into which .NET Framework programs are compiled. It contains instructions for loading, storing, initializing, and calling methods on objects.
Combined with metadata and the common type system, MSIL allows for true cross-language integration.
Prior to execution, MSIL is converted to machine code. It is not interpreted.
What is managed code and managed data?
Managed code is code that is written to target the services of the common language runtime (see What is the Common Language Runtime?). In order to target these services, the code must provide a minimum level of information (metadata) to the runtime. All C#, Visual Basic .NET, and Script .NET code is managed by default. Visual Studio .NET C++ code is not managed by default, but the compiler can produce managed code by specifying a command-line switch (/CLR).
Closely related to managed code is managed data—data that is allocated and de-allocated by the common language runtime's garbage collector. C#, Visual Basic, and JScript .NET data is managed by default. C# data can, however, be marked as unmanaged through the use of special keywords. Visual Studio .NET C++ data is unmanaged by default (even when using the /CLR switch), but when using Managed Extensions for C++, a class can be marked as managed by using the __gc keyword. As the name suggests, this means that the memory for instances of the class is managed by the garbage collector. In addition, the class becomes a full participating member of the .NET Framework community, with the benefits and restrictions that brings. An example of a benefit is proper interoperability with classes written in other languages (for example, a managed C++ class can inherit from a Visual Basic class). An example of a restriction is that a managed class can only inherit from one base class.
What are private assemblies and shared assemblies?
A private assembly is used only by a single application, and is stored in that application's install directory (or a subdirectory therein). A shared assembly is one that can be referenced by more than one application. In order to share an assembly, the assembly must be explicitly built for this purpose by giving it a cryptographically strong name (referred to as a strong name). By contrast, a private assembly name need only be unique within the application that uses it.
By making a distinction between private and shared assemblies, we introduce the notion of sharing as an explicit decision. Simply by deploying private assemblies to an application directory, you can guarantee that that application will run only with the bits it was built and deployed with. References to private assemblies will only be resolved locally to the private application directory.
There are several reasons you may elect to build and use shared assemblies, such as the ability to express version policy. The fact that shared assemblies have a cryptographically strong name means that only the author of the assembly has the key to produce a new version of that assembly. Thus, if you make a policy statement that says you want to accept a new version of an assembly, you can have some confidence that version updates will be controlled and verified by the author. Otherwise, you don't have to accept them.
For locally installed applications, a shared assembly is typically explicitly installed into the global assembly cache (a local cache of assemblies maintained by the .NET Framework). Key to the version management features of the .NET Framework is that downloaded code does not affect the execution of locally installed applications. Downloaded code is put in a special download cache and is not globally available on the machine even if some of the downloaded components are built as shared assemblies.
The classes that ship with the .NET Framework are all built as shared assemblies.
If I want to build a shared assembly, does that require the overhead of signing and managing key pairs?
Building a shared assembly does involve working with cryptographic keys. Only the public key is strictly needed when the assembly is being built. Compilers targeting the .NET Framework provide command line options (or use custom attributes) for supplying the public key when building the assembly. It is common to keep a copy of a common public key in a source database and point build scripts to this key. Before the assembly is shipped, the assembly must be fully signed with the corresponding private key. This is done using an SDK tool called SN.exe (Strong Name).
Strong name signing does not involve certificates like Authenticode does. There are no third party organizations involved, no fees to pay, and no certificate chains. In addition, the overhead for verifying a strong name is much less than it is for Authenticode. However, strong names do not make any statements about trusting a particular publisher. Strong names allow you to ensure that the contents of a given assembly haven't been tampered with, and that the assembly loaded on your behalf at run time comes from the same publisher as the one you developed against. But it makes no statement about whether you can trust the identity of that publisher.
What is the difference between a namespace and an assembly name?
A namespace is a logical naming scheme for types in which a simple type name, such as MyType, is preceded with a dot-separated hierarchical name. Such a naming scheme is completely under the control of the developer. For example, types MyCompany.FileAccess.A and MyCompany.FileAccess.B might be logically expected to have functionality related to file access. The .NET Framework uses a hierarchical naming scheme for grouping types into logical categories of related functionality, such as the Microsoft® ASP.NET application framework, or remoting functionality. Design tools can make use of namespaces to make it easier for developers to browse and reference types in their code. The concept of a namespace is not related to that of an assembly. A single assembly may contain types whose hierarchical names have different namespace roots, and a logical namespace root may span multiple assemblies. In the .NET Framework, a namespace is a logical design-time naming convenience, whereas an assembly establishes the name scope for types at run time.
What options are available to deploy my .NET applications?
The .NET Framework simplifies deployment by making zero-impact install and XCOPY deployment of applications feasible. Because all requests are resolved first to the private application directory, simply copying an application's directory files to disk is all that is needed to run the application. No registration is required.
This scenario is particularly compelling for Web applications, Web Services, and self-contained desktop applications. However, there are scenarios where XCOPY is not sufficient as a distribution mechanism. An example is when the application has little private code and relies on the availability of shared assemblies, or when the application is not locally installed (but rather downloaded on demand). For these cases, the .NET Framework provides extensive code download services and integration with the Windows Installer. The code download support provided by the .NET Framework offers several advantages over current platforms, including incremental download, code access security (no more Authenticode dialogs), and application isolation (code downloaded on behalf of one application doesn't affect other applications). The Windows Installer is another powerful deployment mechanism available to .NET applications. All of the features of Windows Installer, including publishing, advertisement, and application repair will be available to .NET applications in Windows Installer 2.0.
I've written an assembly that I want to use in more than one application. Where do I deploy it?
Assemblies that are to be used by multiple applications (for example, shared assemblies) are deployed to the global assembly cache. In the prerelease and Beta builds, use the /i option to the GACUtil SDK tool to install an assembly into the cache:
gacutil /i myDll.dll
Windows Installer 2.0, which ships with Windows XP and Visual Studio .NET will be able to install assemblies into the global assembly cache.
How can I see What assemblies are installed in the global assembly cache?
The .NET Framework ships with a Windows shell extension for viewing the assembly cache. Navigating to % windir%\assembly with the Windows Explorer activates the viewer.
What is an application domain?
An application domain (often AppDomain) is a virtual process that serves to isolate an application. All objects created within the same application scope (in other words, anywhere along the sequence of object activations beginning with the application entry point) are created within the same application domain. Multiple application domains can exist in a single operating system process, making them a lightweight means of application isolation.
An OS process provides isolation by having a distinct memory address space. While this is effective, it is also expensive, and does not scale to the numbers required for large web servers. The Common Language Runtime, on the other hand, enforces application isolation by managing the memory use of code running within the application domain. This ensures that it does not access memory outside the boundaries of the domain. It is important to note that only type-safe code can be managed in this way (the runtime cannot guarantee isolation when unsafe code is loaded in an application domain).
What is garbage collection?
Garbage collection is a mechanism that allows the computer to detect when an object can no longer be accessed. It then automatically releases the memory used by that object (as well as calling a clean-up routine, called a "finalizer," which is written by the user). Some garbage collectors, like the one used by .NET, compact memory and therefore decrease your program's working set.
How does non-deterministic garbage collection affect my code?
For most programmers, having a garbage collector (and using garbage collected objects) means that you never have to worry about deallocating memory, or reference counting objects, even if you use sophisticated data structures. It does require some changes in coding style, however, if you typically deallocate system resources (file handles, locks, and so forth) in the same block of code that releases the memory for an object. With a garbage collected object you should provide a method that releases the system resources deterministically (that is, under your program control) and let the garbage collector release the memory when it compacts the working set.
Can I avoid using the garbage collected heap?
All languages that target the runtime allow you to allocate class objects from the garbage-collected heap. This brings benefits in terms of fast allocation, and avoids the need for programmers to work out when they should explicitly 'free' each object.
The CLR also provides What are called ValueTypes—these are like classes, except that ValueType objects are allocated on the runtime stack (rather than the heap), and therefore reclaimed automatically when your code exits the procedure in which they are defined. This is how "structs" in C# operate.
Managed Extensions to C++ lets you choose where class objects are allocated. If declared as managed Classes, with the __gc keyword, then they are allocated from the garbage-collected heap. If they don't include the __gc keyword, they behave like regular C++ objects, allocated from the C++ heap, and freed explicitly with the "free" method.
How do in-process and cross-process communication work in the Common Language Runtime?
There are two aspects to in-process communication: between contexts within a single application domain, or across application domains. Between contexts in the same application domain, proxies are used as an interception mechanism. No marshaling/serialization is involved. When crossing application domains, we do marshaling/serialization using the runtime binary protocol.
Cross-process communication uses a pluggable channel and formatter protocol, each suited to a specific purpose.
If the developer specifies an endpoint using the tool soapsuds.exe to generate a metadata proxy, HTTP channel with SOAP formatter is the default.
If a developer is doing explicit remoting in the managed world, it is necessary to be explicit about What channel and formatter to use. This may be expressed administratively, through configuration files, or with API calls to load specific channels. Options are:
HTTP channel w/ SOAP formatter (HTTP works well on the Internet, or anytime traffic must travel through firewalls)
TCP channel w/ binary formatter (TCP is a higher performance option for local-area networks (LANs))
When making transitions between managed and unmanaged code, the COM infrastructure (specifically, DCOM) is used for remoting. In interim releases of the CLR, this applies also to serviced components (components that use COM+ services). Upon final release, it should be possible to configure any removable component.
Distributed garbage collection of objects is managed by a system called "leased based lifetime." Each object has a lease time, and when that time expires, the object is disconnected from the remoting infrastructure of the CLR. Objects have a default renew time-the lease is renewed when a successful call is made from the client to the object. The client can also explicitly renew the lease.
Can I use COM objects from a .NET Framework program?
Yes. Any COM component you have deployed today can be used from managed code, and in common cases the adaptation is totally automatic.
Specifically, COM components are accessed from the .NET Framework by use of a runtime callable wrapper (RCW). This wrapper turns the COM interfaces exposed by the COM component into .NET Framework-compatible interfaces. For OLE automation interfaces, the RCW can be generated automatically from a type library. For non-OLE automation interfaces, a developer may write a custom RCW and manually map the types exposed by the COM interface to .NET Framework-compatible types.
Can .NET Framework components be used from a COM program?
Yes. Managed types you build today can be made accessible from COM, and in the common case the configuration is totally automatic. There are certain new features of the managed development environment that are not accessible from COM. For example, static methods and parameterized constructors cannot be used from COM. In general, it is a good idea to decide in advance who the intended user of a given type will be. If the type is to be used from COM, you may be restricted to using those features that are COM accessible.
Depending on the language used to write the managed type, it may or may not be visible by default.
Specifically, .NET Framework components are accessed from COM by using a COM callable wrapper (CCW). This is similar to an RCW (see previous question), but works in the opposite direction. Again, if the .NET Framework development tools cannot automatically generate the wrapper, or if the automatic behavior is not What you want, a custom CCW can be developed.
Can I use the Win32 API from a .NET Framework program?
Yes. Using platform invoke, .NET Framework programs can access native code libraries by means of static DLL entry points.
Here is an example of C# calling the Win32 Message Box function:
using System;
using System.Runtime.InteropServices;
class MainApp
{
[DllImport("user32.dll", EntryPoint="MessageBox")]
public static extern int MessageBox(int hWnd, String strMessage, String strCaption, uint uiType);
public static void Main()
{
MessageBox( 0, "Hello, this is PInvoke in operation!", ".NET", 0 );
}
}
What do I have to do to make my code work with the security system?
Usually, not a thing—most applications will run safely and will not be exploitable by malicious attacks. By simply using the standard class libraries to access resources (like files) or perform protected operations (such as a reflection on private members of a type), security will be enforced by these libraries. The one simple thing application developers may want to do is include a permission request (a form of declarative security) to limit the permissions their code may receive (to only those it requires). This also ensures that if the code is allowed to run, it will do so with all the permissions it needs.
Only developers writing new base class libraries that expose new kinds of resources need to work directly with the security system. Instead of all code being a potential security risk, code access security constrains this to a very small bit of code that explicitly overrides the security system.
Why does my code get a security exception when I run it from a network shared drive?
Default security policy gives only a restricted set of permissions to code that comes from the local intranet zone. This zone is defined by the Internet Explorer security settings, and should be configured to match the local network within an enterprise. Since files named by UNC or by a mapped drive (such as with the NET USE command) are being sent over this local network, they too are in the local intranet zone.
The default is set for the worst case of an unsecured intranet. If your intranet is more secure you can modify security policy (with the .NET Framework Configuration tool or the CASPol tool) to grant more permissions to the local intranet, or to portions of it (such as specific machine share names).
How do I make it so that code runs when the security system is stopping it?
Security exceptions occur when code attempts to perform actions for which it has not been granted permission. Permissions are granted based on What is known about code; especially its location. For example, code run from the Internet is given fewer permissions than that run from the local machine because experience has proven that it is generally less reliable. So, to allow code to run that is failing due to security exceptions, you must increase the permissions granted to it. One simple way to do so is to move the code to a more trusted location (such as the local file system). But this won't work in all cases (web applications are a good example, and intranet applications on a corporate network are another). So, instead of changing the code's location, you can also change security policy to grant more permissions to that location. This is done using either the .NET Framework Configuration tool or the code access security policy utility (caspol.exe). If you are the code's developer or publisher, you may also digitally sign it and then modify security policy to grant more permissions to code bearing that signature. When taking any of these actions, however, remember that code is given fewer permissions because it is not from an identifiably trustworthy source—before you move code to your local machine or change security policy, you should be sure that you trust the code to not perform malicious or damaging actions.
How do I administer security for my machine? For an enterprise?
The .NET Framework includes the .NET Framework Configuration tool, an MMC snap-in (mscorcfg.msc), to configure several aspects of the CLR including security policy. The snap-in not only supports administering security policy on the local machine, but also creates enterprise policy deployment packages compatible with System Management Server and Group Policy. A command line utility, CASPol.exe, can also be used to script policy changes on the computer. In order to run either tool, in a command prompt, change the current directory to the installation directory of the .NET Framework (located in %windir%\Microsoft.Net\Framework\v1.0.2914.16\) and type mscorcfg.msc or caspol.exe.
What’s the implicit name and type of the parameter that gets passed into the class’ set method?
Value, and it’s data type depends on Whatever variable we’re changing.
How do you inherit from a class in C#?
Place a colon and then the name of the base class. Notice that it’s double colon in C++.
Does C# support multiple inheritance?
No, use interfaces instead.
When you inherit a protected class-level variable, who is it available to?
Classes in the same namespace.
Are private class-level variables inherited?
Yes, but they are not accessible, so looking at it you can honestly say that they are not inherited. But they are.
Describe the accessibility modifier protected internal.
It’s available to derived classes and classes within the same Assembly (and naturally from the base class it’s declared in).
C# provides a default constructor for me. I write a constructor that takes a string as a parameter, but want to keep the no parameter one. How many constructors should I write?
Two. Once you write at least one constructor, C# cancels the freebie constructor, and now you have to write one yourself, even if there’s no implementation in it.
What’s the top .NET class that everything is derived from?
System.Object .
How’s method overriding different from overloading?
When overriding, you change the method behavior for a derived class. Overloading simply involves having a method with the same name within the class.
What does the keyword virtual mean in the method definition?
The method can be over-ridden.
Can you declare the override method static while the original method is non-static?
No, you can’t, the signature of the virtual method must remain the same, only the keyword virtual is changed to keyword override.
Can you override private virtual methods?
No, moreover, you cannot access private methods in inherited classes, have to be protected in the base class to allow any sort of access.
Can you prevent your class from being inherited and becoming a base class for some other classes?
Yes, that’s What keyword sealed in the class definition is for. The developer trying to derive from your class will get a message: cannot inherit from Sealed class WhateverBaseClassName. It’s the same concept as final class in Java.
Can you allow class to be inherited, but prevent the method from being over-ridden?
Yes, just leave the class public and make the method sealed.
What’s an abstract class?
A class that cannot be instantiated. A concept in C++ known as pure virtual method. A class that must be inherited and have the methods over-ridden. Essentially, it’s a#4767d0print for a class without any implementation.
When do you absolutely have to declare a class as abstract (as opposed to free-willed educated choice or decision based on UML diagram)?
When at least one of the methods in the class is abstract. When the class itself is inherited from an abstract class, but not all base abstract methods have been over-ridden.
What’s an interface class?
It’s an abstract class with public abstract methods all of which must be implemented in the inherited classes.
Why can’t you specify the accessibility modifier for methods inside the interface?
They all must be public. Therefore, to prevent you from getting the false impression that you have any freedom of choice, you are not allowed to specify any accessibility, it’s public by default.
Can you inherit multiple interfaces?
Yes, why not.
And if they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay.
What’s the difference between an interface and abstract class?
In the interface all methods must be abstract, in the abstract class some methods can be concrete. In the interface no accessibility modifiers are allowed, which is ok in abstract classes.
How can you overload a method?
Different parameter data types, different number of parameters, different order of parameters.
If a base class has a bunch of overloaded constructors, and an inherited class has another bunch of overloaded constructors, can you enforce a call from an inherited constructor to an arbitrary base constructor?
Yes, just place a colon, and then keyword base (parameter list to invoke the appropriate constructor) in the overloaded constructor definition inside the inherited class.
What’s the difference between System. String and System.StringBuilder classes?
System. String is immutable; System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed
How big is the data type int in .NET?
32 bits.
How big is the char?
16 bits (Unicode).
How do you initiate a string without escaping each backslash?
Put an @ sign in front of the double-quoted string.
What are valid signatures for the Main function?
public static void Main ()
public static int Main ()
public static void Main ( string[] args )
public static int Main (string[] args )
How do you initialize a two-dimensional array that you don’t know the dimensions of?
int [ , ] myArray; //declaration
myArray = new int [5, 8]; //actual initialization
What’s the access level of the visibility type internal?
Current application.
What’s the difference between Struct and class in C#?
Structs cannot be inherited.
Structs are passed by value, not by reference.
Struct is stored on the stack, not the heap.
Explain encapsulation.
The implementation is hidden, the interface is exposed.
What data type should you use if you want an 8-bit value that’s signed?
Sbyte
Speaking of Boolean data types, What’s different between C# and /C++?
There’s no conversion between 0 and false, as well as any other number and true, like in C/C++.
Where is the value-type variables allocated in the computer RAM?
Stack.
Where do the reference-type variables go in the RAM?
The references go on the stack, while the objects themselves go on the heap.
What is the difference between the value-type variables and reference-type variables in terms of garbage collection?
The value-type variables are not garbage-collected, they just fall off the stack when they fall out of scope, the reference-type objects are picked up by GC when their references go null.
How do you convert a string into an integer in .NET?
Int32.Parse( string)
how do you box a primitive data type variable?
To pass it by reference.