0% found this document useful (0 votes)
189 views9 pages

React JS Question Bank

Yhhhhhhuestion bank react js

Uploaded by

k4880067
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)
189 views9 pages

React JS Question Bank

Yhhhhhhuestion bank react js

Uploaded by

k4880067
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/ 9

React JS Question Bank

Section A: Theoretical/Conceptual Questions

1. Explain React Architecture.


2. Explain Life Cycle methods of React JS.
3. Explain the basic setup and advanced configurations for a React application.
4. Explain the key concepts of Redux and how middleware can be used in Redux.
5. Explain ES6 features.
6. How to make API calls in a React application?
7. How to interact or communicate with a Node.js server in a React application?
8. How does Virtual DOM work in React?
9. What is JSX?
10. Explain the types of components in React.
11. What is the difference between state and props?
12. What is a Controlled Component in React?
13. What is a higher-order component (HOC)? Explain with an example.
14. Explain Redux.
15. Explain the new features introduced in HTML5.
16. Which tools are used in your organization to build applications?
17. What is connect in Redux ?
18. Differentiate between slice and splice.
19. Differentiate between map and forEach.
20. What is Redux-saga?
21. Differentiate between let, var, and const.
22. What is setState in React?
23. Define Higher Order Component (HOC) in React.
24. What is PureComponent in React?
25. What is Rendering in React JS?
26. How to connect React to Redux?
27. Difference between stateful and stateless components in React.
28. How to update state in React?
29. Difference between Redux and Flux.
30. How would you conditionally render a component in the render function?
31. What are the essential components required to design a shopping cart for an ecommerce
website where products are displayed with an "Add to Cart" button, and on clicking the button,
the cart gets updated?
32. What is the advantage of choosing props over states?
33. Can you provide a detailed explanation of how to submit a form using react-redux form
and display success/error messages based on the response?
34. How would you redirect to a route in React?
35. How can we directly access DOM in react?
36. Which build tool do you use to create a production-ready build for React applications, and
what steps do you take to optimize the build size and ensure minimal file size for efficient
production deployment?
37. What is Context API?
38. Explain React Hooks.
39. Define mapStateToProps and mapDispatchToProps.
40. What is a store?
41. What is the purpose of the Switch component in React Router, and how is it used for
declarative routing in a React application?
42. What is the process for installing and setting up React Router in a React application, and
what are the recommended steps to ensure proper integration and usage of the router
library in the project?
43. How does routing contribute to the development of single-page applications in ReactJS,
and what benefits does it offer in terms of organizing the user interface and improving the
overall user experience?
44. How do you validate props in a React component?
45. What are the various data types that can be specified using the propTypes library in a
React component, and how can you use them to define the expected data types of the
props passed to the component?
46. In React, what are the parameters of the map() function and how is it used to manipulate
arrays?
47. What is the reason for requiring a "key" when using the map() function in React and how
does it help in rendering arrays efficiently?
48. What are combined reducers in Redux?
49. Can you provide a detailed explanation of what Redux is, its purpose, and walk through
the complete flow of Redux in a React application?
50. What are the differences between the bind(), call(), and apply() methods in JavaScript and
how are they used to manipulate the ‘this’ keyword and pass arguments to functions?
51. In React, what are inline functions and how are they used to handle events and pass data
between components?
52. What are the various approaches for writing a click event handler in React, and how do
they differ in terms of syntax and functionality?
53. What are the distinctions between Bootstrap and Material UI, and what are the advantages
of using both of them in web development projects?
54. What are the useState, useEffect, and useContext hooks in React, and how are they used
to manage state, perform side effects, and handle global data respectively?
55. What is meant by embedding in software development, and how is it related to the version
control system Git?
56. What are the assign() and reduce() functions in JavaScript, and how are they used to
manipulate arrays and objects?
57. Can you explain the concept of hoisting in JavaScript, and provide an example of how it
affects variable and function declarations?
58. Could you provide a program example of an uncontrolled component in React, and
elaborate on the concept of uncontrolled components in terms of state management, as
well as how they differ from controlled components?
59. What is meant by event bubbling in JavaScript, and how does it work in terms of the
propagation of events from the child elements to their parent elements in the DOM
hierarchy?
60. What is a callback function?
61. What is meant by accessibility in HTML, and how can you use various HTML features such
as semantic markup, ARIA attributes, and keyboard navigation to enhance the
accessibility of web content for users with disabilities?
62. What are shallow and deep copy in JavaScript, and how can you use various techniques
such as object spread, object.assign(), JSON.parse(), and JSON.stringify() to create copies
of arrays and objects with different levels of depth and immutability?
63. What is Webpack, and how does it work as a module bundler for modern web
applications? Additionally, what are some of the core features and benefits of using
Webpack in a development workflow?
64. Can you provide a general overview of CSS, including its purpose and core features, as
well as how it is used in web development to style and layout HTML content?
65. Can you provide an explanation of what a backend is in web development, and how it
works in conjunction with the frontend to create web applications? Additionally, how can
the frontend communicate with the backend using techniques such as REST APIs, AJAX,
and websockets?
66. What is API integration, and how can it be used in web development to allow different
software applications and systems to communicate and exchange data with each other?
Additionally, what are some common types of APIs used in web development, and what
are some of the key considerations for integrating APIs into a software application?
67. Can you provide an overview of unit testing in software development, including its
purpose and core principles? Additionally, how can unit testing be implemented in
practice using various testing frameworks and libraries in programming languages such
as JavaScript and Python? Finally, could you provide some examples of unit test cases for
a simple function or module in a programming language of your choice?
68. What is Babel, and how does it work as a JavaScript transpiler to convert modern
JavaScript code into backwards-compatible versions that can be executed in older web
browsers and environments? Additionally, what are some of the core features and benefits
of using Babel in a web development workflow, and how can it be integrated with other
tools such as Webpack and ESLint?
69. What is a preprocessor in web development, and how does it work to extend the
functionality of CSS, JavaScript, and other web technologies?
70. What is website optimization, and how can it be used to improve the performance, user
experience, and search engine ranking of a website or web application?
71. In the context of web development, what is middleware, and how does it work to handle
requests and responses between the frontend and backend of a web application?
72. How can you use positioning in CSS to move a parent div element? Can you provide an
example of the CSS code needed to apply the position property and the top, bottom, left,
or right properties to adjust the position of the parent div?
73. What are the different data types available in JavaScript, and how are they used in
programming?
74. In software development, what is dead code, and how can it be identified and removed
from a codebase?
75. In web development, what are the different HTTP status codes available between 200 and
600, and what do they represent?
76. In web development, what are the different HTTP methods available, and how are they
used to interact with web resources?
77. In web development, what is a REST API and how is it used to interact with web
resources?
78. In web development, what is the difference between the POST and PUT HTTP methods,
and when should they be used?
79. How to print keys from a nested object in JavaScript?
80. How can you return multiple values in JavaScript?
81. What is chaining in JavaScript and how is it used to call multiple methods on an object in
a single statement? Provide an example to illustrate your answer.
82. What is Promise.all() in JavaScript and how is it used to handle multiple asynchronous
operations simultaneously?
83. What are the differences between ES5 and ES6 methods in JavaScript?
84. How can you make a 'fetch' request in ReactJS, and how can you cancel an ongoing 'fetch'
request?
85. Difference between Spread and Rest operator.
86. What is the difference between the 'map()' and 'filter()' methods in JavaScript?

