Sail E0 Webinar

MCQs

Total Questions : 67 | Page 6 of 7 pages
Question 51. Consider the following code snippet
function oddsums(n)
{
let total = 0, result=[];
for(let x = 1; x
  1.    Returns [1,4,9,16,25]
  2.    Returns [1,2,3,4,5]
  3.    Returns [3,6,9,12,15]
  4.    Returns [1,3,5,7,9]
 Discuss Question
Answer: Option A. -> Returns [1,4,9,16,25]
Question 52. Consider the following code snippet
console.log(p)
If p is not defined, what would be the result or type of error?
  1.    Zero
  2.    Null
  3.    ReferenceError
  4.    ValueNotFoundError
 Discuss Question
Answer: Option C. -> ReferenceError
Question 53. Consider the following code snippet
let x=x+1;
console.log(x);
What will be the result for the above code snippet?
  1.    0
  2.    Null
  3.    ReferenceError
  4.    NaN
 Discuss Question
Answer: Option D. -> NaN
Question 54. Consider the following code snippet
[x,y]=[y,x];
What is the result of the above code snippet?
  1.    Throws exception
  2.    Swap the value of the two variables
  3.    Flashes an error
  4.    Creates a new reference object
 Discuss Question
Answer: Option C. -> Flashes an error
Question 55. Which looping statement allows XML tags to appear in JavaScript programs and adds API for operating on XML data?
  1.    for loop
  2.    while loop
  3.    for/each loop
  4.    all of the mentioned
 Discuss Question
Answer: Option C. -> for/each loop
Question 56. Which exception does the Iterators throw from their next() method when there are no more values to iterate, that work on finite collections ?
  1.    ExitIteration
  2.    AbortIteration
  3.    Abort
  4.    StopIteration
 Discuss Question
Answer: Option D. -> StopIteration
Question 57. Which method of the iterable object returns an iterator object for the collection?
  1.    iterator()
  2.    _iterator_()
  3.    _iteration_()
  4.    _return_iterator_()
 Discuss Question
Answer: Option B. -> _iterator_()
Question 58. Consider the following code snippet
let succ = function(x) x+1, yes = function() true, no = function() false;
What convenience does the above code snippet provide?
  1.    Functional behaviour
  2.    Modular behaviour
  3.    No convenience
  4.    Shorthand expression
 Discuss Question
Answer: Option A. -> Functional behaviour
Question 59. Consider the following code snippet
data.sort(function(a,b),b-a);
What does the above code do?
  1.    Sort in the alphabetical order
  2.    Sort in the chronological order
  3.    Sort in reverse alphabetical order
  4.    Sort in reverse numerical order
 Discuss Question
Answer: Option D. -> Sort in reverse numerical order
Question 60. What is the code to be used to trim whitespaces ?
  1.    let trimmed = (l.trim() for (l in lines));
  2.    let trimmed = (trim(l));
  3.    let trimmed = l.trim();
  4.    let trimmed = for(l in lines));
 Discuss Question
Answer: Option A. -> let trimmed = (l.trim() for (l in lines));

Latest Videos

Latest Test Papers