wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

React - Quiz

Total questions: 15

Worksheet time: 7mins

Name
Class
Date
1.

useEffect and useState are called

a)

React Objects

b)

React Arrays

c)

React Hooks

d)

None of the above

2.

const [count, setCount] = useState()
What is the value of count?

a)

0

b)

undefined

c)

null

d)

Syntax error

3.

How many arguments does useEffect has?

a)

1

b)

2

c)

3

d)

No arguments

4.

The second argument of the useEffect is called

a)

Dependency Array

b)

Default Array

c)

Dependency Object

d)

There is no second argument

5.

const [count, setCount] = useState()

What will be the value of count?

a)

undefined

b)

0

c)

null

d)


Syntax error

6.

<></> will be rendered on DOM

a)

True

b)

False

c)

Both True and False

d)

May be

7.

Which array method is used to render lists in react?

a)

forEach()

b)

loop()

c)

map()

d)

list()

8.

useEffect(() => {console.log('10')}, [])
How many times will 10 be printed on the console?

a)

1 time

b)

Only when state changes

c)

10 times

d)

0 times

9.

const { a, b } = { name: "John", age: 40 }
console.log(a)

a)

John

b)

40

c)

undefined

d)

Syntax Error

10.

const { height = 6.5 } = { name: "John", age: 40 }
console.log(height)

a)

undefined

b)

6.5

c)

null

d)

Syntax error

11.

const { a: c, b } = { a: 10, b: 20 }
console.log(a)

a)

ReferenceError: a is not defined

b)

10

c)

undefined

d)

Syntax Error

12.

const { a: c = 1, b } = { a: 10, b: 20, c: 30 }

console.log(c)

a)

1

b)

10

c)

30

d)

Syntax Error

13.

const [a, ...rest, b] = [10,20,30,40,50]
console.log(rest)

a)

20,30,40

b)

[20,30,40]

c)

Syntax Error

d)

undefined

14.

const [a, b, ...rest] = [10,20,30,40,50]

console.log(rest)

a)

[30,40,50]

b)

30,40,50

c)

Syntax Error

d)

undefined

15.

const { ...rest, a, b } = { a: 10, b: 20, c: 30, d: 40 }
console.log(rest)

a)

{a: 10, b: 20}

b)

{c: 30, d: 40}

c)

Syntax Error

d)

{c: 10, d: 20}