Section B: Coding Questions

87. How can you count the number of occurrences of a particular character in a JavaScript String,
and what are some different approaches that can be used to achieve this?
88. What is a possible approach to find the most frequently occurring character in a JavaScript
String, and how can you implement this solution in JavaScript programming?
89. What is an approach to add the individual digits of a given integer in JavaScript programming,
and how can you implement this solution to calculate the sum of digits for an integer such as
567 and return the result of 9?
90. Write a JavaScript program to find the largest subarray in an integer array that has a sum of 0.
Can you explain your approach to solving this problem and provide a step-by-step explanation
of your code? How does your program handle edge cases, such as when there is no subarray
with a sum of 0 or when the input array is empty?

Eg: Input = { 3, 4, -7, 3, 1, 3, 1, -4, -2, -2 }

{ 3, 4, -7 }
{ 4, -7, 3 }
{ -7, 3, 1, 3 }
{ 3, 1, -4 }
{ 3, 1, 3, 1, -4, -2, -2 }
{ 3, 4, -7, 3, 1, 3, 1, -4, -2, -2 } // This should be the output
91. Can you provide a program in JavaScript that finds all the subarrays in an array whose sum is
zero? How does your implementation work? Can you explain the time and space complexity of
your solution? Are there any optimizations that can be made to improve the efficiency of your
program?
92. Write a JavaScript program to find the sum of all the numbers in a given string. For example, if
the input string is "1ab2d4hj6", the program should output the sum of numbers in the string,
which is 13.

