Home / CSE / Javascript - CS :: Basic and Variables

CSE :: Javascript - CS

  1. Consider the following code snippet

    function printArray(a)

    {

    var len = a.length, i = 0;

    if (len == 0)

    console.log("Empty Array");

    else

    {

    do

    {

    console.log(a[i]);

    } while (++i < len);

    }

    }

    What does the above code result?

  2. A.

     Prints the numbers in the array in order

    B.

     Prints the numbers in the array in the reverse order

    C.

     Prints 0 to the length of the array

    D.

     Prints “Empty Array”

    View Answer

    Workspace

    Discuss Discuss in Forum


  3. What are the three important manipulations done in a for loop on a loop variable?

  4. A.

     Updation, Incrementation, Initialization

    B.

     Initialization,Testing, Updation

    C.

     Testing, Updation, Testing

    D.

     Initialization,Testing, Incrementation

    View Answer

    Workspace

    Discuss Discuss in Forum


  5. Consider the following code snippet

    function tail(o)

    {

    for (; o.next; o = o.next) ;

    return o;

    }

    Will the above code snippet work? If not, what will be the error?

  6. A.

     No, this will throw an exception as only numerics can be used in a for loop

    B.

     No, this will not iterate

    C.

     Yes, this will work

    D.

     No, this will result in a runtime error with the message “Cannot use Linked List”

    View Answer

    Workspace

    Discuss Discuss in Forum


  7. One of the special feature of an interpreter in reference with the for loop is that

  8. A.

     Before each iteration, the interpreter evaluates the variable expression and assigns the name of the property

    B.

     The iterations can be infinite when an interpreter is used

    C.

     The body of the loop is executed only once

    D.

     All of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum


  9. What will happen if the body of a for/in loop deletes a property that has not yet been enumerated?

  10. A.

     The property will be stored in a cache

    B.

     The loop will not run

    C.

     That property will not be enumerated

    D.

     All of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum


  11. What will be the step of the interpreter in a jump statement when an exception is thrown?

  12. A.

     The interpreter stops its work

    B.

     The interpreter throws another exception

    C.

     The interpreter jumps to the nearest enclosing exception handler

    D.

     None of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum


  13. Consider the following code snippet

    while (a != 0)

    {

    if (spam>a == 1)

    continue;

    else

    a++;

    }

    What will be the role of the continue keyword in the above code snippet?

  14. A.

     The continue keyword restarts the loop

    B.

     The continue keyword skips the next iteration

    C.

     The continue keyword skips the rest of the statements in that iteration

    D.

     None of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum


  15. Consider the following code snippet

    function f(o)

    {

    if (o === undefined) debugger;

    }

    What could be the task of the statement debugger?

  16. A.

     It does nothing but a simple breakpoint

    B.

     It debugs the error in that statement and restarts the statement’s execution

    C.

     It is used as a keyword that debugs the entire program at once

    D.

     All of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum


  17. Among the keywords below, which one is not a statement?

  18. A.

     debugger

    B.

     with

    C.

     if

    D.

     use strict

    View Answer

    Workspace

    Discuss Discuss in Forum


  19. The unordered collection of properties, each of which has a name and a value is called

  20. A.

     String

    B.

     Object

    C.

     Serialized Object

    D.

     All of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum