www.webdeveloper.com
Results 1 to 5 of 5

Thread: few interview questions

  1. #1
    Join Date
    Jul 2012
    Posts
    4

    few interview questions

    I have attached a javascript interview question sheet. kindly help me solve it.


    thanks
    mani
    Attached Files Attached Files

  2. #2
    Join Date
    Jul 2012
    Posts
    4
    Question:1
    Which of the following statements can you use to reload a page? [MULTIPLE CHOICE]


    a. location.reload();
    b. location.href = location.href;
    c. location.refresh();
    d. Page cannot be reloaded.


    Question:2
    Which of the following functions can you use to test whether an object was created with a specific constructor or not?


    a. instanceof
    b. typeof
    c. classof
    d. classname


    Question:3
    Which of the following ways can you use to prevent default action when a user clicks on a link on any browser?


    a. Use preventDefault method of event object on click event handler.
    b. Set returnValue of event object to false on click event handler.
    c. Return false value on click event handler.
    d. There is no way to prevent default action.











    Question:4
    Consider the following code snippet:

    if (document.addEventListener){
    alert("addEventListener");
    } else if (document.attachEvent){
    alert("attachEvent");
    }
    What does the alert box display on Internet Explorer?


    a. addEventLister
    b. attachEvent
    c. There is no alert box
    d. This code snippet is invalid


    Question:5
    What is the result of c in the following code snippet?

    var a = '1';
    b = 2 * a;
    c = typeof(b);


    a. char
    b. string
    c. number
    d. None of the above


    Question:6
    screen.pixelDepth is not available in Internet Explorer 7.


    a. True
    b. False







    Question:7
    Which of the following functions can be used to stop an event from propagating if you're using a W3C-compliant browser?


    a. stopPropagation
    b. endPropagation
    c. finishPropagation
    d. There are no such methods


    Question:8
    Which of the following is a good reason to avoid user agent sniffing?


    a. User can change the user agent.
    b. user agent is the same for all browsers.
    c. Some browsers do not have user agent.
    d. There is no reason to avoid user agent sniffing.


    Question:9
    What is the value of c in the following code snippet?

    var a = {f: 1};
    var b = a;
    b.f = 100;
    var c = a.f;


    a. undefined
    b. null
    c. 1
    d. 100

    Question:10
    What does the following statement do?

    document.title = "JavaScript";


    a. It changes the title of the current window to "JavaScript" but does not change the text of the title tag.
    b. It changes the text of «title» tag to "JavaScript".
    c. It changes the global title variable value to "JavaScript".
    d. This statement is invalid.


    Question:11
    one way to add functions to an object is by ___.


    a. adding functions to that object prototype.
    b. declaring a new function with that object name as prefix.
    c. There is no way to add functions to an existing object.

    Question:12
    Which of the following properties contains user agent string of web browser?


    a. window.navigator.userAgent
    b. document.Agent
    c. window.User_Agent
    d. window.clientType


    Question:13
    Assume that the document has the following tag:

    «div id="id1"»
    «div id="id11"»
    JavaScript
    «/div»
    «/div»

    What do you see after the following code snippet is executed?

    var a = document.findElementById("id1");
    document.body.appendChild(a.cloneNode(false));


    a. A "JavaScript" text is appended on the document.
    b. There is no change.
    c. This code snippet is invalid.




    Question:14
    Consider the code snippet given below:

    function a() {}
    function b() {}

    Which of the following statements makes "a" object inherit from "b" object?


    a. a.prototype = new b();
    b. a.prototype = b;
    c. a.extend(b);
    d. a.extend(new b());


    Question:15
    Which of the following ways can you use to verify that a browser supports document.getElementsByTagName function?


    a. if (document.getElementsByTagName)
    b. if (typeof(getElementsByTagName) == "function") {
    c. It is not possible to verify document.getElementsByTagName function


    Question:16
    What is the value of c in the following code snippet?

    function a() {}
    var b = a();
    var c = typeof(b);


    a. undefined
    b. a
    c. function
    d. object







    Question:17
    Consider the following code snippet:

    var a = document.getElementById("id1");
    a.onclick = function1;
    a.onclick = function2;

    Which function will be executed if a user clicks on id1 element?


    a. function1
    b. function2
    c. both
    d. none


    Question:18
    You can edit CSS rule using CSS Rule object on Firefox and rules object on Internet Explorer.


    a. True
    b. False

    Question:19
    What is the value of c in the following code snippet?

    function a() {}
    a.prototype.version = "1.8";
    var b = new a();
    var c = b.prototype.version;


    a. undefined
    b. null
    c. 1.8
    d. This code snippet causes an error







    Question:20
    In the W3C model, if you attach an anonymous function as an event handler of an element using addEventListener, how can you remove that anonymous function?


    a. By adding a named function as event hander, then using removeEventListener to remove it.
    b. By passing null argument to removeEventListener.
    c. The anonymous function cannot be removed.


    Question:21
    Which of the following method can you use to convert JSON data in responseText to JavaScript object?


    a. eval
    b. parseJSON
    c. convertToObject
    d. toJSON


    Question:22
    What is the result of c in the following code snippet?

    function a(name) {this.name = name;}
    var b = new a();
    var c = typeof(b.name);


    a. undefined
    b. null
    c. string
    d. object










    Question:23
    Consider the code snippet given below:

    var a = {a1: 1, a2: 2};
    var b = 0;
    for (i in a) {
    b += a[i];
    }

    Which of the following statements is(are) true?


    a. b == 0
    b. b == 1
    c. b == 2
    d. b » 2


    Question:24
    Which of the following XMLHttpRequest properties do you use to assign callback function to handle response to your request?


    a. onreadystatechange
    b. readystate
    c. responseText
    d. response

    Question:25
    Create the XMLHttpRequest is the same in all Internet Explorer browser versions.


    a. True
    b. False










    Question:26
    What is the value of b in the following code snippet?

    function a(){}
    var b = typeof(a.prototype);


    a. undefined
    b. null
    c. a
    d. object


    Question:27
    What does the following code snippet do?

    var a = document.getElementById('id1');
    a.onclick = function1();


    a. It executes function1 and returns its value to onclick attribute of id1 tag.
    b. It attaches function1 as click handler to id1 tag.
    c. This code snippet is invalid.


    Question:28
    What is the result of the following code snippet?

    function a() {alert(x);}
    function b() {var x = "function b"; a();}
    b();


    a. An alert box pops up showing "undefined".
    b. An alert box pops up showing "null".
    c. An alert box pops up showing "function b".
    d. This code snippet causes an error.







    Question:29
    What is the result of a in the following code snippet?

    function f(a, b, c){return true;}
    var a = f.length;


    a. undefined
    b. null
    c. 3
    d. This code snippet is invalid


    Question:30
    If you define function b() nested inside function a(), b() will be able to access variables in its own scope and function a() scope.


    a. True
    b. False


    Question:31
    Which of the following regular expression methods can you use to check whether there exists a pattern within the given string or not?


    a. check
    b. match
    c. test
    d. There are no such methods.


    Question:32
    What is the difference between location.replace() function and change location.href property?


    a. location.replace does not create an entry in history, whereas location.href does.
    b. location.replace creates an entry in history, whereas location.href does not.
    c. There is no difference.

    Question:33
    What is the result of c in the following code snippet?

    var a;
    function b(){
    var b = "b";
    a = function(){
    return b;
    }
    }
    b();
    c = a();


    a. undefined
    b. null
    c. b
    d. This code snippet is invalid.


    Question:34
    What is the result of the following comparison?

    null == null


    a. true
    b. false
    c. undefined
    d. This statement is invalid.


    Question:35
    What does the function typeof with an hash array parameter return?


    a. array
    b. string
    c. number
    d. object




    Question:36
    Which of the following values are false in equal comparison (==)? [MULTIPLE]


    a. null
    b. undefined
    c. ""
    d. 0


    Question:37
    Which of the following code snippet can you use to load CSS files dynamically?


    a. var headTag = document.getElementsByTagName("head")[0];
    var linkTag = document.createElement('link');
    linkTag.type = 'text/css';
    linkTag.rel = 'stylesheet';
    linkTag.href = 'main.css';
    linkTag.media = 'screen';
    headTag.appendChild(linkTag);
    b. var headTag = document.getElementsByTagName("head");
    var linkTag = document.createElement('link');
    linkTag.type = 'text/css';
    linkTag.rel = 'stylesheet';
    linkTag.href = 'main.css';
    linkTag.media = 'screen';
    headTag.appendChild(linkTag);
    c. var headTag = document.getElementsByTagName("head")[0];
    var linkTag = document.createElement('css');
    linkTag.rel = 'stylesheet';
    linkTag.href = 'main.css';
    headTag.appendChild(linkTag);
    d. It is not possible to load CSS files dynamically.










    Question:38
    What is the result of the following code snippet?

    var a = {f: 'object'};
    var b = {f: 'object'};
    var c = a == b;


    a. true
    b. false
    c. null
    d. This code snippet is invalid


    Question:39
    Assume that the header has the following code snippet:

    «script»
    var a = document.getElementById("id1");
    alert(a);
    «/script»

    What's wrong with this code snippet?


    a. At the time this code snippet is executed, the element with id1 does not exist.
    b. The function getElementById is not document's function.
    c. It cannot alert a DOM element.
    d. There is nothing wrong with the given code snippet.


    Question:40
    What does the following statement return?

    document.body.previousSibling;


    a. undefined
    b. null
    c. <head>
    d. <body>

  3. #3
    Join Date
    Jul 2012
    Posts
    4
    i hope now its easier for you to see the questions! plz suggest answers now !!

  4. #4
    Join Date
    Nov 2011
    Location
    Dallas, TX
    Posts
    340
    If someone here answers the questions do they get the job or will you be submitting the answers as your own

  5. #5
    Join Date
    Jul 2012
    Posts
    4
    Quote Originally Posted by Steve R Jones View Post
    If someone here answers the questions do they get the job or will you be submitting the answers as your own
    The test is over. Now i want to know answers. Hope it help others to practice as well.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles