120+ JavaScript Mcq/Quiz Questions, Quizzes of Programming Languages

This is Quiz document containing MCQ'S topic wise.

Typology: Quizzes

2022/2023

Available from 09/12/2022

technicalurvashi
technicalurvashi 🇮🇳

4 documents

1 / 28

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
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 <script> tag
How can you add a comment in a JavaScript
What is the correct way to write a JavaScript array
JavaScript is the same as Java
How do you declare a JavaScript variable
Which operator is used to assign a value to a variable
What will the following code return: Boolean(10 > 9)
Is JavaScript case-sensitive?
which of the following is not a comparison operator
Javascript is a _____ language.
Which of the following purpose, JavaScript is designed for
JavaScript can be written
regex & type conversion
What does the subexpression /java(script)?/ result in ?
What will be the result when non greedy repetition is used on the pattern /a+?b/ ?
What is the most essential purpose of parantheses in regular expressions ?
The method that performs the search-and-replace operation to strings for pattern matching is
Introduction, Language Basics, Where to Include & Display Js code?
Variables and Operators, Arithmetic, Assignment, Comparisons,
Logical
Data Types in JavaScript: Strings, Numbers, Boolean, Objects, Arrays
What is the correct JavaScript syntax to change the content of the
HTML element below?
<p id="demo">This is a demonstration.</p>
JavaScript code is written inside file having extension
What will be the output of the following code snippet?
a = [1, 2, 3, 4, 5];
print(a.slice(2, 4));
What will be the output of the following code snippet?
var a = true + true + true * 3;
print(a)
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c

Partial preview of the text

Download 120+ JavaScript Mcq/Quiz Questions and more Quizzes Programming Languages in PDF only on Docsity!

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?

DOM

: 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

BOM

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

ES

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

GUI

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

["123""

]

Returns

["123","

"]

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