Showing posts with label jsp. Show all posts
Showing posts with label jsp. Show all posts

Jsp Interview Faqs

Jsp Interview Faqs
Q:  What is a Expression?
A: An expression tag contains a scripting language expression that is evaluated, converted to a String, and inserted where the expression appears in the JSP file. Because the value of an expression is converted to a String, you can use an expression within text in a JSP file. Like
<%= someexpression %>
<%= (new java.util.Date()).toLocaleString() %>
You cannot use a semicolon to end an expression

Q: What is a Declaration?
A: A declaration declares one or more variables or methods for use later in the JSP source file.
A declaration must contain at least one complete declarative statement. You can declare any number of variables or methods within one declaration tag, as long as they are separated by semicolons. The declaration must be valid in the scripting language used in the JSP file.
<%! somedeclarations %>
<%! int i = 0; %>
<%! int a, b, c; %>

Q:  What is a Scriptlet?
A: A scriptlet can contain any number of language statements, variable or method declarations, or expressions that are valid in the page scripting language.Within scriptlet tags, you can
1.Declare variables or methods to use later in the file (see also Declaration).
2.Write expressions valid in the page scripting language (see also Expression).
3.Use any of the JSP implicit objects or any object declared with a tag.
You must write plain text, HTML-encoded text, or other JSP tags outside the scriptlet.

Scriptlets are executed at request time, when the JSP engine processes the client request. If the scriptlet produces output, the output is stored in the out object, from which you can display it.

Java script Interview questions and answers

Java script Interview Faqs
  1. What’s relationship between JavaScript and ECMAScript? - ECMAScript is yet another name for JavaScript (other names include LiveScript). The current JavaScript that you see supported in browsers is ECMAScript revision 3.
  2. What are JavaScript types? - Number, String, Boolean, Function, Object, Null, Undefined.
  3. How do you convert numbers between different bases in JavaScript? - Use the parseInt() function, that takes a string as the first parameter, and the base as a second parameter. So to convert hexadecimal 3F to decimal, use parseInt (”3F”, 16);
  4. What does isNaN function do? - Return true if the argument is not a number.
  5. What is negative infinity? - It’s a number in JavaScript, derived by dividing negative number by zero.
  6. What boolean operators does JavaScript support? - &&, || and !
  7. What does “1″+2+4 evaluate to? - Since 1 is a string, everything is a string, so the result is 124.
  8. How about 2+5+”8″? - Since 2 and 5 are integers, this is number arithmetic, since 8 is a string, it’s concatenation, so 78 is the result.
  9. What looping structures are there in JavaScript? - for, while, do-while loops, but no foreach.
  10. How do you create a new object in JavaScript? - var obj = new Object(); or var obj = {};
  11. How do you assign object properties? - obj[”age”] = 17 or obj.age = 17.
  12. What’s a way to append a value to an array? - arr[arr.length] = value;
  13. What is this keyword? - It refers to the current object.

JSP Interview Questions and answers

JAVA SCRIPT Interview Questions and answers
Can Javascript code be broken in different lines?
Yes,
Breaking is possible within a string statement by using a backslash "\" at the end .
Ex:
document.write("Good Morning. \
I am Mr. John");
But it is not possible within any other javascript statement.
Ex :
is possible but not
document.write \
("Good Morning. I am Mr. John");
What does break and continue statements do in JavaScript?
Continue statement continues the current loop (if label not specified) in a new iteration whereas break statement exits the current loop in JavaScript.
Explain about the Boolean functions present in Javascript?
Three Boolean operators are present in Javascript they are
1) &&
2) II
3) /
All the operators are regarded as true unless the Javascript regards them as false. You can define these operators to make as statement false number0, null, undefined, or a string of length 0, etc. Boolean function performs these conversions explicitly.
What is the difference between an alert box and a confirmation box?
An alert box displays only one button which is the OK button whereas the Confirm box displays two buttons namely OK and cancel.
How to validate a Email-address, in Form using JavaScript?
We can validate it through the reg expressions. For example we can declare all the reg expressions of the email in a variable as follows.
var reg = /^([A-Za-z0-9_-.])+@([A-Za-z0-9_-.])+.([A-Za-z]{2,4})$/; We need to compare the actual value with this expression for the validation.
How do you declare 2 dimensional array in Javascript?
myarray[0][0]="Compaq 486"
myarray[0][1]="Compaq 586"
myarray[0][2]="Compaq 686"
myarray[1][0]="Dell 486"
myarray[1][1]="Dell 586"
myarray[1][2]="Dell 686"
myarray[2][0]="IBM 486"
myarray[2][1]="IBM 586"
myarray[2][2]="IBM 686"
How do you Implement Timer Control in Javascript?
set Timedout("alert('5 seconds')",5000); Here the argument 5000 shows the millisecond value.
Whether VBscript or Javascript which is better?
Javascript. Since it is platform independent.
Whether Javascript is a OOP's based language?
No. It doesn't support all the concepts of OOPS. It supports partially.