Professional Documents
Culture Documents
Ans: HTML Tags: The HTML tag indicates that the document is a HTML element.
Or in easy words the HTML tag contains an HTML element inside it and shows it
on the web page accordingly. Different HTML Tags hold different kinds of HTML
contents inside it. It starts with a < symbol and and ends with a > symbol. For
example <img> is a tag to contain an image in the Webpage. <h1> is a tag to
contain header content in the web page.
HTML Elements: The HTML elements are the content of a HTML document. The
elements are bound by different HTML tags to specify the content type of the
element.
<h1>This is a header <h1/> here This is a header is a header content or a
headline of a HTML document. It is enclosed by the h1 tag, this tag indicates
that the element is a headline.
Ans: An image map is used for linking many different web pages using a
single image. It is represented by <map> tag. One define shapes in images
that you want to include as part of an image mapping
Ans. The purpose of using alternative texts is to define what the image is
about. During an image mapping, it can be confusing and difficult to
understand what hotspots correspond to a particular link. These alternative
texts come in action here and put a description at each link which makes it
easy for users to understand the hotspot links easily.
5) How does the browser prioritize the style applied on a HTML element?
Ans. There are different types and methods to apply style on HTML elements.
We can apply style by using the inline style attribute, by the connected JS files
and which is more popular is to attach a separate style sheet to the HTML
document. But the browser always prioritizes the style which is applied by
using the style attribute on the HTML. That means if we apply style both in a
separate CSS file and using the inline method with style attribute as well. Then
the style which is applied with style attribute will be prioritized.
HTML 5 invites us to give add a lot of semantic value to your code. There are
natives solution to embed multimedia content.
The rest is important, but it's more technical sugar that will save us from doing
the same stuff with a client programming language.
Ans: Semantic tags are some meaningful tags that indicates the
content type of that tag.
<nav> <main> <footer> <header> <audio> <video> <strong> <small> etc
The <div> tag wraps up large chunks of code to apply similar styles to
some codes.
<aside> tag is used to describe the main object of the web page in a
shorter way like a highlighter. It basically identifies the content that is
related to the primary content of the web page but does not constitute
the main intent of the primary page
Ans: The <meta> tag defines metadata about an HTML document. Metadata is
data (information) about data.
<meta> tags always go inside the <head> element, and are typically used to
specify character set, page description, keywords, author of the document,
and viewport settings.
Ans: Inline elements just take only the space needed for the content.
Inline-Block element is the hybrid of inlilne and block. Like inline tags it takes
up just the space needed for the content. But we can also use block element
properties on it, like margin, padding etc.
Block elements takes the content space as well as the space of the whole row.
Ans: <strong> tag is a semantic tag. It emphasises the value of the content
like <b> tag.
<b> tag increases the font weight and make it bolded. But it is a traditional
html tag not a semantic tag.
The <em> element is for words that have a stressed emphasis compared to
surrounding text, which is often limited to a word or words of a sentence and
affects the meaning of the sentence itself. Typically this element is displayed
in italic type
<i> tag does the same as <em> tag, but this is just old school html tag ,not
semantic
Ans: Attributes are just characteristics of a Html element. Like style attribute
lets us to set styles for a element. Title attribute let us to set a tooltip.
Properties: All which either has a boolean value or that is uacalculated such
as selectedIndex. Attributes: Attribute' that can be added to a HTML element
which is neither boolean nor containing a UA generated value.
Ans: A browser’s viewport is the area of web page in which the content is
visible to the user. The viewport does not have the same size, it varies with the
variation in screen size of the devices on which the website is visible. For a
laptop, the viewport has a larger size as compared to a smartphone or tablet.
Ans. Select input element presents options for the users from which they need
to select one of them. On the other hand, Datalist presents a list of suggested
values to the associated input form (text) field and users are free to select
one of those suggested values or type in their own value
CSS Questions
Ans: Flex layout is one directional ,that means the developer can work with
either rows or columns. Align contents just in one direction.
On the other hand, the grid layout is two directional. That means we can work
with both rows and columns. Grid gives us more convenience and
independence when we are working with a complex layout.
The absolute position refers and depends on the position of its closest parent
element. If no parent has a relative position set then it aligns according to the
root. Relative position is the position of the component itself, and it holds its
child elements.
3. What is a box model? And what are the different elements of a box model?
Ans: Every element on our web page fits into a box. This is known as the CSS
Box Model.
Understanding the CSS Box Model helps us to understand and lay elements
out on our page. It will also help you understand how the elements will react
to one another.
The different elements of a box model are margin, padding, border, content.
Ans: Hover effect is how the element will react when we enter the cursor on it.
We can apply any style in a hover effect. Like if we set a different color other
than the primary color, then the element will change it’s content color
according to the hover effect color when we enter the cursor over it.
Active class is a pseudo class in css. The purpose of active class is to apply a
different style to the element when someone clicks the element.
৫. What are the different types of Selectors in CSS?
Ans. In CSS, if we want to apply style into different elements of the HTML by
external css of javascript. Then we must use different kinds of selectors to
target and specify that element.
There are some more pseudo selectors which are first child, last child, nth
child etc.
Some more selectors are used in some case like attribute and type selectors
etc.
Ans. CSS specificity is the priority of a style when different styles are applied in
different or selectors.
For example if we first set any style by the tag name, then the style will be
added to all the elements under the same tag. Then if we use class then the
elements with the same class will get that style. If we then use id to specify an
element and apply style, then the id style will be prioritized. Then the most
prioritized selector is inline style. If we add style by the style attribute then
these styles will be added. This is CSS selectors specificity.
Ans. The english meaning is not genuine or original. Which is different from the
original.
The same thing goes for the css pseudo things. We can add something
different than the original element by using css pseudo elements. A common
method is ::before and ::after. By using this method we can use css to create a
different or fake element before and after the selected content.
Same thing goes for pseudo class. We can add some different styles to an
element other than the original. Some popular case is active, hover and
visited.
Ans. Media queries are vital thing of css. By this method we can add different
styles according to the user's screen size which can make the website
responsive and comforting to use.
To use media queries we have to identify the breakpoint first and then the
styles to apply by using normal css selectors when the user is using a device
which is of that screen size.
styles…
Ans. Fonts are bit difficult to make responsive for different breakpoints.
Because we have to use different font sizes when developing a website. By
selecting all the typography and manually making it responsive is quite
difficult even for small apps. So I generally use this method to apply the style
in the root.
html {
font-size: 60%
Ans. CSS frameworks are just pre-built css codes and sometimes with JS also.
The purpose is to make the developer’s life easier. Because we don’t have to
write custom css codes for all the styling and waste much time making the
pages responsive. Some CSS frameworks are Bootstrap, Tailwind CSS,
Material UI, Chakra UI, Ant Design etc.
13. How can stop the contents which is flowing out of the container?
Ans. If the content is important like articles. Then we can set the container’s
overflow property to scroll in the x or y direction. Or if the flowing content
image is not important then we can simply set the overflow property to
hidden.
Ans. They’re are multiple ways to do the task. The oldest way to set the
container with the property margin-left ‘auto’ to right center the container,
margin: 0 auto; to center it according to the available width of the parent
container. And margin-right: ‘auto’ to left align the container.
But my favorite and in my opinion convenient and prettier way to do it, by just
setting the parent container display property to ‘flex’ and adding
justify-content: start to left align, justify-content: center to center align and
justify-content: right to align right.
15. What are the methods to add style on a HTML? Identify them.
Ans. If we go to the most convenient method, then we can just use the <link>
tag to attach an external css file, which I use in most cases.
Then another one is by just writing the styles in the root html file by using the
<style> tag in the head section of the HTML file.
Then which I tend not to use is just adding the style attribute to the element
itself and write some styles for the element. Which is really hard to maintain
and modify.
Sometimes we also use Javascript to add some styles with our script file.
17. What is the difference between display none and visibility hidden property?
Ans. The display none property vanishes the element and its entire occupied
space, and another child or sibling element eats up the space which is
allocated to that element.
But if we want to just make an element invisible but under the hood the
element is still there and occupying its own space, then we can use the
visibility hidden property.
Ans. The universal selector is the * { …styles } selector in CSS. It is also known
as the asterisk selector.
The purpose of the universal selector is to apply some styles to all HTML
elements. Every kind and every type.
19. If you have three childs in a container and you have to allocate 250px
width how will you do it with the grid system?
Ans. First we have to select the parent container by a selector, then we have
to use display: grid; property on it. Then use simply have to write this property.
Ans. RWD stands for Responsive Web Design. Responsive Web Design means
the layout of the web page and content style will change according to the
users screen size.
We have to write different codes for different screen breakpoints and the web
page will respond accordingly and style a different style which is specified
only for that range of screen size.
JavaScript Questions
Ans. If we define a function to perform a task and we need that value for
another purpose. Then we need to return that value from that function,
otherwise we would not be able to use that value for later purpose.
6. How will you return more than one value from a function?
Ans. Javascript does not allow us to return more than value from a function
directly. But using a simple mechanism we can return multiple value from a
function but we have to destructure it outside to function in order to use it. We
can store the values in an object or an array and simply return it from the
function.
Ans. This keyword indicates the block or object it’s called from. It’s value is
different in different locations. If we call it from a function it will indicate
towards its parent function. If we call it from the global scope, it will indicate
toward the window object.
10. What is Event bubbling in js? Or How does event delegate work in JS?
Here if we set a event handler, for example a click event both a and b div, then
if we click on b. The event on a will automatically gets triggered. Because b
itself is in the territory of a. That means the child will trigger the event handler
on its parent’s automatically if not controlled explicitly.
Ans. When a js file is executed, JS always send the function and variable
declaration to the top of the code. This behaviour is known as hoisting.
Ans. Recursion means Repetitive. When a function is called from its self then
this method is called recursion, this is kind of a loop under certain conditions.
Otherwise it’ll turn into a infinity loop.
All the HTML elements are the nodes of the DOM. The whole HTML itself is the
document, so that element’s content, style, information etc can be changed
or alternated by the Javascript code in the browser with different kinds of
conditions, interactions and purposes.
Ans. The type of Javascript of the variable can be revealed by using the
typeof operator.
let a = 5;
let b = ‘5’;
Ans. Block scope variables are those variables which support block scoping,
block scoping is which variables in only be available in the assigned blocks.
Let and Const are block scoped variables. Var is not a block scope. Var often
creates Global leakage.
19. What is local storage, session storage? And what is the difference?
Ans. Browsers give us access to some web storage to store some data. Local
storage and session storage are two of the web storages.
Local storage and session storage’s purpose is similar. Some differences are
present. Local storage is more persistent than session storage, session
storage is less persistent. Which means session storage erases the data when
the browsing tab or the browser itself is closed. Local storage stores data
even after closing the browsing tab or the browser. Local storage erases data
when the browser's history and cache is cleared by the user or anything.
Ans. IIFE stands for Immediately Invoked Function Expressions. It’s a specially
declared anonymous function which executes immediately after the function
is defined.
(function () {
…function codes
})();
21. Difference between statement and expressions.
Ans. In my words, all expressions are statements but not all statements are
expressions. Whichever statement gives us some value is an expression, and
the statements which do not provide us any value are just statements.
For functions,
Function a () {
23. Key difference between Primitive and Non Primitive Data types?
Ans. Primitive data type is immutable, and Non-primitive data are mutable.
Ans. Map and forEach both are array methods. Both of them loops through an
array and perform the cb function task.
But forEach only applies the cb function for every element of the array and
does not return anything. On the other hand, map loops through the whole
array perform a task for each element and return a resulting array for each
element respectively.
ES6
Ans. ES6 is also known as Ecma Script 6. It’s the modern Javascript with
easier syntax and convenient to use. Some of news features are let and
const keyword, Multi line string literals, Arrow functions, Default
Parameters, spread and rest operator, Destructuring and classes etc.
Ans. var is the typical old school Javascript keyword for declaring variables.
Var has some limitations, the major limitation in my opinion is the risk of
global leakage because this keyword does not support block scoping.
Let and const are the latest and modern part of Javascript ES6 addition.
These keywords support block scoping and work in a predictable way.
Ans. The spread operator is one of the features of ES6. Spread operator is a
convenient way to copy elements from an array to another array. We can
create a copy of an array by taking all the elements at once and add some
more elements into an array.
Ans. First of all prototypes are the mechanism to share and add methods to
one object and another. There’s a saying that JS is all about objects. It is
known that every javascript object is the prototype of Object. When we add a
method to any object, that method is a prototype of the object it is defined
into. But when it goes to null, then prototype refers to the Object property. This
is Javascript prototype chaining.
Ans. There are two types of data in javascript. They are primitive and
non-primitive. Primitive data are immutable and non-primitive data can be
mutated, object, function and arrays are non-primitive data. Primitive data
holds just the value which is allocated directly into memory, that's why they
cannot be mutated, and they create a new reference when changed. But
non-primitive data doesn’t directly allocated into the memory, they just pass
their reference which stays unaltered. So, if we use a non-primitive data in five
places, changing the data just in one place they get changed in every place.
Ans. Scopes in javascript are just blocks from which we can access variables
and other logics. There are block scopes, local scopes, global scopes etc.
Variables from the outer scope cannot get access to variables in the inner
scope, but variables from the inner scope can get access to the variables of
the outer scope.
Ans. Functions can accept as their arguments. But interestingly, we can also
pass functions as the argument of a function. The functions which accept
other functions as their arguments are called higher order functions.
The difference between get and post is when we want to fetch a data from
the database, we use the get method. But when we want to send the data to
the database, we use the post method.
Ans. Local and session storage both are web storage browser API’s to store
small amounts of data securely. The difference between local and session
storage is mainly the time period the browser can hold the data. Session
storage is less persistent as the user will lose data as he closes the browsing
tab or browser itself. On the other hand, local storage data is stored in the
browser as long as the user doesn’t clear his history and cache from the
browser.
12. What are cookies? And why will you use it?
It is basically a text file which lets us store a small portion of data securely. The
cookie is a useful method to remember a user. For example logging him in
without a hassle and remembering his settings to set the web pages for his
convenience.
Ans.
Ans. Template literal is a new feature of ES6, which lets us to write multi-line
strings and make it dynamic easily.
Ans. For of loop is just like for loop. But for of loop just loops through the
elements or collection of arrays and strings.
Ans. string.startsWith(),
string.endsWith(),
string.repeat(),
string.includes()
Ans. Using the class keyword, we can create a template for creating similar
objects. This is one of the main pillars of Object Oriented Programming,
‘Inheritance’ .
React Questions
Advantages: One of the advantages of React Js is, it's easy to use. Let us
create dynamic websites faster and in an easy way. We can create reusable
components which helps us in the long run. Huge libraries and third party
resources are available for react. And the main advantage is React doesn’t
rerender the entire document, it just renders the changed state associated
components.
3. What is Virtual dom? What are the differences between virtual and real
dom?
Ans. Virtual Dom is an important part of React. It’s a copy of the real DOM and
synced with the real DOM. Virtual DOM is a programming method to compare
and determine changes to the real DOM which is saved in the memory.
The difference between the virtual dom and real dom are real dom actually
determine what to show in the screen, but virtual dom cannot be shown on
the screen, the purpose of VDOM is to compare it with the real dom and
identify changes to real dom, this algorithm is known as DIFF algorithm.
5. What is the purpose of useState? When and why will you use it?
Ans. Props drilling is the process of sending the props of a component to the
child components when rendering those components.
Ans. useEffect and useState both are react hooks. useEffect determines under
what conditions the component will be re rendered, or on which information
or state it will be dependent.
8. What other hooks have you used other than useState and useEffect
All React components have their own life cycle. First state of the life cycle is
Initialization, this state is the initial condition of the component which is
constructed by the passed props and default state. Second state is the
Mounting, this stage consists when the component returns its JSX elements
and rendered on the page. Third stage is updating, that means if a
component associated state is changed and the component’s that part is re
rendered. The final stage is Unmounting, as the component gets removed
from the page.
10. What is the purpose of a custom hook? How will you create a custom
hook? Give us an example.
Ans. If we want to avoid rewriting the same functions, we can create custom
hooks then. For example, if we plan to write firebase codes in a hook, then we
can create a custom hook named useFirebase to write the codes in it, and
call it in other components.
11. What is the most challenging task you have accomplished using react?
Ans. In the beginning of working with React, I was not clear about using
useEffect with dependencies. That was one of the challenging tasks to
understand it works and re render the page depending on other states
conditionally. I always work while enjoying my work, that’s why I am not sure if
it was my most challenging task as I always take challenges with an open
mindset to solve it.
Ans. Redux is a state management tool for managing states in React web
applications. It is used to store all the states in a store, updating the state by
writing some dispatch functions and call the states wherever necessary.
Ans. Yes, React Native is a tool to create cross platform apps using React.
Ans. Class components are quite complicated. Class components use this
keyword to get access to the props and states. It uses the component
lifecycle methods.
Ans. Context API is a tool introduced in React not so many days ago. It is used
to store all the states in a file, update and access those from anywhere in the
React application and avoid the manual and hassle of props drilling.
Ans. We cannot attach the functions directly with parameters in the curly
braces, it will automatically call the function as soon as the element gets
rendered. We have to wrap it up in another function and pass the parameters
inside to avoid automatic call of the handler function.
Ans. Fragments are used to wrap two or more direct children inside it and
allow rendering it. Though we can just use div to wrap all the children inside it.
But some developers prefer using fragments instead of a div.
2. Why did you use Node and Mongo with your React project?
Ans. Because React is a JS library for front-end development, and Node.js is a
Javascript runtime for server side development. As both cannot be installed
and maintained through NPM, it is quite a handy duel for the development as
a JS Combo. And Node.js offers reliable tools for this purpose. And for
MongoDB, it gives us lightweight and easy operations to run with Node.js and
Express.js.
Ans. SQL databases are relational and nosql databases are non-relational.
SQL database stores data in a structured way. And Nosql databases stores
data in an unstructured and lightweight way. Sql databases are table-based,
Nosql databases are document and key-value based.
Combined Questions
https://drive.google.com/file/d/1pjgx4mBDWjek1zJs8KQLu3mCMzCVD-R7/view
?usp=sharing
https://drive.google.com/file/d/1p_KLoC9G5TzO3R2IOTI2ISfAut5jqxUQ/view?us
p=sharing
Ans. Recursion means Repetitive. When a function is called from its self then
this method is called recursion, this is kind of a loop under certain conditions.
Otherwise it’ll turn into a infinity loop.
3. What is Virtual dom? What are the differences between virtual and real
dom?
https://drive.google.com/file/d/1pWrfZfQIzyBiUsmQsSdXf2JKAE1ih_al/view?usp
=sharing
Ans. Virtual Dom is an important part of React. It’s a copy of the real DOM and
synced with the real DOM. Virtual DOM is a programming method to compare
and determine changes to the real DOM which is saved in the memory.
The difference between the virtual dom and real dom are real dom actually
determine what to show in the screen, but virtual dom cannot be shown on
the screen, the purpose of VDOM is to compare it with the real dom and
identify changes to real dom, this algorithm is known as DIFF algorithm.