The program should take a string as input from the user and use regular expressions to extract
all the numbers from the string. It should then iterate over the extracted numbers and add them
up to get the final sum. If there are no numbers in the string, the program should output 0.
93. Write a JavaScript program that takes two strings as input and finds the number of occurrences
of the second string in the first string.

Example:
Input:
String 1: "hello world"
String 2: "l"
Output:
Number of occurrences of "l" in "hello world" is 3
94. Write a JavaScript program to find the sum of all the numbers in a given string. Your program
should take a string as input from the user and then find all the numbers in the string. It should
then add up all the numbers and print the sum to the console.

Here are some requirements for your program:

The string should be read from the console using the Scanner class.
Your program should use regular expressions to find all the numbers in the string.
The sum of the numbers should be calculated using a loop.
If there are no numbers in the string, your program should print a message saying so.
Example:
Input: "Hello 123 world 456"
Output: 579

Write test cases on the same program by using the assertion method in Junit.
95. Write a JavaScript program to find the sum of all the numerical digits in a given string s1. The
string can contain alphabets and digits in any order, but the digits are guaranteed to be
consecutive. Your program should output the total sum of all the digits in the string.

For example, given the string s1 = "abc4ui78fg95", the program should output sum = 177, since
the digits in the string are 4, 7, 8, 9, and 5, and their sum is 4 + 7 + 8 + 9 + 5 = 33.
96. Given a matrix of integers, write a program to modify the matrix such that if any element of the
matrix is 0, then the entire row and column of that element should be set to 0. Implement this
program using JavaScript.

The program should take the following input:

The matrix, represented as a two-dimensional array of integers.


The program should perform the following tasks:

Check for the presence of 0 in the matrix and record the positions of the 0 elements.
Modify the matrix by setting the entire row and column to 0 if any element in the row or column
contains a 0.
The program should return the modified matrix as output.

For example, given the matrix:

{ 1, 2, 3 }
{ 4, 0, 6 }
{ 7, 8, 9 }

The program should modify the matrix to:

{ 1, 0, 3 }
{ 0, 0, 0 }
{ 7, 0, 9 }

And return the modified matrix as output.


97. Write a JavaScript program to find all the duplicate elements in an integer array with less time
complexity.

Example input:

int[] arr = {4, 2, 4, 5, 2, 3, 1, 1, 6, 7, 7};

Expected output:

Duplicate elements in the given array are:


4217

Constraints:

The input array can have a maximum of 10^5 elements.


The program should have a time complexity of O(n), where n is the size of the input array.
98. Write a JavaScript program to reverse an array without using any inbuilt methods.
99. Write a SQL query to fetch department details for a given employee ID?
100. Write a JavaScript program to display the highest prime number.
101. Program to find the largest number in a given input array and replace it with a given
number/string.
In an array take alternative numbers and reverse them. Put it again in the place of array again
e.g., arr = [1,2,3,4,5,6,7,8]

