Your Ad Here

Sunday, January 11, 2009

Difficult Interview Questions - ASP.NET

Q. Explain what a diffgram is, and a good use for one?
A : The DiffGram is one of the two XML formats that you can use to render DataSet object contents to XML. A good use is reading database data to an XML file to be sent to a Web Service.

Q.Whats MSIL, and why should my developers need an appreciation of it if at all?
A : MSIL is the Microsoft Intermediate Language. All .NET compatible languages will get converted to MSIL. MSIL also allows the .NET Framework to JIT compile the assembly on the installed computer.

Q.Which method do you invoke on the DataAdapter control to load your generated dataset with data?


A : The Fill() method.

Q.Can you edit data in the Repeater control?
A : No, it just reads the information from its data source.

Q.Which template must you provide, in order to display data in a Repeater control?
A : ItemTemplate.

Q.How can you provide an alternating color scheme in a Repeater control?
A : Use the AlternatingItemTemplate.

Q.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?

A : You must set the DataSource property and call the DataBind method.

Q.What base class do all Web Forms inherit from?
A : The Page class.

Q.Name two properties common in every validation control?
A : ControlToValidate property and Text property.

Q.Which property on a Combo Box do you set with a column name, prior to setting the DataSource, to display data in the combo box?

A : DataTextField property.

Q.Which control would you use if you needed to make sure the values in two different controls matched?

A : CompareValidator control.

Q.How many classes can a single .NET DLL contain?
A : It can contain many classes.

Q. What is ViewState?
A : 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 to retain the state of server-side objects between post backs.

Q.What is the lifespan for items stored in ViewState?
A : Item stored in ViewState exist for the life of the current page. This includes postbacks (to the same page).

Q.What does the "EnableViewState" property do? Why would I want it on or off?
A : 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.

Q.What are the different types of Session state management options available with ASP.NET?

A : 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 a "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.

Q.What is CLS (Common Language Specificaiton)?
A : It provides the set of specificaiton which has to be adhered by any new language writer / Compiler writer for .NET Framework. This ensures Interoperability. For example: Within a ASP.NET application written in C#.NET language, we can refer to any DLL written in any other language supported by .NET Framework. As of now .NET Supports around 32 languages.

Q.What is CTS (Common Type System)?
A : It defines about how Objects should be declard, defined and used within .NET. CLS is the subset of CTS.

Q.What is Boxing and UnBoxing?
A : Boxing is implicit conversion of ValueTypes to Reference Types (Object). UnBoxing is explicit conversion of Reference Types (Object) to its equivalent ValueTypes. It requires type-casting.

Q.What is the difference between Value Types and Reference Types?
A : Value Types uses Stack to store the data where as the later uses the Heap to store the data.

Q.What are the different types of assemblies available and their purpose?
A : Private, Public/shared and Satellite Assemblies.
Private Assemblies : Assembly used within an application is known as private assemblies.
Public/shared Assemblies : Assembly which can be shared across applicaiton is known as shared assemblies. Strong Name has to be created to create a shared assembly. This can be done using SN.EXE. The same has to be registered using GACUtil.exe (Global Assembly Cache).

Satellite Assemblies : These assemblies contain resource files pertaining to a locale (Culture+Language). These assemblies are used in deploying an Gloabl applicaiton for different languages.

Q.What is view state and use of it?
A : The current property settings of an ASP.NET page and those of any ASP.NET server controls contained within the page. ASP.NET can detect when a form is requested for the first time versus when the form is posted (sent to the server), which allows you to program accordingly.



Q.What are user controls and custom controls?
A : Custom controls: A control authored by a user or a third-party software vendor that does not belong to the .NET Framework class library. This is a generic term that includes user controls. A custom server control is used in Web Forms (ASP.NET pages). A custom client control is used in Windows Forms applications.User Controls: In ASP.NET: A user-authored server control that enables an ASP.NET page to be re-used as a server control. An ASP.NET user control is authored declaratively and persisted as a text file with an .ascx extension. The ASP.NET page framework compiles a user control on the fly to a class that derives from the System.Web.UI.UserControl class.

Q.What are the validation controls?
A : set of server controls included with ASP.NET that test user input in HTML and Web server controls for programmer-defined requirements. Validation controls perform input checking in server code. If the user is working with a browser that supports DHTML, the validation controls can also perform validation using client script.

Q.. What's the difference between Response.Write() andResponse.Output.Write()?
A : The latter one allows you to write formattedoutput.

Q.What methods are fired during the page load?

A : 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.

Q.Where does the Web page belong in the .NET Framework class hierarchy?
System.Web.UI.Page

Q.Where do you store the information about the user's locale?
System.Web.UI.Page.Culture

Q.What's the difference between Codebehind="MyCode.aspx.cs" and Src="MyCode.aspx.cs"?
A : CodeBehind is relevant to Visual Studio.NET only.

Q.What's a bubbled event?
A : When you have a complex control, likeDataGrid, 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 over a certain button.

Campus Interview Papers: 30 VB Interview Questions & Answers

Q : How many objects resides in ADO ?
A : ADO Objects,Connection,Command,Recordset,Parameter,Field,Error

Q : What is the difference between ADODC and ADODB
A : When u build connection with database through coding, then its ADODB..
When u build connection with database through ADO component, then its ADODC

Q : What is difference between dbgrid and flexgrid control
A ; In case of flexgrid also you can make it editable, by placing the textbox on runtime on the cell and key in required data. This is possible with flexgrids onCellEnter and onCellLeave events.

Q: How will u handle error in vb application ? explain
A : If You want To Trap The Error In Visual Basic Code then
Write The Code In Every Procedure & Function

Public Sub xxxxx()
On Error Goto Err_xxxxx
Err_xxxxx:
if err.Number<>0 then
msgbox err.description
end if
End Sub

Q :What is MAPI?
A : Messaging Application programing Interface.

Q : Difference between subquery and coquery
A :A subquery is called a query with in the query. Such as
select n1,n2 from table1 where in n1 not in(select n1 from table2)
while main query is the only query like
select n1,n2 from table1

Q :What are the type of validation available in VB?
A : Field, Form

Q : What's the purpose of Visual source safe in vb?
A : The Visual source safe is used to set level of user control to read, add & destroy.

Q : Why we use Treeview Control?
A : To list the hierarchical list of the node objects. Such of files and Directories

Q : How many images can be placed in the image list?
A: 64

Q : What are the Style Properties of Combo Box?
A : Simple, Dropdown list We can type and select. Dropdown Combo Only Drop Down.

Q : How to change the Mouse Pointer?
A : S creen.MousePointer = VBHourGlass/VBNormal.

Q : Diff types of Lock Types?
A : RdConcurReadOnly 0 (Default)
RdConcurLock 1 (Pessimistic Locking)
RdConcurRowver 2 (Optimistic Lociking)
RdConcurValues 3
RdConcurBatch 4

Q : What are the scopes of the class?
Public, private, Friend

Q : Diff type of Datatypes?
A : LOB (Large Object Data type).
CLOB (Stores Character Objects).
BLOB ( Store Binary Objects such as Graphic, Video Chips and Sound files).
BFILE(Store file pointers to LOB It may Contain filename for photo’s store on CD_ROM).

Q : What is Inprocess and Out of Process?
A : Inprocess It will run with in the memory. ( Local Machine). Out of Process It will run out of the memory Normally in the server side.

Q : What is diff between the Generic Variable and Specific Variable?
A : Generic Variable:
Create Object Ex:-Ole-Automation . No need refer the object library.
Specific Variable:
Binding Procedure Early and Late Binding ( Can be Remove from the Memory).

