Question - 1
Which is not Array methods in ES6?
- Array.of()
- Array.from()
- Array.prototype.find()
- Array.copy()
Solutions
Answer- D
Question - 2
- Acronym of JSON And XML
- Acronym of ECMAScript 6
- Acronym of Ex Scripting 6
- None Of the Above
Solutions
Answer- B
Question - 3
ECMAScript1 edition released in year of____
Answer- A
Question - 4
What is the final value of "obj" in the following example?
const obj = { foo: 1 };
obj.bar = 2;
- { foo: 1 }
- { foo: 1, bar: 2 }
- { foo: 1, 2: bar }
- None of the above
Solutions
Answer- B
Question - 5
Rest is a new way for functions to handle an arbitrary number of parameters. Can you guess what the mysterious "x" variable holds?
function mys(...params) {
return params;
}
let x = mys(1,23,4);
- "x" is undefined
- "x" becomes [1,23,4]
- "x" becomes "1 23 4"
- "x" becomes 1 23 4
Solutions
Answer- B
Question - 6
See the example below. Here given some interpolation features. check what is wrong.
let name = 'Marry';
let occupation = 'Farmer';
console.log(`Hi! My name is ${name}. I'm a ${occupation}.`);
- Nothing wrong with the example. This is how the feature works in ES6.
- The example is wrong. You can't break a String into lines in JavaScript.
- The example is wrong. You can't embed variables in String in JavaScript.
- None of the above.
Solutions
Answer- D
Question - 7
What value will this expression return?
let x, { x: y = 1 } = { x }; y;
Answer- A
Question - 8
What is a Promise() in ES6?
- Tool for managing asynchronous control flow. A promise represents an operation expected to complete in the future.
- The opposite of Amateurmise().
- Something you say, when you want someone to believe you.
- None of the above.
Solutions
Answer- A
Question - 9
function* gen() {
yield;
}
- 0
- 1
- undefinde
- None of above
Solutions
Answer- C
Question - 10
What is/are the advantages of the arrow function?
- It reduces code size.
- The return statement is optional for a single line function.
- Lexically bind the context.
- All the above
Solutions
Answer- D
Question - 11
What is stored in the triangle array?
let point = [1,3], segment = [point,[5,5]], triangle = [...segment,[1,8]];
- [ [1,3], [5,5], [1,8] ]
- [1,3,5,5,1,8]
- 23
- None of the above
Solutions
Answer- A
Question - 12
Which one is correct using the spread operator?
let num1 = [40,50,60];
let num2 = [10,20,30,...num1,70,80,90,100];
console.log(num2);
- [ 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 ]
- [ 40, 50, 60 ]
- [ 10, 20, 30, 70, 80, 90, 100 ]
- None of these
Solutions
Answer- A
Question - 13
ES6 gives an alternative way to assign variables. Can you guess what the below code does?
let a = 12, b = 3;
[a, b] = [b, a];
- Swaps the values inside a and b, without using extra variables.
- Makes both a and b equal 12.
- Creates an array that contains a and b.
- None of above
Solutions
Answer- A
Question - 14
function show(...args) {
let sum = 0;
for (let i of args) {
sum += i;
}
console.log("Sum = "+sum);
}
show(10, 20, 30);
- Sum = 60
- Undefined
- [10,20,30]
- [60]
Solutions
Answer- A
Question - 15
What are the states of promises in ES6?
- Pending
- Fulfilled
- Rejected
- All the above
Solutions
Answer- D
Question - 16
What will the result of this expression be?
typeof (new (class F extends (String, Array) { })).substring
- Error
- undefined
- object
- function
Solutions
Answer- B
Question - 17
- an Object
- a Class
- an array
- None of the above
Solutions
Answer- A
Question - 18
What do you mean by Babel?
- Babel is a JS Transpiler
- Babel is a JS Compiler
- Babel is a JS Library
- None of these
Solutions
Answer- A
Question - 19
How do you empty an array?
- Array. Length = 0;
- Array()= 0;
- Empty( Array ) =0;
- None of these
Solutions
Answer- A
Question - 20
- Immediately invoked function expressions
- Intermediate invoked function expressions
- Internal invoked function expressions
- None of these
Solutions
Answer- A
Practice more set questions