Question:- Which of the following function allows you to render React content on an HTML page? A. React.mount() B. React.start() C. React.render() D. React.render()
Answer:- C is the correct option. The ReactDOM.render() function is used to render React content in an HTML page.
Question:- Which of the following shows the correct phases of the component lifecycle? A. Mounting: getDerivedStateFromProps(); Updating: componentWillUnmount(); Unmounting: shouldComponentUpdate() B. Mounting: componentWillUnmount(); Updating: render(); Unmounting: setState() C. Mounting: componentDidMount(); Updating: componentDidUpdate(); Unmounting: componentWillUnmount() D. Mounting: constructor(); Updating: getDerivedStateFromProps(); Unmounting: render()
Answer:- C is the correct option. React internally uses a concept of phases when applying changes to the DOM, including Render, Pre-Commit, and Commit. The componentDidMount(), componentDidUpdate(), componentWillUnmount() belongs to the "Commit" phase. Here is an interactive version, which shows each lifecycle method in each phase.
Question:- In MVC (Model, View, Controller) model, how can you specify the role of the React? A. React is the Middleware in MVC. B. React is the Controller in MVC. C. React is the Model in MVC. D. React is the Router in MVC.
Answer:- B is the correct option. React is the Controller in MVC.
Question:- What do the arbitrary inputs of components in React are called? A. Keys B. Props C. Elements D. Ref
Answer:- B is the correct option.
Question:- What do you understand by the "key" prop in React? A. "Key" prop is used to look pretty, and there is no benefit whatsoever. B. "Key" prop is a way for React to identify a newly added item in a list and compare it during the "diffing" algorithm. C. "Key" prop is one of the attributes in HTML. D. "Key" prop is NOT commonly used in the array.
Answer:- B is the correct option. "Key" prop is a way for React to identify a newly added item in a list and compare it during the "diffing" algorithm.
Question:- Which of the following is the correct data flow sequence of flux concept in React? A. Action->Dispatcher->View->Store B. Action->Dispatcher->Store->View C. Action->Store->Dispatcher->View D. None of the above.
Answer:- B is the correct option.
Question:- What do you understand by OOP?
Answer:- OOP stands for object-oriented programming. It is a programming paradigm that revolves around the object rather than function and procedure. In other words, it is an approach for developing applications that emphasize on objects. An object is a real word entity that contains data and code. It allows binding data and code together.
Question:- Name any seven widely used OOP languages.
Answer:- There are various OOP languages but the most widely used are: • Python • Java • Go • Dart • C++ • C# • Ruby
Question:- What is the purpose of using OOPs concepts?
Answer:- The aim of OOP is to implement real-world entities like inheritance, hiding, polymorphism in programming. The main purpose of OOP is to bind together the data and the functions that operate on them so that no other part of the code can access this data except that function.
Question:- What are the four main features of OOPs?
Answer:- The OOP has the following four features: • Inheritance • Encapsulation • Polymorphism • Data Abstraction
Question:- Why OOP is so popular?
Answer:- OOPs, programming paradigm is considered as a better style of programming. Not only it helps in writing a complex piece of code easily, but it also allows users to handle and maintain them easily as well. Not only that, the main pillar of OOPs - Data Abstraction, Encapsulation, Inheritance, and Polymorphism, makes it easy for programmers to solve complex scenarios. As a result of these, OOPs is so popular.
Question:- What are the advantages and disadvantages of OOP?
Answer:- Advantages of OOP It follows a bottom-up approach. It models the real word well. It allows us the reusability of code. Avoids unnecessary data exposure to the user by using the abstraction. OOP forces the designers to have a long and extensive design phase that results in better design and fewer flaws. Decompose a complex problem into smaller chunks. Programmer are able to reach their goals faster. Minimizes the complexity. Easy redesign and extension of code that does not affect the other functionality. Disadvantages of OOP Proper planning is required. Program design is tricky. Programmer should be well skilled. Classes tend to be overly generalized.
Question:- What are the limitations of OOPs?
Answer:- • Requires intensive testing processes. • Solving problems takes more time as compared to Procedure Oriented Programming. • The size of the programs created using this approach may become larger than the programs written using the procedure-oriented programming approach. • Software developed using this approach requires a substantial amount of pre-work and planning. • OOP code is difficult to understand if you do not have the corresponding class documentation. • In certain scenarios, these programs can consume a large amount of memory. • Not suitable for small problems. • Takes more time to solve problems.