Q : What are the Technologies for Accessing Database from Visual Basic?set?
A : DAO, Data Control, RDO, ODBCDIRECT, ADO, ODBC API , 0040.

Q : What is the diff between the Create Object and Get object?
A : Create Object - To create an instance of an object.
Get Object To get the reference to an existing object

Q : What is the max size allowed for Max Text box length.
A : 32,000

Q : How many event in VB6 form ? :
A : 31

Q : What about OCX Controls
A : OCX is a USER control. we can create a control of our own and use it in our projects. OCX can be created using Activex control

. For example if we have a Text Box for getting Numbers only in every form and in every project we can create a Text Box for getting numbers only in ActiveX Control and use it as we do to other Text Box.

Q : What is compatibility ?
A : IN Visual Basic have 3 types of Compatibilites is there.

1) No Compatibility :- New GUID created, references from other components will not work
2) Project Compatibility :-Default for a new component
3) Bianary Compatibility :-GUID does not change, references from other components will work

Q : How to send data from MS FlexGrid to database
A : FlexGrid1.TextMatrix(Row,Column) ...

Q : What is Stored Variable?
A stired variable is a variable which is permanently stored in the memory and we can use that variable in our project.

Q : What are the advantages of Visual Basic ?
A : 1) VB is a rapid application Tool to develop applications faster2) Flexibility in design time3) Debugging the source code4) .(dot) operator for objects to expose its properties and methods5) plug and play wizards to connect databases

Q : What is Tag & What is the purpose of using a Tag?
A : Tag is usaually used to store the value of any variable or store the value of any field for the future use. ...

Q : What is Diff. Between Use Defined Function and Array.
A : Array is collection of variable of similar datatypes saves unser the same name.while user definded function are like the store procedures but more effective than store proceures.we can pass the parameters to user definded funtion and it return u the results ...

Q : What is meant by urlencode and urldecode?
Anwser 1:
urlencode() returns the URL encoded version of the given string. URL coding converts special characters into % signs followed by two hex digits. For example: urlencode("10.00%") will return "10%2E00%25". URL encoded strings are safe to be used as part of URLs.
urldecode() returns the URL decoded version of the given string.

Anwser 2:
string urlencode(str) - Returns the URL encoded version of the input string. String values to be used in URL query string need to be URL encoded. In the URL encoded version:

Alphanumeric characters are maintained as is.
Space characters are converted to "+" characters.
Other non-alphanumeric characters are converted "%" followed by two hex digits representing the converted character.

string urldecode(str) - Returns the original string of the input URL encoded string.

For example:

$discount ="10.00%";
$url = " http://domain.com/submit.php?disc=".urlencode($discount );
echo $url;

You will get " http://domain.com/submit.php?disc=10%2E00%25 ".

Q : what is instead of trigger ? explain
A : Instead of Trigger is used in SQL Server it used when we execute some sql QUERYsome how that query doesn't execute then Instead of Trigger is fired.

Latest VB script Interview Questions & Answers

Q : What are the major differences between Visual Basic and VBScript?
A : They are different: You dont compile VB scripts like in Visual Basic. You just distribute them as plain text HTML files.The script engine interprets this text into intermediate code when it loads the Web page. It also creates a symbol table so that it can quickly look up things such as event-procedures and variable names. The scripting engine uses the ActiveX Scripting technology to interact with the browser.
IE supports VB scripts on your computer& we can create Web pages with VB scripts. For Visual Basic, you need a text editor,ActiveX,Control Pad and Web Browser.
Some other differences:

Debugging VBScript doesn't have a debugger like Visual Basic. You'll resort to using lots of message boxes, instead.

Event-handlers You don't have an editor in which you select an object and event to edit an event-procedure. You have to name event-procedures in your scripts so that the scripting engine can find the appropriate handler when an object fires an event.

Forms VBScript doesn't have a forms editor. It doesn't need one, because you can't display forms anyway. You put forms and controls on the Web page, instead. You can use the ActiveX Control pad to insert all those nasty tags in your Web page, however.

Q : What are the types of arrays handled by VBScript?
A : .Static array2.Dynamic array ...

Q : What is the use of ReDim statement in VBScript?
A : The ReDim statement is used to change the size of the array within the script:
for example you have declared an array
Dim Customers(50)
But now you want to change the size of the array so you can do that with the help of Redim

ReDim Customers(100)

Q : What is parametrization ?
A : Parametrization: where you can change object's parameters in accordance with a mathematical rule, or data from a file.

Q : Compare Java Script and VB Script?
A : VB and Java Script are much similar in functionality. They both interact with the document object model of the page. Many browsers have compatibility with Java Script but they are not compatible with VB script as such. For client side scripting developers using VB Script should always make sure of cross browser compatibility which is not the case when working with VB script.

Q : Explain about operator precedence in VB Script?
A : In operator precedence expressions are evaluated and resolved in a predetermined order. The order of evaluation can be modulated if you use parenthesis. Expressions present in parenthesis are evaluated first.

Q : Explain about .wsf files?
A : .wsf files are modeled in similar to XML. They can be executed with the help of Wscript.exe and it can be done from the command line also. This .wsf file can have multiple visual basic files. Reuse functionality is present with this extension file.

Q : Explain about ADODB.Stream class?
ADODB.Stream class can be used as string builder. VBScript string concatenation can be very costly because of frequent memory allocation features. Binary file and memory I/O operation is provided by ADODB.Stream class. This is widely used to convert bytes into string, etc.

Q : Explain about filter expression?
A : Filter expression returns an array based on a specific filter search condition and it returns a zero based array. Arguments included in the filter array are Input strings, value, include and compare. If there is no match for the value it returns an empty string.

PHP Programming

Q : How To Download and Install PHP for Windows?
A : The best way to download and install PHP on Windows systems is to:
which is the official Web site for PHP.
Download PHP binary version for Windows in ZIP format.
Unzip the downloaded file into a directory.

Q : Where Are PHP Configuration Settings Stored?
A : PHP stores configuration settings in a file called php.ini in PHP home directory. You can open it with any text editor to your settings.

