1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Few basic JavaScript questions

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

  1. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,646
    Likes Received:
    86
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
    Code:
    /* start code */
     function getNum(x)
     {
         x += 3;
         if(x)
             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

    Code:
    /* start code */
     var a = ["s","a","v","e"];
     document.write(a.join(""));
    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

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

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,283
    Likes Received:
    364
    Trophy Points:
    83
    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