newarr = [1,8,3,6,5,4,7,2]
102. Given an unsorted array a = [3,1,5,2,7], find alternate elements "3,5,7", reverse them "7,5,3"
and place them in the original array
Expected result [7,1,5,2,3]
103. Find second largest number [3,1,5,2,7]
104. Out of given 3 arrays with n number of elements, find out the common element(s) for all 3
arrays.
105. From a given array, make n elements rotate.

eg. given Array:[21,54,11,35,4,18], index:3; output Array: [4,18,21,54,11,35]


106. From an array, find out the elements, and their repetition and print as element=count.

eg.

Input Array: [2,1,3,4,6,5,4,7,5,6,8,2,3,6,2,6,4,4,7,3,4,5,6]

Output:

2=3

1=1

3=3

4=5

6=5

5=5

7=2

8=1
107. Print the right diagonal of the matrix

Input:

1 2 3 4

5 6 7 8

9 10 11 12

13 14 15 16

Output:

4 7 10 13
108. String= "abaade", search for a character "a" in the given string and return its occurrence.
109. How will you remove duplicate elements from an array?
110. Can you provide a sample program in JavaScript that takes an array as input and generates
a new array containing only unique elements, and explain how it works in detail?
111. How can you extract all the keys from a nested object in JavaScript, given an object 'object =
{id:1 , address : {'primaryAddress':'abc'} }', and return an array of keys as
'['id','address','primaryAddress']'? Also, how would you remove duplicates from an array
'[1,1,2,2,3,4,4,5]' in JavaScript?
112. Write a JavaScript function that takes an array of numbers as input and returns a new array
where each element at index i is the sum of all the elements in the input array up to index i. For
example, if the input array is [1, 2, 3, 4], the output should be [1, 3, 6, 10].
113. Given an array of strings, write a JavaScript function that returns the longest string from the
array. For example, if the input array is ["i am in pune", "i am in hyderabad", "location"], the output
should be "i am in hyderabad".
114. Write a program that finds the longest string in an array and returns the number of words in
that string. The input array will be of the form:

const sentences = ["alice and bob love leetcode", "i think so too", "this is great thanks very
much"];

The program should output the longest sentence along with the number of words in that
sentence.

Additionally, write a program that takes an input array of numbers and returns an output array
where the first element of the output array is the first element from the input array, the second
element of the output array is the sum of the first and second elements from the input array, the
third element of the output array is the sum of the previous element (1 + 2 = 3) and the next
element (3 + 3 = 6), and the fourth element is the sum of the previous element (3 + 3 = 6) and
the next element (6 + 4 = 10). The input array will be of the form:

const inputArray = [1, 2, 3, 4];

The program should output an array of the form:

outputArray = [1, 3, 6, 10];

Section C: Soft Skills Questions

1. Tell me about a project you worked on where you had to communicate technical information to a
non-technical audience.
2. How do you prioritize and manage your workload?
3. Can you describe a time when you had to work with a difficult team member?
4. How do you handle criticism of your code or work?
5. Can you describe a time when you had to work under pressure to meet a deadline?
6. How do you ensure that your code is maintainable and scalable?
7. Tell me about a time when you had to learn a new technology or programming language quickly.
8. How do you keep up-to-date with the latest developments in software development?
9. Can you describe a time when you had to work on a project that required collaboration with
multiple teams?
10. How do you approach problem-solving in your work?
11. Can you give an example of how you have applied creativity in your work as a software
developer?
12. Can you describe a time when you had to work on a project with a tight budget?
13. How do you ensure that your code is properly documented?
14. Tell me about a time when you had to work with a client or end-user to understand their needs
and requirements.
15. How do you approach debugging complex software issues?
16. Can you describe a time when you had to make a trade-off between code quality and speed of
delivery?
17. How do you collaborate with other developers on a project?
18. Tell me about a time when you had to mentor or train other developers.
19. Can you describe a time when you had to persuade a team to adopt a new technology or
approach?
20. How do you approach testing and ensuring the quality of your code?

You might also like