Q : What Are the Special Characters You Need to Escape in Single-Quoted Stings?
A : There are two special characters you need to escape in a single-quote string: the single quote (') and the back slash (). Here is a PHP script example of single-quoted strings:

echo 'Hello world!';
echo 'It's Friday!';
echo ' represents an operator.';
?>

This script will print:
Hello world!It's Friday! represents an operator

Q : How To Convert Numbers to Strings in PHP?
A : In a string context, PHP will automatically convert any numeric value to a string. Here is a PHP script examples:

print(-1.3e3);
print(" ");
print(strlen(-1.3e3));
print(" ");
print("Price = $" . 99.99 . " ");
print(1 . " + " . 2 . " = " . 1+2 . " ");
print(1 . " + " . 2 . " = " . (1+2) . " ");
print(1 . " + " . 2 . " = 3 ");
print(" ");
?>

This script will print:

-1300
5
Price = $99.99
3
1 + 2 = 3
1 + 2 = 3

The print() function requires a string, so numeric value -1.3e3 is automatically converted to a string "-1300". The concatenation operator (.) also requires a string, so numeric value 99.99 is automatically converted to a string "99.99". Expression (1 . " + " . 2 . " = " . 1+2 . " ") is a little bit interesting. The result is "3 " because concatenation operations and addition operation are carried out from left to right. So when the addition operation is reached, we have "1 + 2 = 1"+2, which will cause the string to be converted to a value 1.

Q : How To Replace a Substring in a Given String in PHP?
A : If you know the position of a substring in a given string, you can replace that substring by another string by using the substr_replace() function. Here is a PHP script on how to use substr_replace():

$string = "Warning: System will shutdown in NN minutes!";
$pos = strpos($string, "NN");
print(substr_replace($string, "15", $pos, 2)." ");
sleep(10*60);
print(substr_replace($string, "5", $pos, 2)." ");
?>

This script will print:

Warning: System will shutdown in 15 minutes!
(10 minutes later)
Warning: System will shutdown in 5 minutes!
Like substr(), substr_replace() can take negative starting position counted from the end of the string.

Q : How To Compare Two Strings with Comparison Operators in PHP?
A : PHP supports 3 string comparison operators, <, ==, and >, that generates Boolean values. Those operators use ASCII values of characters from both strings to determine the comparison results. Here is a PHP script on how to use comparison operators:

$a = "PHP is a scripting language.";
$b = "PHP is a general-purpose language.";
if ($a > $b) {
print('$a > $b is true.'." ");
} else {
print('$a > $b is false.'." ");
}
if ($a == $b) {
print('$a == $b is true.'." ");
} else {
print('$a == $b is false.'." ");
}
if ($a < $b) {
print('$a < $b is true.'." ");
} else {
print('$a < $b is false.'." ");
}
?>

This script will print:

$a > $b is true.
$a == $b is false.
$a < $b is false.

PHP

Q : What Is a Persistent Cookie?
A : A persistent cookie is a cookie which is stored in a cookie file permanently on the browser's computer. By default, cookies are created as temporary cookies which stored only in the browser's memory. When the browser is closed, temporary cookies will be erased. You should decide when to use temporary cookies and when to use persistent cookies based on their differences:
• Temporary cookies can not be used for tracking long-term information.
• Persistent cookies can be used for tracking long-term information.
• Temporary cookies are safer because no programs other than the browser can access them.
• Persistent cookies are less secure because users can open cookie files see the cookie values.

Q : What’s the difference between include and require?
A : It’s how they handle failures. If the file is not found by require(), it will cause a fatal error and halt the execution of the script. If the file is not found by include(), a warning will be issued, but execution will continue

Q : What are the differences between GET and POST methods in form submitting, give the case where we can use GET and we can use POST methods?

Anwser 1:
When we submit a form, which has the GET method it displays pair of name/value used in the form at the address bar of the browser preceded by url. Post method doesn't display these values.

Anwser 2:
When you want to send short or small data, not containing ASCII characters, then you can use GET” Method. But for long data sending, say more then 100 character you can use POST method.

Once most important difference is when you are sending the form with GET method. You can see the output which you are sending in the address bar. Whereas if you send the form with POST” method then user can not see that information.

Anwser 3:
What are "GET" and "POST"?
GET and POST are methods used to send data to the server: With the GET method, the browser appends the data onto the URL. With the Post method, the data is sent as "standard input."

Major Difference
In simple words, in POST method data is sent by standard input (nothing shown in URL when posting while in GET method data is sent through query string.

Ex: Assume we are logging in with username and password.

GET: we are submitting a form to login.php, when we do submit or similar action, values are sent through visible query string (notice ./login.php?username=...&password=... as URL when executing the script login.php) and is retrieved by login.php by $_GET['username'] and $_GET['password'].

POST: we are submitting a form to login.php, when we do submit or similar action, values are sent through invisible standard input (notice ./login.php) and is retrieved by login.php by $_POST['username'] and $_POST['password'].

POST is assumed more secure and we can send lot more data than that of GET method is limited (they say Internet Explorer can take care of maximum 2083 character as a query string).

Anwser 4:

In the get method the data made available to the action page ( where data is received ) by the URL so data can be seen in the address bar. Not advisable if you are sending login info like password etc. In the post method the data will be available as data blocks and not as query string in case of get method.

Anwser 5:

When we submit a form, which has the GET method it pass value in the form of query string (set of name/value pair) and display along with URL. With GET we can a small data submit from the form (a set of 255 character) whereas Post method doesn't display value with URL. It passes value in the form of Object and we can submit large data from the form.

Anwser 6:
On the server side, the main difference between GET and POST is where the submitted is stored. The $_GET array stores data submitted by the GET method. The $_POST array stores data submitted by the POST method.
On the browser side, the difference is that data submitted by the GET method will be displayed in the browser’s address field. Data submitted by the POST method will not be displayed anywhere on the browser.
GET method is mostly used for submitting a small amount and less sensitive data. POST method is mostly used for submitting a large amount or sensitive data

Q : How many ways can we get the value of current session id?
A : session_id() returns the session id for the current session.

Q : How can I execute a PHP script using command line?
A : Just run the PHP CLI (Command Line Interface) program and provide the PHP script file name as the command line argument. For example, "php myScript.php", assuming "php" is the command to invoke the CLI program.
Be aware that if your PHP script was written for the Web CGI interface, it may not execute properly in command line environment.

Q : How can we send mail using JavaScript?
A : No. There is no way to send emails directly using JavaScript.

But you can use JavaScript to execute a client side email program send the email using the "mailto" code. Here is an example:

function myfunction(form)
{
tdata=document.myform.tbox1.value;
location=" mailto:mailid@domain.com?subject =...";
return true;
}

Q : How can we create a database using PHP and mysql?
A : We can create MySQL database with the use of mysql_create_db($databaseName) to create a database.

Q : How can we submit form without a submit button?
A : We can use a simple JavaScript code linked to an event trigger of any form field. In the JavaScript code, we can call the document.form.submit() function to submit the form. For example:

Q : What is the difference between mysql_fetch_object and mysql_fetch_array?
A : MySQL fetch object will collect first single matching record where mysql_fetch_array will collect all matching records from the table in an array

Q : How can we find the number of rows in a result set using PHP?
A : Here is how can you find the number of rows in a result set in PHP:
$result = mysql_query($any_valid_sql, $database_link);
$num_rows = mysql_num_rows($result);
echo "$num_rows rows found";

Q : How many values can the SET function of MySQL take?
A : MySQL SET function can take zero or more values, but at the maximum it can take 64 values.

Q : How many values can the SET function of MySQL take?
A : MySQL SET function can take zero or more values, but at the maximum it can take 64 values.

Q : What is the difference between the functions unlink and unset?
A : unlink() is a function for file system handling. It will simply delete the file in context.
unset() is a function for variable management. It will make a variable undefined.

Q : What is the difference between CHAR and VARCHAR data types?
A : CHAR is a fixed length data type. CHAR(n) will take n characters of storage even if you enter less than n characters to that column. For example, "Hello!" will be stored as "Hello! " in CHAR(10) column.
VARCHAR is a variable length data type. VARCHAR(n) will take only the required storage for the actual number of characters entered to that column. For example, "Hello!" will be stored as "Hello!" in VARCHAR(10) column.
How can we encrypt and decrypt a data present in a mysql table using mysql?
AES_ENCRYPT() and AES_DECRYPT()

Q : What are the difference between abstract class and interface?
A : Abstract class: abstract classes are the class where one or more methods are abstract but not necessarily all method has to be abstract. Abstract methods are the methods, which are declare in its class but not define. The definition of those methods must be in its extending class.
Interface: Interfaces are one type of class where all the methods are abstract. That means all the methods only declared but not defined. All the methods must be define by its implemented class.

Q : How can increase the performance of MySQL select query?
A : We can use LIMIT to stop MySql for further search in table after we have received our required no. of records, also we can use LEFT JOIN or RIGHT JOIN instead of full join in cases we have related data in two or more tables.

Q : Explain the ternary conditional operator in PHP?
A : Expression preceding the ? is evaluated, if it’s true, then the expression preceding the : is executed, otherwise, the expression following : is executed

Q : What’s the difference between md5(), crc32() and sha1() crypto on PHP?
A : The major difference is the length of the hash generated. CRC32 is, evidently, 32 bits, while sha1() returns a 128 bit value, and md5() returns a 160 bit value. This is important when avoiding collisions.

Q : What is the functionality of MD5 function in PHP?
A : string md5(string)
It calculates the MD5 hash of a string. The hash is a 32-character hexadecimal

Q : What is the difference between htmlentities() and htmlspecialchars()?
A : htmlspecialchars() - Convert some special characters to HTML entities (Only the most widely used)
htmlentities() - Convert ALL special characters to HTML entitie

Q : How can we submit from without a submit button?
A : Trigger the JavaScript code on any event ( like onSelect of drop down list box, onfocus, etc ) document.myform.submit(); This will submit the form

Q : What is the difference between PHP4 and PHP5?
A : PHP4 cannot support oops concepts and Zend engine 1 is used.
PHP5 supports oops concepts and Zend engine 2 is used.
Error supporting is increased in PHP5.
XML and SQLLite will is increased in PHP5.

Q : What is the difference between explode and split?
Split function splits string into array by regular expression. Explode splits a string into array by string.

Q : What is difference between srand & shuffle?
The srand function seeds the random number generator with seed and shuffle is used for shuffling the array values.
shuffle - This function shuffles (randomizes the order of the elements in) an array. This function assigns new keys for the elements in array. It will remove any existing keys you may have assigned, rather than just reordering the keys.
srand - Seed the random number generator

The srand function seeds the random number generator with seed and shuffle is used for shuffling the array values.
shuffle - This function shuffles (randomizes the order of the elements in) an array. This function assigns new keys for the elements in array. It will remove any existing keys you may have assigned, rather than just reordering the keys.
srand - Seed the random number generator

Q : What are the different types of errors in PHP?
A : 1. Notices: These are trivial, non-critical errors that PHP encounters while executing a script - for example, accessing a variable that has not yet been defined. By default, such errors are not displayed to the user at all - although you can change this default behavior.
2. Warnings: These are more serious errors - for example, attempting to include() a file which does not exist. By default, these errors are displayed to the user, but they do not result in script termination.
3. Fatal errors: These are critical errors - for example, instantiating an object of a non-existent class, or calling a non-existent function. These errors cause the immediate termination of the script, and PHP’s default behavior is to display them to the user when they take place.

.NET

Q : How is ASP .NET different from ASP?
A : Scripting is separated from the HTML, Code is compiled as a DLL, these DLLs can be executed on the server.

Q : What is ADO .NET ? what is difference between ADO and ADO.NET?
A : ADO.NET is stateless mechanism. I can treat the ADO.Net as a separate in-memory database where in I can use relationships between the tables and select insert and updates to the database. I can update the actual database as a batch.

Q : What is the difference between the C#.NET and VB.NET?
A : VB.NET
It didn't have the Operator Overloading.
It didn't have the XML Documentation.
It didn't have the Pointer Type variables.
C#.NET
It has XML Documentation, Operator Overloading and supports Pointer Variables using unsafe keyword
c#.net is the case sensitive.
vb.net is not the case sensitive

Q : How you can create a XML File?
A : To write Dataset Contents out to disk as an XML file use:

Q : How you can create a XML File?
A : To write Dataset Contents out to disk as an XML file use:
MyDataset.WriteXML(server.MapPath("MyXMLFile.xml"))
dataSet.WriteXml(string path);
string str = "";
string s="select * from emp";
SqlCommand cmd = new SqlCommand(s, con);
SqlDataReader dr = cmd.ExecuteReader();
//str += " " ;
str += "";
while (dr.Read())
{
str += "";
str += dr[0].ToString();
str += "
";
str += dr[1].ToString();
str += "
";
}
str += "
";
StreamWriter sw = File.CreateText("D:ampl.xml");
sw.WriteLine(str);
sw.Close();

Q :How is the difference between interface and abstract class?
A : Abstract classes can not be instantiated it can have or cannot have abstract method basically known as mustinherit as the methods are static in nature
where interfaces are the declaration and r defined where they are called used for dynamic methods
Interface needs to be implemented,abstract class has build in implementation.

Q :What is the smart navigation?
A : The cursor position is maintained when the page gets refreshed due to the server side validation and the page gets refreshed.

Q : How do you validate the controls is an ASP .NET page?
A : Using special validation controls that are meant for this. We have Range Validator, Email Validator.

Q :How do assemblies search each other?
A : By searching directory paths. There are several factors that can affect the path (such as the AppDomain host, and application configuration files), but for weakly named assemblies the search path is normally the application's directory and its sub-directories. For strongly named assemblies, the search path is the GAC followed by the private assembly path.

Q : What is the garbage collection?
A : Garbage collection is a heap-management strategy where a run-time component takes responsibility for managing the lifetime of the memory used by the objects. This concept is not new to .NET - Java and many other languages/runtimes have used garbage collection for some time.


Q :How do you validate controls in an ASP .NET page?
A : Using special validation controls there are meant for this. We have Range Validator, Email Validator.
A : Using special validation controls there are meant for this. We have Range Validator, Email Validator.

Q : What is the difference between Response.Write() andResponse.Output.Write()?
A : Response.Output.Write() allows you to write formatted output

Q : Name two properties common control in every validation
A : ControlToValidate property and Text property.

Q : What is the ViewState?
A : 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 to the retain the state of server-side objects between postabacks.

Q : Difference between a Thread and a Process?
A : Both are individual execution paths, but process timeslicing (and memory space) is enforced by the OS, while thread differentiation is enforced by the applications.

Q : What is the GAC? What is the problem its solve?
A : The Global Assembly Cache. It is stored strongly-named assemblies in a single location, allowing for verification of code library uniqueness when executing.

Q : What is the difference between DataSet and DataTable?
A : Data set can store many tables but a data table can have one table only.

Q : What is the usage of console application?
A : Console Applications are command-line oriented applications that allow us to read characters from the console, write characters to the console and are executed in the DOS version. Console Applications are written in code and are supported by the System. Console namespace.

Q : Describe rapid application development tool?
A : Rapid action development tool describes about the software development process. This tool gives flexibility in iterative development and prototype deployment. It enhances the speed of application development. It is also used for the application maintenance.

Q : What is the MSIL, IL?
A :When compiling to managed code, the compiler translates your source code into the Microsoft intermediate language (MSIL),which is a CPU-independent set of instructions that can be efficiently converted to native code. MSIL includes instructions for loading, storing, initializing, and calling methods on objects, as well as instructions for arithmetic and logical operations, control flow, direct memory access, exception handling, and other operations. Microsoft intermediate language (MSIL) is a language used as the output of a number of compilers and as the input to a just-in-time (JIT) compiler. The common language runtime includes a JIT compiler for converting MSIL to native code.

Q : What is the difference between ref and out parameters?
A: An argument passed to a ref parameter must first be initialized. Compare this to out parameter, whose argument does not have to be explicitly initialized before being passed to an out parameter.

Q : How DLL Hell problem solved in .NET?
A : Assembly versioning allows the application to specify not only library it needs to run (which was available under Win32), but also the version of the assembly.

Saturday, January 3, 2009

Recent - JAVA Interview Questions & Answers

Q : What is the difference between Java platform and other platforms?
A : The Java platform differs from most other platforms in that it's a software-only platform that runs on top of other hardware-based platforms.

The Java platform has two components:

1. The Java Virtual Machine (Java VM)

2. The Java Application Programming Interface (Java API)

Q : What is Java Virtual Machine?

A : The Java Virtual Machine is a software that can be ported onto the various hardware-based platforms.

Q : What is the package? Define with an example?

A : A package is a grouping of related types providing access protection and name space management. Note that types refers to classes, interfaces, enumerations, and annotation types. Enumerations and annotation types are special kinds of classes and interfaces, respectively, so types are often referred to in this lesson simply as classes and interfaces.

Package is a directory of related classes and interfaces.
Eg: java.lang.*

Here java is a directory,lang stands for language & it is a sub directory, * indicates collection of related classes & interfaces

Q : What is the difference between the interface and abstract class?
A : An abstract class may contain code in method bodies, which is not allowed in an interface. With abstract classes, you have to inherit your class from it and Java does not allow multiple inheritance. On the other hand, you can implement multiple interfaces in your class.

Q : What is the thread?
A : A thread is an independent path of execution in a system.

Q :What is the multi-threading?
A: Multi-threading means various threads that runs in a system.

Q : What is the synchronization ? why is it important in Java Programming?
A : With respect to multithreading, synchronization is the capability to control the access of multiple threads to shared resources. Without synchronization, it is an possible for one thread to modify a shared object while another thread is in the process of using or updating that object’s value. This often causes dirty data and leads to significant errors.

Q : What is the purpose of Runtime class in Java Programming?
A :The purpose of Runtime class is to provide access to the Java runtime system in Java Programming.

Q :Describe difference between a static and a non-static inner class in Java Programming?
A non-static inner class may have object instances that are associated with instances of the class’s outer class. A static inner class does not have any other object instances.

Q : Name the primitive Java types?
A : The primitive types are,

byte, char, short, int, long, float, double, and boolean.

Q : What is the casting in Java Programming?
A : There are two types of casting, casting between primitive numeric types and casting between object references.
Casting between numeric types is used to convert larger values, such as double values, to smaller values, such as byte values. Casting between object references is used to refer the object by a compatible class, interface, or array type reference.

Q : What are the Encapsulation, Inheritance and Polymorphism?
A : Encapsulation is the mechanism that binds together code and data it manipulates and keeps both safe from outside interference and misuse.
Inheritance is the process by which one object acquires the properties of another object. Polymorphism is the feature that allows one interface to be used for general class actions.

Q : What is the difference between constructor and method?
A : Constructor will be automatically invoked when an object is created where as the method has to be called explicitly.

Q: What is a UNICODE?-
A : A Unicode is used for internal representation of characters and strings and it uses 16 bits to represent each other.

Q : What is a abstract class?
A :A abstract class is a class designed with implementation gaps for subclasses to fill in and is deliberately incomplete.

Q : What is daemon thread ? which the method is used to create the daemon thread?-
A: Daemon thread is a low priority thread which runs intermittently in the back ground doing the garbage collection operation for the java runtime system.

SetDaemon method is used to create a daemon thread.

Q: What are the wrapper classes?
A : The Wrapper classes are classes that allow primitive types to be accessed as objects.

Q : What is the difference between applet and a servlet?
A : Servlets are to servers what applets are to browsers.
Applets must have graphical user interfaces whereas servlets have no graphical user interfaces.

Q :What are the cookies ?
A : Cookies are a mechanism that a servlet uses to have a client hold a small amount of state-information associated with the user.

Q :What is Java Bean?
A : Java Bean is a software component that has been designed to be reusable in a variety of different environments.

Recent HTML Interview Questions & Answers

Q : What’s the difference between the HTML form methods GET and POST?
A : The method parameter specifies which method the client is using to send information to the WEB server. The method determines which parameter you will search the CGI request data in:
* POST - post_args
* GET - http_search_args

Q : What is a tag?
A : In HTML, a tag tells the browser what to do. When you write an HTML page, you enter tags for many reasons -- to change the appearance of text, to show a graphic, or to make a link to one page to another page.

Q : What are meta tags and why it is used?
A: Html tag in the header section of a web page, intended to offer content to search engines. Among them are the keyword and description tags, but these days are most true search engines de-emphasize or completely ignore META tags. ...

Q : What are the differences between DIV and SPAN?
A : DIV is used to select a block of text so that one can apply styles to it. SPAN is used to select inline text and let users to apply styles to it. The main difference between DIV and SPAN is SPAN does not do formatting by itself. Also the DIV tag is used as a paragraph break as it creates a logical division of the document in which it is applied. This is in contrast to the SPAN as SPAN simply dos the functionality of applying the style and alignment whatever was specified in it. DIV has ALIGN attribute in it which is not present in case of SPAN. Thus DIV is used in cases where one wants to apply styles to a block of text. But there may be situations in which that the there might not be clear well structured block of text to work with. In those cases one can do opt to apply SPAN which is used to apply styles inline. That is in other words DIV is generally used for block of text and SPAN is generally used for words or sentences.

Q : How do you change the title of a framed document?
A : The title displayed is the title of the frameset document rather than the titles of any of the pages within frames. To change the title displayed, a link to a new frameset document using
TARGET="_top" (replacing the entire frameset).

Q : How do you link to a location in the middle of an HTML document?
A : First, label the destination of the link. The old way to label the destination of the link was with an anchor using the NAME attribute.
For example:

Section 2: Web Page



The modern way to the label destination of the link is with an ID attribute.
For example:

Section 2: Web page



Second, link to the labeled destination. The URL is the URL of the document, with "#" and the value of the NAME or ID attribute appended. Continuing the above examples, elsewhere in the same document you could use:
go to Section 2

Q : How do you remove the border around frames?
A : Removing the border around frames involves both not drawing the frame borders and eliminating the space between the frames. The most widely supported way to display borderless frames is FRAMESET ... BORDER=0 FRAMEBORDER=0 FRAMESPACING=0".
Note that these attributes are proprietary and not part of the HTML 4.01 specifications. (HTML 4.01 does define the FRAMEBORDER attribute for the FRAME element, but not for the FRAMESET element.) Also, removing the border around a frame makes it is difficult to resize it, as this border is also used in most GUIs to change the size of the frame.

Q : Explain in brief about the term CSS.
A : A stylesheet language is used to describe the presentation of a document written in a markup language. Cascading Style Sheets are a big breakthrough in Web design because they allow developers to control the style and layout of multiple Web pages all at once.

Q : What are the attributes that make up a DHTML?
A : DHTML is called as a Dynamic HTML. This is used to increase the interactive ability and the visual effect of the web pages which is loaded in the browser. The main technologies that are used in DHTML are namely:

HTML
JavaScript
CSS which is also called as Cascading Style Sheet
DOM also called as Document Object Model

Let see the DHTML namely briefly about

HTML:
This is also known as hyper text markup language. This is widely used in web pages. This along with JavaScript plays a vital role for enhancing the features of web pages. In other words the JavaScript is inside the HTML page and this is read by the browser as soon as the page gets loaded.

JavaScript:
JavaScript is the most popularly used scripting language for client-side. The use of JavaScript within the HTML page adds interactivity ability to web pages and this was introduced by Netscape.


DOM:
DOM is called as Document Object Model. This is platform and also language independent. This is used for dynamic access and updating of contents in documents


CSS:
CSS is called as Cascading Style Sheet. This is used to enhance the features of web pages like formatting styles say bold, font size and so on and there by increase the visual appearance of web pages. These are specified inside an HTML tag.

Q : Why is there extra space before or after the table?
A : This is often caused by invalid HTML syntax. Specifically, it is often caused by loose content within the table (i.e., content that is not inside a TD or TH element). There is no standard way to the handle loose content within a table. Some browsers display all loose content before or after the table. When the loose content contains only multiple line breaks or empty paragraphs, then these browsers will display all this empty space before or after the table itself.
The solution is to fix the HTML syntax errors. All content within a table must be within a TD or TH element.

Q : What’s the difference between jscript and javascript?
A : JScript & javascript are both scripting languages that facilitate
development of web pages. It is similar to javascript with subtle difference in objects & functions exposed. JScript is supported and shipped by Microsoft and may be work best only on IE where as Javascript was initiated by netscape and can do work across all browsers consistently

J2EE Interview questions & answers

Q : what is J2EE ?what is the features?
J2EE is java to enterprise edition. It is used to develop web applications

Q : Define Hash table?
Hash tables are good for doing a quick search on things.
For instance if we have an array full of data (say 100 items).If we known the position that a specific item is stored in an array, then we could quickly access it. For instance, we just happen to know that the item we want it is at position 3; I can apply:
myitem=myarray[3];
There are many different hash functions. Some hash functions will take an integer key and turn it into an index. A common one is used to the division method

Q : what is the difference between web server & application server ?
A : web server can have only the web container. But Application server can have web container as well as EJB container
Example of Application Server : JBOSS
Web Server : TOMCAT.

Q : What are the components of J2EE application?
A : A J2EE component is a self-contained functional software unit that is assembled into a J2EE application with its related classes and files and communicates with other components. The J2EE specification defines the following J2EE components:
Application clients and applets are client components.
Java Servlet and JavaServer PagesTM (JSPTM) technology components are web components.
Enterprise JavaBeansTM (EJBTM) components (enterprise beans) are business components.
Resource adapter components provided by EIS and tool vendors

Q : What is a J2EE component ?
A : A self-contained functional software unit supported by the container and configurable at deployment time. The J2EE specification defines the following J2EE components: Application clients and applets are components that run on the client. Java servlet and JavaServer Pages (JSP) technology components are Web components that run on the server. Enterprise JavaBeans (EJB) components (enterprise beans) are business components that run on the server. J2EE components are written in the Java programming language and are compiled in the same way as any program in the language. The difference between J2EE components and "standard" Java classes is that J2EE components are assembled into a J2EE application, verified to be well formed and in compliance with a J2EE specification, and deployed to production, where they are run and managed by the J2EE server or client container.

Q : What is "applet"?
A: A J2EE component that is a typically executes in a Web browser but can execute in a variety of other applications or devices that support the applet programming model.

Q : Difference between RMI and EJB?
A : EJB uses RMI technology.
We have to declare the middleware services needed by the EJB in a descriptor.
The Applet server will generate stubs for the same.

RMI : one has to write the middleware services. (txn mgmt, persitence.)

EJB cannot be invoked directly by the remote clients because there are not network enabled.
Location transparency.

Q : What is a web container?
A :Runtime environment for servlets and JSP
Manages lifecycle of instances
Supports HTTP

Q : What’s the difference between URL Connection instance and URL instance?

A : URL Connection instance represents a link for accessing or communicating with the resource at the location and a URL instance represents the location of a resource.

Q :What technologies are included in J2EE?

A :The primary technologies in J2EE are: Enterprise JavaBeansTM (EJBsTM), JavaServer PagesTM (JSPsTM), Java Servlets, the Java Naming and Directory InterfaceTM (JNDITM), the Java Transaction API (JTA), CORBA, and the JDBCTM data access API.

Q : What is XLink ?
A : The part of the XLL specification that is concerned with the specifying links between documents.

Q : What is XLL ?

A : The XML Link Language specification, consisting of XLink and XPointer.

Q : What is in-memory replication?
A : The process by which the contents in the memory of one physical m/c is replicated in all the m/c in the cluster is called in-memory replication.
Q : What is a JavaBeans component
A : A JavaBeans class that can be manipulated by tools and composed into the applications. A JavaBeans component must adhere to the certain property and event interface conventions.

Q : What is the J2EE module?
A : The J2EE module consists of one or more J2EE components.For the same container type and one component deployment descriptor of that type

Q : What is a Web resource ?
A static or dynamic object contained in a Web application that can be referenced by a Uniform Resource Locator URL.

Q : What is "application assembler"?
A : A person who combines J2EE components and modules into deployable application units.

Q : What are the four types of J2EE modules?
A : The four types of J2EE modules are
• Application client module
• Web module
• Enterprise JavaBeans module
• Resource adapter module

JDBC Interview Questions & Answers

Q : How can you make the connection?
A : To establish a connection you need to have the appropriate driver connect to the DBMS.
The following line of code illustrates the general idea is :

String url = “jdbc:odbc:Fred”;
Connection con = DriverManager.getConnection(url, “Fernanda”, “J8?);

Q : What are the different types of Statements?
A : There are three types of statements
• Regular statement (use to create Statement method),
• prepared statement (use prepare Statement method)
• callable statement (use to prepareCall)

Q : What are the two major components of JDBC?
A : The two major components of JDBC are Connection Pooling and Data Sources.

Q : What is a metadata?
A : Metadata is data about data.
In context of JDBC, there are two types of metadata.
1. Describing information about the Result set object. i.e, if u have applied a query that fetches some result. This metadata describes information about how many columns have been fetched, their names etc.
2. Second One describes about the database connection

Q : What is the difference between local and global transaction?
A :A transaction is atomic unit of Work. The tasks which are made into the transaction act as a unit which can be executed successfully all, or if at least one task fails to its promise ,then the effect of all the tasks are to be rollbacked. Thus transaction is committed or rolled backed.

Transactions can be divided into two categories.

1.Local Transactions: These transactions are confined to the objects which reside inside one particular JVM.Local transactions in java can be implemented using the JTA api.

2.Global Transactions:These transactions may encapsulate objects which are distributed on various JVM's.Global transactions are implemented through the TWO-PHASE-COMMIT design implementation.

Q : How to call a Stored Procedure from JDBC?

A : The first step is to create a CallableStatement object. As with as a Statement an and PreparedStatement objects, this is done with an open Connection object. A CallableStatement object contains a call to a stored procedure.

E.g.

CallableStatement cs = con.prepareCall("{call SHOW_SUPPLIERS}");
ResultSet rs = cs.executeQuery();

Q : What is JDBC objects generate SQLWarnings?
A : Connections, Statements and ResultSets all have a getWarnings method that allows retrieval. Keep in mind that the prior ResultSet warnings are cleared on each new read and prior Statement warnings are cleared with each new execution. getWarnings() itself does not clear existing warnings, but each object has a clearWarnings method.

Q : What are the two major components of JDBC?
A :The two major components of JDBC is One implementation interface for the database manufacturers, the other implementation interface for application and applet writers.

Q : Which is the following statements is true regarding the two tier model of the JDBC driver model?

A : A JDBC driver is required to the communicate with the particular database management system that is being accessed

Q : Which is the statement below does not correctly defines the difference between ODBC and JDBC?
A : ODBC requires manual installation of the ODBC driver manager and driver on all client machines. While for JDBC driver is written in Java and JDBC code is automatically installable, secure and portable on all platforms.
Explanation: Because ODBC being a C based interface cannot be directly used with java.

Q : How web server is connected with appliction server?
A : All the application server needs to the information about the installed web server's port and name, through these entries it creates a connector and stored. This connector is used to communicate with Application server.

Q : What’s the difference between Rowset and Resultset?
A : RowSets are a part of JDBC 2.0 API, and there are quite a few implementations to suit your needs (CachedRowSet, JDBCRowSet, WebRowSet). Essentially a row set is a JavaBean that contains database data. The implementation is store the data offline, or it can simply wrap a connection to make a result set look like a JavaBean. You could even use a row set to access data communicating over HTTP to a servlet, which provides the data for the bean.

Q : How can I insert images into a Mysql database?
A : This code is snippet shows the basics:

File file = new File(fPICTURE);
FileInputStream fis = new FileInputStream(file);
PreparedStatement ps =
ConrsIn.prepareStatement("insert into dbPICTURE values (?,?)");

ps.setString(1,file.getName());
ps.setBinaryStream(2,fis,(int)file.length());
ps.close();
fis.close();

Q : What is the advantage of using a PreparedStatement?
A : For SQL statements that are executed repeatedly, using a PreparedStatement object would almost always be s faster than using a Statement object. This is because creating a PreparedStatement object by explicitly giving the SQL statement causes the statement to be precompiled within the database immediately. Thus, when the PreparedStatement is later executed, the DBMS does not have to recompile the SQL statement and prepared an execution plan - it simply runs the statement.
Typically, PreparedStatement objects are used for the SQL statements that take parameters. However, they can also be used with repeatedly executed SQL statements that do not accept parameters.

Q : How does the JDBC work?
A : The Java Database Connectivity (JDBC) is used to whenever a Java application should communicate with a relational database for which a JDBC driver exists. JDBC is part of the Java platform standard; all visible classes used in the Java/database communication are placed in package java. SQL

Main JDBC classes:
• DriverManager. Manages a list of database drivers. Matches connection requests from the java application with the proper database driver using communication subprotocol. The first driver that recognizes a certain subprotocol under jdbc (such as odbc or dbAnywhere/dbaw) will be used to establish a database Connection.
• Driver. The database communications link, handling all communication with the database. Normally, once the driver is loaded, the developer need not call it explicitly.
• Connection. Interface with all the methods for contacting a database
• Statement. Encapsulates an SQL statement which is passed to the database to be parsed, compiled, planned and executed.
• ResultSet. The answer/result from a statement. A ResultSet is a fancy 2D list which encapsulates all outgoing results from a given SQL query.

MYSQL Interview Questions & Answers

Q : What are the advantages of mySQL comparing with oracle?
A : MySql are many advantages in comparison to Oracle.

1 - MySql is Open a source, which can be available any time

2 - MySql has no cost of development purpose.

3 - MySql has most of features , which oracle provides

4 - MySql day by day updating with the new facilities.

5 - Good for small application.

6 – Easy to learn and to become master.

7 - MySql has a good power these days.

Even though MySql having so many advantages, Oracle is best database ever in Software development.

Q : What are two examples of an OLTP environment?
A : The two expels of an OLTP environments are
On Line Banking
On Line Reservation (Transportation like Rail, Air etc.)

Q : What Is a Primary Key?
A : A primary key is a single column or multiple columns is defined to have unique values that can be used as a row identifications.

Q : What Is a Transaction?
A : A transaction is a logical unit of work requested by a user to be applied to the database objects. MySQL server is introduced the transaction concept to allow users to group one or more SQL statements into a single transaction, so that the effects of all the SQL statements in a transaction can be either all committed (applied to the database) or all rolled back (undone from the database).

Q : What are the indexes?
A: An index is an internal structure which is provided quick access to rows of a table based on the values of more than one columns.


Q : What is a foreign key?
A: A foreign key is a constraint associates one or more columns in a table with an identical set of columns on which a primary key has been defined in another table. A foreign key may refer to the primary key of another table or same table.

Q : What is the difference between MyISAM Static and MyISAM Dynamic ?
A: In MyISAM static is all the fields have fixed width. The Dynamic MyISAM table would be include fields such as TEXT, BLOB, etc. to accommodate the data types with various lengths. MyISAM Static would be easier to restore in case of corruption, since even though you might lose some data, you know exactly where to look for the beginning of the next record.

Oracle interview Questions And Answers

Q : Explain in brief about snapshot in oracle?
A : A recent copy of a table or a subset of rows or cols of a table is called as snapshot in oracle. A snapshot is more than one useful in distributed computing environment. We can create snapshot in oracle using command create snapshot. We can specify refresh interval while creating snapshot.

Q : What’s the difference between trigger and stored procedure?

A : Procedure can run only when one call them manually whereas a trigger runs when there is any activity (insert, update, delete) on table on which the trigger is written.

Q :What is a database buffer cache?

A : A Database buffer cache is a component of SGA. It has the responsibility of to cache most recent accessed data. It keeps the transaction in the buffer cache till it is written on the disk.

Q : Explain the difference between a data block, an extent and a segment?

A : A data block is the smallest unit of logical storage for a database object. As objects grow they get chunks of additional storage that are composed of a contiguous data blocks. These groupings of contiguous data blocks are called extents. All the extents are that an object takes when grouped together are considered the segment of the database object.

Q :What is difference between UNIQUE and PRIMARY KEY constraints?

A: A table can have only one PRIMARY KEY whereas there can be any number of UNIQUE keys. Primary Key does not allow the NULL value whereas UNIQUE key allows NULL value.

Q : What are different Oracle database objects?
A : There are many oracle database objects are,
TABLES
VIEWS
INDEXES
SYNONYMS
SEQUENCES
TABLESPACES etc

Q : What is a view?
A : A view is stored procedure based on the one or more tables, it is a virtual table.

Q : What is difference between SQL and SQL*PLUS?
A : SQL*PLUS is a command line tool where as SQL and PL/SQL language interface and reporting tool. It is a command line tool that allows user to type SQL commands to be executed directly against an Oracle database. SQL is a language used to query the relational database (DML,DCL,DDL). SQL*PLUS commands are used to format query result, Set options, Edit SQL commands and PL/SQL.

Q :What are the more common used in pseudo-columns?
A : The most common used pseudo columns are,
SYSDATE, USER , UID, CURVAL, NEXTVAL, ROWID, ROWNUM

Q : Explain the Oracle cursor : Implicit & Explicit cursors ?

A : Oracle uses work areas called private SQL areas to create SQL statements.
PL/SQL construct to identify the each and every work are used, is called as Cursor.
For SQL queries returning a single row, PL/SQL declares is an all implicit cursors.
For queries that returning more than one row, the cursor needs to be explicitly declared.

Struts Interview Questions & Answers

Q : What are the disadvantages of struts?
A : A Few Disadvantage are mentioned into the below link. Struts have disadvantages mainly on performance of the application. Especially when the using advanced tag like nested-loop etc, Resulting in creating many Forms object then required.

Q : Explain the Struts navigation flow?
Struts Navigation flow is
A request is made from previously displayed view.
The request reaches the ActionServlet which acts as the controller .The ActionServlet Looksup the requested URI in an XML file (Struts-Config.xml) and determines the name of the Action class that has to perform the requested business logic.
The Action Class is performs its logic on the Model Components associated with the Application.
Once The Action has been completed its processing it returns the control to the Action Servlet. As part of its return the Action Class provides a key to determine where the results should be forwarded for presentation.
The request is complete when the Action Servlet responds by forwarding the request to the view, and this view represents the result of the action.

Q : How do we call EJB from Struts?
A : We can call EJB from struts by using the service locator design pattern or by Using initial context with create a home object and getting return remote reference object.

Q : Explain about the token feature in Struts?
A : Use the Action Token methods are to prevent duplicate submits
There are methods built into the Struts action to generate one-use tokens. A token is placed in the session when a form is populated and also into the HTML form as a hidden property. When the form is returned, the token is validated. If validation is failed , then the form has already been submitted, and the user can be apprised.
saveToken(request)
on the return trip,
isTokenValid(request)
resetToken(request)

Q : Why we use the Struts framework in project?
A : If you use struts, there will be only one Servlet which acts as a controller (MVC) pattern. If your web application is very a simple then there is no need to use struts. If the application is big like a any banking application etc, then you should use Struts as it is very robust, makes the things simple. It’s Also has lot of readily available security features etc...


Q : What are the components of Struts?
A : Struts components are categorize into Model, View and Controller:

Model: Components like business logic /business processes and data are the part of model.
View: HTML, JSP are the view components.
Controller: Action Servlet of Struts is part of a Controller components which works as front controller to handle all the requests.

Q : What are the important methods of ActioFormn?

A : The important methods is a ActionForm are : validate() & reset().

Q : What is a ActionMapping?
A : A Action mapping contains all the deployment information is a particular Action bean. This class is to determine where the results of the Action will be sent once its processing is complete.

Q : What’s the difference between Struts 1.0 and Struts 1.1 ?
A : The new features added to Struts1 .1 are
RequestProcessor class .
Method perform() replaced by the execute() in Struts base Action Class .
Changes to web.xml and struts-config.xml.
Declarative exception handling.
Dynamic ActionForms
Plug-ins.
Multiple Application Modules.
Nested Tags.
The Struts Validator
Change to the ORO package
Change to Commons logging
Removal of Admin actions.
Deprecation of the GenericDataSource

Q : What is a Struts?
A : A Struts is a java framework based on Model 2 architecture of JSP or popularly called Model-View-Controller architecture. It’s provides a controller for this architecture.

Q : What are the core classes of Struts?
A : The core basic classes of Struts are Action, ActionForm, ActionServlet, ActionMapping, ActionForward.

Q : How is the Struts control data flow?
A : The Struts control implements the MVC/Layers pattern through the use of ActionForwards and ActionMappings to keep the control-flow decisions out of presentation layer.


Q : What is a ActionServlet?

A : The class org.apache.struts.action.ActionServlet is the called the ActionServlet. In the the Jakarta Struts Framework this class plays the role of the controller. All the requests to the server goes through the controller. Controller is responsible for the handling all the requests.

Q : In what way Struts relates to J2EE?
A: Struts framework is a built on J2EE technologies (JSP, Servlet, Taglibs), but it is a itself not part of the J2EE standard.

Q : Explain the Struts actions?
A : A Struts action is an instance of a subclass of an Action class, which is implemented by a portion of a Web application and whose perform or execute method returns a forward.

Q : Tell me some demerits of struts?
A: It is a very robust framework and is being used to extensively in the industry. But there are some disadvantages of the Struts:
a) High Learning Curve
b) Harder to learn

