Difference between Interview Questions
Require vs Load
Load
The load method takes the
filename
as input. When the Ruby interpreter comes across theload
method, it will load and execute the Ruby program in the filefilename
. If it comes across it again, it will load and execute it again, picking any new changes in the file.If you load a file, make a change to that file, and load it again,
load
will pick your new changes, which will override the original contents of the file. This is useful for making changes when a program is running and examining them immediately without reloading the application.
Require
The
require
method also loads the given file, similarload
. However, it won't load the file if it's already loaded. Any constants, classes, modules, or global variables within the required file will be available to the calling program.Requiring a library a second time won't execute it again.
Turbo Frames V/S StimulusReflex
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Components vs Elements in React
A React Component is a template. A blueprint. A global definition. This can be either a function or a class (with a render method).
A React Element is what gets returned from components. It’s an object that virtually describes the DOM nodes that a component represents. With a function component, this element is the object that the function returns and with a class component the element is the object that the component’s render method returns. React elements are not what you see in the browser. They are just objects in memory and you can’t change anything about them.
React internally creates, updates, and destroys objects to figure out the DOM elements tree that needs to be rendered to the browser. When working with class components, it’s common to refer to their browser-rendered DOM elements as component instances. You can render many instances of the same component. The instance is the “this” keyword that you use inside class-based components. You would not need to create an instance from a class manually. You just need to remember that it’s there somewhere in React’s memory. For function components, React just uses the invocation of the function to determine what DOM element to render.
PUT and PATCH?
The main difference between the PUT and PATCH method is that the PUT method uses the request URI to supply a modified version of the requested resource which replaces the original version of the resource, whereas the PATCH method supplies a set of instructions to modify the resource. If the PATCH document is larger than the size of the new version of the resource sent by the PUT method then the PUT method is preferred.
Simply put, unlike PUT, PATCH applies a partial update to the resource.
The verbs and actions are matched as follows:
POST – Create
GET – Read/Retrieve
PUT/PATCH – Update
DELETE – Delete