




















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This is Quiz document containing MCQ'S topic wise.
Typology: Quizzes
1 / 28
This page cannot be seen from the preview
Don't miss anything!





















Question
Inside which HTML element do we put the JavaScript
Where is the correct place to insert a JavaScript
What is the correct syntax for referring to an external script called "xxx.j
The external JavaScript file must contain the What would be the result of the following statement in JavaScript using regular expression methods?
Which of the following function of String object is used to find a match between a regular expression and a string
closures & prototype
What kind of scoping does JavaScript use?
What must be done in order to implement Lexical Scoping?
What is a closure?
Which of the following are examples of closures?
Which object in Javascript doesn’t have a prototype
Which of the following uses a lot of CPU cycles?
: When will the browser invoke the handler?
Which property specifies the property of the event?
: The process by which the browser decides which objects to trigger event handlers on is
Which form of event propogation handles the registered container elements?
The events that are directly tied to a specific input device are
Among the keywords below, which one is not a statement?
Function and events
How do you create a function in JavaScript
How do you call a function named "myFunc"
how many parmetrs can be passed to a function
The function definitions in JavaScript begins with
What is the purpose of a "return" statement in a function?
Which event occurs when the user clicks on an HTML element
How do you write "Hello World" in an alert box
How can you detect the client's browser name
Which of the following is the correct syntax to redirect a url using JavaScript?
Which method receives the return value of setInterval() to cancel future invocations?
The setTimeout() belongs to which object?
Which method receives the return value of setTimeout() to cancel future invocations?
What will happen if we call setTimeout() with a time of 0 ms?
To which object does the location property belong?
Loops
How to write an IF statement in JavaScript
How to write an IF statement for executing some code if "i" is NOT equal to 5
How does a WHILE loop start
What will be the output of the following code snippet?
let sum = 0;
const a = [1, 2, 3];
a.forEach(getSum);
console.log(sum);
function getSum(ele) {
sum += ele;
What will be the output of the following code snippet?
(function(a){
return (function(){
console.log(a);
a = 6;
What is the correct JavaScript syntax for opening a new window called "w2"
How to generate random number?
Promise Callback
var p = new Promise((resolve, reject) => {
reject(Error('The Fails!'))
p.catch(error => console.log(error.message))
p.catch(error => console.log(error.message))
What will the output be?
var p = new Promise((resolve, reject) => {
reject(Error('The Fails!'))
.catch(error => console.log(error))
.then(error => console.log(error))
What will the output be?
var p = new Promise((resolve, reject) => {
reject(Error('The Fails!'))
.catch(error => console.log(error.message))
.catch(error => console.log(error.message))
What will the output be?
Promise.resolve('Success!')
.then(data => {
return data.toUpperCase()
.then(data => {
console.log(data)
What will the output be?
Flow between .then’s
Promise.resolve('Success!')
.then(data => {
data.toUpperCase()
.then(data => {
console.log(data)
What will the output be?
Which built-in method calls a function for each element in the array
What will be the output of the following code snippet? function
test(...args) {
console.log(typeof args);
test(12);
Constants are block-scoped variables.
What will be the output of the following code snippet? const obj1 =
{first: 20, second: 30, first: 50};
console.log(obj1);
What will be the output of the following code snippet?
const obj1 = {Name: "Hello", Age: 16};
const obj2 = {Name: "Hello", Age: 16};
console.log(obj1 === obj2);
What is the final value of "obj" in the following example?
const obj = { foo: 1 };
obj.bar = 2;
What will be the output of the following code
function mystery(...params) {
return params;
let a = mystery(1,23,4);
What will be the output of the following code? let name = 'Harry';
let occupation = 'wizard';
console.log(Hi! My name is ${name}. I'm a ${occupation}.);
What value will this expression return?
let x, { x: y = 1 } = { x }; y;
What will this function return?
(function() {
let f = this? class g { } : class h { };
return [ typeof f, typeof h ];
Why is super used?
Which of the following statements is not true about this example?
const obj = {
outer: function() {
const self1 = this
const inner1 = () => {
const self2 = this
const inner2 = () => {
const self3 = this
Option 1
document.getElementById('demo').innerHtml
ript using regular expression methods? a match between a regular expression and a string, Lexical Base object Throws an exception concat() Reference the current scope chain All of the Above All of the Above
rigger event handlers on is
ainer elements?
function = myFun()
call myFunc()
one
Identifier and Parantheses
onclick
Any event occurs
Manner
Event Handling
Default Actions
State change events
use strict
Stops executing the function and returns
the value
msgBox()
w2 = window.open()
browser.name
sing JavaScript?
ncel future invocations?
ncel future invocations?
if(x == 6)
NOT equal to 5 if(x <> 5)
while(i< =10)
w called "w2"
document.location='http://www.newlocati
on.com';
clearInterval()
clearInterval()
clearSchedule()
Placed in stack
Position
Math.random()
while()
Nan
print message twice
print error and undefined
print error message once
print "SUCCESS!"
print "SUCCESS!"
syntax error
self2 !== self
{ foo: 1, bar: 2 }
"a" becomes [1,23,4]
Nothing wrong with the example. This is
how the feature works in ES6.
["function", "function"]
Is used as a "function" which calls the
parent's constructor.
Option 2 Option 3 Option 4
document.getElementByName(p).in#demo.inndocument.getElement('demo').innerHtml = 'hello'
both
match() search() replace()
Literal
None of the Above
None of the Above
all object have prototype none of above
All of the Above
Returns [1,2,3,4,5,6,7,8,9]
Returns
Returns
Sequential
Segment
al
Get the object
Derefere
nce the
current
scope
chain
Scope
where
function
variables
are
resolved
Function
objects
Functions Objects
Variables
Dynamically generated graphics
Statically
generate
d
graphics