Q : What is the term action mapping?
A: Struts provides a number of tag libraries that helps to create a view components easily. These tag libraries are:
Bean Tags: Bean Tags are used to access the beans and their properties.
Logic Tags: Logic Tags provides presentation logics that eliminate the need for scriptlets.
HTML Tags: HTML Tags provides tags for creating the view components like forms, buttons, etc..
Nested Tags: Nested Tags helps to work with the nested context.

JMS Interview Questions & Answers

Q : What is JMS?
A : The Java Message Service is a Java API that allows applications to create and send, receive, and read messages. Designed by Sun and several partner companies, the JMS API defines a common set of interfaces and associated semantics that allow the programs written in the Java programming language to communicate with the other messaging implementations.

Q : What’s the difference between queue and topic?
A : A topic is typically used for one to many messaging i.e. it supports publish subscribe model of messaging. While queue is used for the one-to-one messaging i.e. it
supports Point to Point Messaging.

Q : What is an encryption options are there for sending messages through JMS?
A : Encryption is not handled by the JMS specification. It is left to the JMS provider to implement and provide encryption and decryption of messages. These days, Progress Software’s Sonic MQ is a leading the JMS provider and they have a robust encryption mechanism called Quality of Protection. They also provide an SSL-related feature, which is also has build in encryption.

