InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
How to handle events in HTML? |
|
Answer» HTML allows event TRIGGER actions in browsers using javascript or JQuery. There are a lot of events like ‘ONCLICK’, ‘ondrag’, ‘onchange’, etc. <!DOCTYPE html><html> <body style="padding-top:50px"> <h3 id="event_demo">0</h3> <input type="BUTTON" onclick="myFunction()" value="Click Me" /> <input type="reset" onclick="reset()" value="Reset" /> </body> <script> function myFunction() { var value = document.getElementById("event_demo").innerHTML value = parseInt(value) + 1; document.getElementById("event_demo").innerHTML = value; } function reset() { document.getElementById("event_demo").innerHTML = 0; } </script></html> |
|
| 2. |
What are forms and how to create forms in HTML? |
|
Answer» The HTML form is used to collect the USER inputs. HTML provides a <form> tag to create forms. To take input from the user we use the <input> tag INSIDE the form so that all collected user data can be sent to the server for processing. There are different input types like ‘BUTTON’, ‘checkbox’, ‘number’, ‘text’, ‘password’, ‘submit’ etc. <form action="/submit_data.php"> <label>Enter your name: </label> <input type="text" name="name" /> <label>Enter Mobile number </label> <input type="number" name="mobile_no"/> <input type="submit" VALUE="Submit"></form> |
|
| 3. |
When to use scripts in the head and when to use scripts in the body? |
|
Answer» If the scripts contain some EVENT-triggered FUNCTIONS or jquery library then we should use them in the head SECTION. If the script writes the content on the page or is not inside a function then it should be placed inside the body section at the BOTTOM. In short, follow below three points:
|
|
| 4. |
How to include javascript code in HTML? |
|
Answer» HTML provides a <script> TAG using which we can RUN the javascript code and MAKE our HTML page more dynamic. <!DOCTYPE html><html> <body> <H1> <SPAN>This is a demo for </span> <u><span id="demo"></span></u> </h1> <script> document.getElementById("demo").innerHTML = "script Tag" </script> </body></html> |
|
| 5. |
Difference between link tag and anchor tag ? |
|
Answer» The anchor TAG <a> is used to CREATE a hyperlink to ANOTHER webpage or to a certain part of the webpage and these links are clickable, WHEREAS, link tag <link> DEFINES a link between a document and an external resource and these are not clickable. |
|
| 6. |
In how many ways can we specify the CSS styles for the HTML element? |
|
Answer» There are three ways in which we can SPECIFY the STYLES for HTML elements:
|
|
| 7. |
How to specify the link in HTML and explain the target attribute? |
|
Answer» HTML PROVIDES a hyperlink - <a> tag to specify the links in a webpage. The ‘href’ attribute is used to specify the link and the ‘target’ attribute is used to specify, where do we WANT to OPEN the linked document. The ‘target’ attribute can have the following values:
|
|
| 8. |
What is the difference between “display: none” and “visibility: hidden”, when used as attributes to the HTML element. |
|
Answer» When we use the attribute “visibility: hidden” for an HTML element then that element will be hidden from the webpage but still TAKES up space. WHEREAS, if we use the “display: NONE” attribute for an HTML element then the element will be hidden, and ALSO it won’t take up any space on the webpage. |
|
| 9. |
In how many ways you can display HTML elements? |
Answer»
Below are some of the display TYPES which are rarely used:
|
|
| 10. |
In how many ways can we position an HTML element? Or what are the permissible values of the position attribute? |
|
Answer» There are mainly 7 values of POSITION attribute that can be used to position an HTML element:
|
|
| 11. |
Is it possible to change an inline element into a block level element? |
|
Answer» YES, it is POSSIBLE using the “DISPLAY” property with its VALUE as “BLOCK”, to change the inline element into a block-level element. |
|
| 12. |
How can we club two or more rows or columns into a single row or column in an HTML table? |
|
Answer» HTML provides two table attributes “ROWSPAN” and “COLSPAN” to MAKE a cell SPAN to MULTIPLE rows and columns respectively. |
|
| 13. |
How is Cell Padding different from Cell Spacing? |
|
Answer» Cell Spacing is the space or GAP between two consecutive CELLS. Whereas, Cell Padding is the space or gap between the TEXT/ content of the cell and the edge/ border of the cell. Please refer to the above figure EXAMPLE to FIND the difference. |
|
| 14. |
Can we display a web page inside a web page or Is nesting of webpages possible? |
|
Answer» Yes, we can DISPLAY a web page INSIDE another HTML web page. HTML provides a tag <iframe> using which we can achieve this functionality. <iframe SRC=”URL of the web page to EMBED” /> |
|
| 15. |
What is the significance of and tag in HTML? |
|
Answer» <head> tag PROVIDES the information about the document. It should always be enclosed in the <html> tag. This tag contains the metadata about the webpage and the tags which are enclosed by head tag like <link>, <meta>, <style>, <script>, etc. are not displayed on the web page. Also, there can be only 1 <head> tag in the ENTIRE Html document and will always be before the <body> tag. <body> tag defines the body of the HTML document. It should always be enclosed in the <html> tag. All the contents which needs to be displayed on the web page like images, text, audio, VIDEO, contents, using elements like <p>, <img>, <audio>, <HEADING>, <video>, <div>, etc. will always be enclosed by the <body> tag. Also, there can be only 1 body element in an HTML document and will always be after the <head> tag. |
|
| 16. |
What is the difference between , tags and , tags? |
|
Answer» The effect on a normal webpage of the tags <strong>, <b> and <em>, <i> is the same. <b> and <i> tags stands for bold and italic. These two tags only APPLY font styling and bold tag <b>, just adds more ink to the text, these tags don't say anything about the text. Whereas, <strong> and <em> tags represent that the span of text is of strong importance or more importance and EMPHATIC stress respectively than the rest of the text. These tags have semantic MEANING. |
|
| 17. |
Please explain how to indicate the character set being used by a document in HTML? |
|
Answer» The CHARACTER set is DEFINED in <meta> tag inside <head> ELEMENT. <!DOCTYPE html><html> <head> <meta CHARSET="UTF-8"> ... ... </head> ...</html> |
|
| 18. |
What are the different kinds of Doctypes available? |
|
Answer» The three kinds of DOCTYPES which are AVAILABLE:
|
|
| 19. |
What are the various formatting tags in HTML? |
|
Answer» HTML has various formatting tags:
|
|
| 20. |
How to optimize website assets loading? |
|
Answer» To optimize WEBSITE LOAD time we need to optimize its asset loading and for that:
|
|
| 21. |
Describe HTML layout structure. |
|
Answer» Every web PAGE has different components to display the intended content and a specific UI. But still, there are few things which are templated and are globally ACCEPTED WAY to structure the web page, such as:
|
|
| 22. |
Define multipart form data? |
|
Answer» MULTIPART FORM DATA is one of the values of the enctype attribute. It is USED to send the file data to the server-side for processing. The other valid values of the enctype attribute are text/plain and application/x-www-form-urlencoded. |
|
| 23. |
What is the difference between the ‘id’ attribute and the ‘class’ attribute of HTML elements? |
|
Answer» Multiple elements in HTML can have the same class VALUE, whereas a value of id attribute of ONE ELEMENT cannot be associated with another HTML element. |
|
| 24. |
What is the ‘class’ attribute in HTML? |
|
Answer» The class attribute is used to specify the class NAME for an HTML element. Multiple elements in HTML can have the same class value. Also, it is mainly used to ASSOCIATE the STYLES written in the STYLESHEET with the HTML elements. |
|
| 25. |
What are different types of lists in HTML? |
| Answer» | |
| 26. |
What are HTML Entities? |
|||||||||||||||
|
Answer» In HTML some characters are RESERVED like ‘<’, ‘>’, ‘/’, etc. To use these characters in our webpage we need to use the character entities called HTML Entities. Below are a few mapping between the reserved character and its respective entity character to be used.
|
||||||||||||||||
| 27. |
What are void elements in HTML? |
|
Answer» HTML ELEMENTS which do not have closing tags or do not need to be CLOSED are Void elements. For Example <br />, <img />, <hr />, etc. |
|
| 28. |
What are tags and attributes in HTML? |
|
Answer» Tags are the primary component of the HTML that defines how the content will be structured/ formatted, whereas Attributes are used ALONG with the HTML tags to define the characteristics of the element. For EXAMPLE, <p align=” center”>Interview questions</p>, in this the ‘align’ is the attribute USING which we will align the paragraph to SHOW in the center of the view. |
|