0% found this document useful (0 votes)
19 views4 pages

Ducat React

The document contains code snippets and questions related to React concepts like components, hooks, props vs state, and JavaScript concepts like data types, promises, and asynchronous functions. Multiple choice questions test knowledge of React features like virtual DOM, props, state, and performance optimizations.

Uploaded by

Manas Ghosh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views4 pages

Ducat React

The document contains code snippets and questions related to React concepts like components, hooks, props vs state, and JavaScript concepts like data types, promises, and asynchronous functions. Multiple choice questions test knowledge of React features like virtual DOM, props, state, and performance optimizations.

Uploaded by

Manas Ghosh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Write code snippets:

1.) Write component in react for simple increase counter and decrease counter.

2.) ['apple','mango','cherry','apple','guava','cherry','pineApple']

Write a program to get no of times each fruit comes in an array.

3.) ['apple','mango','cherry','apple','mango']
Write a program to replace first mango with lemon.

4.)

Write a program to print above pattern. Any preffered language.


5.) string is: satin credit care network ltd.
Convert the first letter of every word in a sentence to capital letter.
For example: Satin Credit Care Network Ltd.

Question/Answers.

1.) Difference b/w virtual DOM & Real DOM ?

2.) Explain below hooks:

-> useState

-> useEffect

-> useMemo
-> useCallBack

3.) Difference between props and state. Explain with example.?

4.) Write all primitive and Non-primitive data types in JavaScript with example.
5.) What are promises in JavaScript ? Explain with example.
6.) How to center a <div> inside a <div> using Flexbox property of CSS ?
Multiple choice
1.) setState is ___ ?
a.) synchronous

b.) asynchronous ?

2.) Can we have multiple or single return in any component ?


a.) Yes
b.) No

3.) Which of the following is used in React.js to increase performance?


a.) Virtual Dom

b.) Real Dom


c.) Both
d.) None
4.) Which of the following is used to pass data to a component from outside in React?

a.) props

b.) state

c.) render with arguments

d.) propTypes
5.) Which of the following is correct about prop in react?

a) Can be changed inside another component

b) Can be changed inside the component

c) Cannot be changed in the component

d) All of the mentioned

6.) What would be the output of following code?

console.log(employeeId);

var employeeId = '19000';

a.) Some Value


b.) undefined
c.) Type Error
d.) ReferenceError: employeeId is not defined

7.) Which of the following methods is used to access HTML elements using JavaScript?

a.) getElementById()

b.) getElementsByClassName()

c.) Both A and B


D.) None

8.) What will be the output of the following code snippet?

var a = 1;

var b = 0;
while (a <= 3)

{
a++;

b += a * 2;

console.log(b);

a.) 4 10 18

b.) 1 2 3
c.)1 4 7

d.) None of the above

9.) What keyword is used to declare an asynchronous function in JavaScript?


a.) async

b.) await

c.) setTimeout
d.) None
10.) What would be the output of following code?

var strA = "hi there";

var strB = strA;

strB="bye there!";

console.log (strA);

a.) hi there

b.) bye there!

You might also like