Q :How does the Application server handle the JMS Connection?
• A : Application server is created the server session and stores them in a pool.
• Connection consumer uses the server session to put messages in the session of the JMS.
• Applications written by Application programmers creates the message listener.
• Server session is the one that spawns the JMS session.

Q : What is point-to-point messaging?
A : A point-to-point message passing is the sending application/client establishes a named message queue in the JMS broker/server and sends messages to this queue. The receiving client registers with the broker to receive the messages posted to this queue. There is a one-to-one relationship between the sending and receiving clients.

Q : What is the advantage of persistent message delivery compared to nonpersistent delivery?
A : If the JMS server experiences a failure, for example, a power outage, any message that it is holding in an primary storage potentially could be lost. With persistent storage, the JMS server is logs every message to secondary storage. (The logging occurs on the front end, that is, as part of handling the send operation from the message producing client.) The logged message is removed from secondary storage only after it has been successfully delivered to all the consuming clients.

Q : What is the difference between the Messaging and Mailing?
A: . Messaging is the way of communicating to the remote machines is using the Message Oriented Middlewares. Message Oriented Middlewares don’t use mailing internally for communication. They create their own channels for communication. Java Mailing is the set of APIs that primarily concerns with the sending of Mail messages through the standard mail protocols.

Q : What is a Stream Message ?
A : A Stream messages are a group of java primitives. It contains the some of convenient methods for reading the data. However the Stream Message prevents reading a long value as a short. This is so because the Stream Message also writes the type of information along with the value of the primitive type and enforces a set of strict conversion rules which actually prevents reading of one primitive type as another.

