Few basic JavaScript questions

Discussion in 'JavaScript and AJAX' started by pradeep, Apr 5, 2006.

  1. pradeep

    pradeep Team Leader

    Apr 4, 2005
    Likes Received:
    Trophy Points:
    Kolkata, India
    Home Page:
    /* start code */
     function getNum(x)
         x += 3;
             return x;
         x *= 3;
         return x;
    What will the above decalred function return when called like this getNum(4); ?

    a> 9
    b> 7
    c> 21
    d> 8

    Which company first implemented the JavaScript language?

    a> Netscape Communications Corp.
    b> Microsoft Corp.
    c> Sun Microsystems Corp.
    d> Consortium of the above companies

    When was the first release of a browser supporting JavaScript?

    a> 1994
    b> 1995
    c> 1996
    d> 1997

    The original name of JavaScript was

    a> JavaScript
    b> LiveScript
    c> WireScript
    d> ECMAScript

    The JavaScript international standard is called

    a> ECMA-262 Standard
    b> DHTML JavaScript Standard
    c> JavaScript 1.3 Standard
    d> ISO-262 Standard

    Which of the following statements best describes the relationship between JavaScript and DHTML?

    a> JavaScript is DHTML plus CSS plus Document Object Model.
    b> DHTML is Document Object Model plus JavaScript plus CSS.
    c> Document Object Model is JavaScript plus DHTML plus CSS.
    d> JavaScript has nothing to do with DHTML.

    What label catches all values except those specified in “switch” statement?

    a> otherwise
    b> default
    c> any
    d> all

    How do you locate the first X in a string txt?

    a> txt.find('X');
    b> txt.locate('X');
    c> txt.indexOf('X');
    d> txt.countTo('X');

    Which of these contains an executable statement?

    a> // var a = 0; // var b = 0;
    b> /* var a = 0; // var b = 0; */
    c> /* var a = 0; */ var b = 0;
    d> // var a = 0; /* var b = 0; */

    What does ++ operator do?

    a> Adds two numbers together
    b> Joins two text strings together
    c> Adds 1 to a number
    d> Adds 2 to a number

    Which of the following does not result in a variable going out of scope?

    a> End of the block in which it was defined
    b> Start of a block in which a like named variable is defined
    c> when a function is called
    d> when the program finishes running

    Which of these is not a logical operator?

    a> &&
    b> &
    c> ||
    d> !

    What does the following statment return, Math.floor(29.36); ?

    a> 30
    b> 29.5
    c> 29
    d> 29.4

    /* start code */
     var a = ["s","a","v","e"];
    What would be the output of the above code fragment?

    a> undefined
    b> save
    c> vase
    d> s

    /* start code */
    var a = 0;
    var b = 1;
    var c = a || b;

    What does the variable c contain??

    a> 0
    b> true
    c> false
    d> null

    What would be the output of the follow statement, document.write("JavaScript ".length); ?

    a> 9
    b> 10
    c> 11
    d> null
  2. jagu_rita

    jagu_rita New Member

    Jul 21, 2007
    Likes Received:
    Trophy Points:
    Can you please tell answers for javascript codes?
  3. shabbir

    shabbir Administrator Staff Member

    Jul 12, 2004
    Likes Received:
    Trophy Points:
    Don't have them here or that would be the spoilers. You can have a separate thread and link to it from here.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice