Sail E0 Webinar

MCQs

Total Questions : 9
Question 1. The pop() method of the array does which of the following task ?
  1.    decrements the total length by 1
  2.    increments the total length by 1
  3.    prints the first element but no effect on the length
  4.    None of the above
 Discuss Question
Answer: Option A. -> decrements the total length by 1


Arrays have a pop() method (it works with push()) that reduces the length of an array by 1 but also returns the value of the deleted element.


Question 2. Consider the following statementsvar text = "testing: 1, 2, 3"; // Sample textvar pattern = /\d+/g // Matches all instances of one or more digitsIn order to check if the pattern matches with the string "text, the statement is
  1.    text==pattern
  2.    text.equals(pattern)
  3.    text.test(pattern)
  4.    pattern.test(text)
 Discuss Question
Answer: Option D. -> pattern.test(text)


The given pattern is applied on the text given in the parenthesis.


Question 3. What is the fundamental rule of lexical scoping?
  1.    Functions are declared in the scope
  2.    Functions are executed using scope chain
  3.    Both a and b
  4.    None of the mentioned
 Discuss Question
Answer: Option B. -> Functions are executed using scope chain


The fundamental rule of lexical scoping is that the JavaScript functions are executed using the scope chain that was in effect when they were defined.


Question 4. For the below mentioned code snippet:var o = new Object();The equivalent statement is:
  1.    var o = Object();
  2.    var o;
  3.    var o= new Object;
  4.    Object o=new Object();
 Discuss Question
Answer: Option C. -> var o= new Object;


You can always omit a pair of empty parentheses in a constructor invocation.


Question 5. What will happen if a return statement does not have an associated expression?
  1.    It returns the value 0
  2.    It will throw an exception
  3.    It returns the undefined value
  4.    None of the mentioned
 Discuss Question
Answer: Option C. -> It returns the undefined value


If the return statement does not have an associated expression, it returns the undefined value.


Question 6. JavaScript Code can be called by using
  1.    RMI
  2.    Triggering Event
  3.    Preprocessor
  4.    Function/Method
 Discuss Question
Answer: Option D. -> Function/Method


None


Question 7. One of the special feature of an interpreter in reference with the for loop is that
  1.    Before each iteration, the interpreter evaluates the variable expression and assigns the name of the property
  2.    The iterations can be infinite when an interpreter is used
  3.    The body of the loop is executed only once
  4.    All of the mentioned
 Discuss Question
Answer: Option A. -> Before each iteration, the interpreter evaluates the variable expression and assigns the name of the property


Before each iteration, the interpreter evaluates the variable expression and assigns the name of the property (a string value) to it.


Question 8. Consider the following code snippetfunction f(o) {     if (o === undefined) debugger;}What could be the task of the statement debugger?
  1.    It does nothing but a simple breakpoint
  2.    It debugs the error in that statement and restarts the statement's execution
  3.    It is used as a keyword that debugs the entire program at once
  4.    All of the mentioned
 Discuss Question
Answer: Option A. -> It does nothing but a simple breakpoint


The debugger statement normally does nothing. If, however, a debugger program is available and is running, then an implementation may (but is not required to) perform some kind of debugging action. In practice, this statement acts like a breakpoint: execution of JavaScript code stops and you can use the debugger to print variable's values.


Question 9. Consider the below given syntaxbook[datatype]=assignment_value;In the above syntax, the datatype within the square brackets must be
  1.    An integer
  2.    A String
  3.    An object
  4.    None of the mentioned
 Discuss Question
Answer: Option B. -> A String


When using square bracket notation, the expression inside the square brackets must evaluate to a sting or a value that can be converted to a string.


Latest Videos

Latest Test Papers