Q : What is the Role of the JMS Provider?
A : The role of the JMS provider is handles the security of the messages, data conversion and the client triggering. The JMS provider specifies the level of encryption and the security level of the message, the best data type for the non-JMS client.

Q What is the text message?
A : The text messages contains String messages (since being widely used, a separate messaging Type has been supported) . It is useful for exchanging textual data and complex character data like XML.

Q What is an object message ?
A : An Object message contains a group of serializeable java object. So it allows exchange of Java objects between applications. Sot both the applications must be Java applications

Q : What is Map message?
A : A Map message is contain the name of the value Pairs. The values can be of type primitives and its wrappers. The name is a string.

Q What is Byte Message ?
A Byte Messages contains a Stream of uninterrupted bytes. Byte Message contains an array of primitive bytes in it is payload. Thus it can be used for transfer of data between two applications in their native format which may not be compatible with other Message types. It is also to useful the where JMS is used purely as a transport between two systems and the message payload is opaque to the JMS client.

Q : What’s the difference between StreamMessage and BytesMessage?
A :The StreamMessage maintains a boundary between the different data types stored because it also stores the type information along with the value of the primitive being stored. BytesMessage stores the primitive data types by converting them to their byte representation. Thus the message is one the contiguous stream of bytes BytesMessage allows the data to be read using any type. Thus even if your payload contains a long value, you can invoke a method of to read a short and it will return you something. It will not give you a semantically correct data but the call will succeed in reading the first two bytes of data. This is strictly prohibited in the StreamMessage. It maintains the type information of the data being stored and enforces strict conversion rules on the data being read.

Q : How JMS is different from RPC?
A : In RPC the method is invoked the waits for the method to finish execution and return to the control back to the invoker. Thus it is completely synchronous in nature. While in the JMS the message sender just sends the message to the destination and continues it is the own processing. The sender does not wait for the receiver to respond. This is asynchronous behavior.

Q : What is main parts of JMS applications?
A :The main parts of JMS applications are:
ConnectionFactory and Destination
Session
Connection
MessageConsumer
MessageProducer
Message

Your Ad Here