wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

IMSD_Week-8_CSE-1

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

How do you create a custom object using an object literal?

a)

let obj = new Object();

b)

let obj = {};

c)

let obj = Object();

d)

let obj = object.create();

2.

What is the correct syntax for adding a property to an object?

a)

obj = name.value;

b)

obj[name] = value;

c)

addProperty(obj, name, value);

d)

obj.property(name, value);

3.

What is the output?

function Person(name) {

this.name = name;

}

let p1 = new Person("John");

console.log(p1.name);

a)

undefined

b)

John

c)

error

d)

null

4.

Which method returns an array of property names of an object?

a)

Object.keys(obj)

b)

Object.get(obj)

c)

Object.list(obj)

d)

obj.keys()

5.

What will this code log?

let obj = {x:10, y:20};

delete obj.y;

console.log(obj.y);

a)

20

b)

null

c)

undefined

d)

error

6.

What does the expression /[0-9]+/ match?

a)

Only a single digit

b)

One or more digits

c)

Any alphabet

d)

Whitespace

7.

The regular expression /\s+/ matches:

a)

A single space

b)

Any non-space character

c)

One or more whitespace characters

d)

A tab only

8.

Which method replaces text using a regex pattern?

a)

replace()

b)

search()

c)

exec()

d)

test()

9.

What is the output of the code below?

console.log(/cat/.test("concatenate"));

a)

false

b)

undefined

c)

error

d)

true

10.

What does /^A/.test("Apple") return?

a)

false

b)

true

c)

error

d)

0