11 12

Top 30 java interview questions and answers

Vijay Kumar said. very very good yar. May 12, 2014 at 10:48 AM Anonymous said. give any example except Singleton .What do you mean by this?.Can you. Check out top 30 JavaScript interview questions and answers. And get familiar with the essential concepts asked during web developer interviews. Review the top 50 interview questions asked by. Top 50 Interview Questions With Answers. Job Interview Questions and Answers; Top 10 Job Interview Tips. Practice the top Java Grounds Interview Questions and Answers. With over 30 interview questions and 978 interview answers. Java. Java Interview Questions;. Home / Latest Articles / Java & Javascript / Top 100 Java Interview Questions with Answers. 30. 31. 32. 33. Review the top 20 interview questions you ll most likely be asked at a job. Top 20 Job Interview Questions and Answers. Search the site GO. Job.

Questions Phone for Top 30 Java Interview Freshers. Answers

Top 50 Interview Questions and Answers - The Balance

<onload()>, <onunload()>, <onresize()>

<onload()>, <onunload()>, <onresize()>

Whenever the DOM receives an event, it calls the JavaScript event handler function bind to the event. To use a handler function, we can assign it to the desired event as an attribute of the target HTML element. Please follow the below example.

<HTML> <BODY> <FORM> <INPUT TYPE=”button” VALUE=”Test” onClick=”window.alert ('Event Handler')”> </FORM> </BODY> </HTML>

1

2

3

4

5

6

7

8

9

10

11

12

13

<HTML>

<BODY>

<FORM>

<INPUT TYPE=buttonVALUE=TestonClick=window.alert ('Event Handler')>

</FORM>

</BODY>

</HTML>

Q-26. What does a JavaScript function result when it has no return statement?

Answer.

If a function doesn’t use the return statement, then it returns undefined as the return value.

However, the browser won’t print anything in its console as it ignores if the expression returns an undefined value. But if we explicitly call such a function inside the console.log() method, then it’ll print exact value.

function test(){} console.log(test()); // will print 'undefined'

function test(){}

console.log(test()); // will print 'undefined'

Q-27.

  • An expiry date after which the cookie is no longer valid.
  • The domain and path of the server it should be sent to.
  • When a request arrives at the server for a web page that maintains a cookie, the server appends the cookie to the HTTP header to send it across. Server side programs can then read out the information included in it and decide that you have the right to view the page or not and other user preferences.

    Thus, every time you visit the site that maintains the cookies, your information is available there.

    Q-15. Which built-in method adds one or more elements to the end of an array and returns the new length of the array?

    Answer.

    The push() method adds one or more elements to the end of an array and returns the new length of the array.

    Q-16. What is the naming conventions for the variables in JavaScript?

    Answer.

    We have to follow the below rules while naming the variables in JavaScript.

    • Do not use any of the JavaScript reserved keywords as a name for your variable. For example, “break” or “boolean” are JavaScript keywords, and if used as variable names, it’s invalid.

    Q-12. What is variable typing in JavaScript?

    Answer.

    JavaScript is very loosely typed language. It means that the variables are declared without a type. Its type is determined once a value is assigned to it. It can change as the variable appears in different contexts.

    It’s in contrast to the strongly typed languages that require type declarations.

    Consider the following examples.

    /* JavaScript Example (loose typing) */ var a = 13; // Number declaration var b = "thirteen"; // String declaration /* Java Example (strong typing) */ int a = 13; // int declaration String b = "thirteen"; // String declaration

    1

    2

    3

    4

    5

    6

    7

    8

    9

    10

    11

    12

    13

    /* JavaScript Example (loose typing) */

    var a = 13; // Number declaration

    var b = "thirteen"; // String declaration

    /* Java Example (strong typing) */

    int a = 13; // int declaration

    String b = "thirteen"; // String declaration

    Variable type in JavaScript is determined internally. In the above example, var ‘a’ will be of type ‘Number’ and var ‘b’ will be of type ‘String’.

    Q-13. What are the different ways to create an array in JavaScript?

    Answer.

    There are two main ways to create an array in JavaScript.

    1. Using an array initializer (array literal).

    The array initializer (array literal) syntax is simple.

    • JavaScript will throw an error if we try to use the elements of a deprecated language.
    • To use a variable, it has become mandatory to declare it.
    • It disallows duplicate property and parameter names.
    • The eval() method is safer to use, but still considered evil in some cases.
    • It deprecates the “with” statement.
    • JavaScript will throw an error if we try to assign a value to a read-only property.
    • It decreases the global namespace pollution.

    To enable strict mode, we have to add, “use strict” directive to the code. The physical location of the “strict” directive determines its scope. If used at the beginning of the js file, its scope is global. However, if we declare strict mode at the first line in the function block, its scope restricts to that function only.

    Q.25- What are event handlers in JavaScript and how to use them?

    Answer.

    JavaScript event handlers are functions that bind to a specific HTML DOM event. And events are the part of HTML document object model (DOM).

    Comments

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>