HTML Interview Questions and Answers Part 2
1.Q: What is the purpose of a frameset and what is the meaning of frames?
A: A frame is a rectangular region in a browser windows, frames are created for the purpose of splitting the browser windows in multiple parts. Each frame can be browsed independently. A frameset is a combination of frames in which the document’s content can be shown. The document that belongs to a frameset has to contains also non-framed content (NOFRAME). The frame type of HTML 4 has some known issue regarding usability and web users have to be careful when dealing with it.
2.Q:How do we describe a DOCTYPE?
A: Every Html document should contain, if we respect the standards of HTML, a DOCTYPE declaration which tells us what is the HTML version currently used by a document. Initially this was a SGML tools thing (HTML validators) but in our days DOCTYPE is often used by browsers to know what type of layout to use: a standard one, a strict one or an buggy one.
3.Q: How is error checking made in HTML?
A: The HTML syntax is verified for standard definition by the HTML validators and the errors are printed in a list. This validation is used for obtaining the most correct interpretation by unknown or future browsers. Another method is with HTML checkers or so called linters, these checkers are programs that verify if a document has particular issues even if these issues are the cause of bugs in the browser or invalid markup, but the checkers don’t make a perfect search, some invalid documents may be invisible to them or those that are valid can appear as invalid to them. Validators can have different styles of reporting but they all operate in the same way and the errors found will always be the same with the same input.The result of checkers may be different because their role is to find different types of problems. Some Checkers can be called validators but they are not and. When a website is verified for errors, it is better to find the common problems that are appear again and again if the checking is made for the first time.
4.Q: What do we do if we want to have example of HTML but we don’t want them to appear as part of the document?
A: This is possible if we put “&” instead of the “&” character wherever we find it in the document. Also we must put “<” instead of “<” , the same “>” instead of “>”.
5.Q: How is DIV different from SPAN?
A: While SPAN helps us to put styles on a specific text line, DIV will help us to have styles for a selected block of text. The only thing that separates them is that the formatting is not made by SPAN itself and makes a local division inside a document because it is used for paragraph braking. SPAN instead doesn’t work that way, all that it is doing is performing an alignment or style no matter what specifications are involved. The ALIGN attribute is specific to DIV, SPAN does not contain it. SPAN is used usually when the document doesn’t contain a clear text block so the styles will be performed to the inline texts (words or sentences).
6.Q: Can we stop the second submitting of forms?
A: The answer will be no because duplicate submissions have to be resolved by the form submission server-side program, for instance-CGI. The server side program may create the form and add a unique ID session and a shadow field ( hidden). The session ID will be checked by the program to see if it was used before, if the result is positive the necessary actions will be performed( the submission can be rejected or updated).
7.Q: What is the meaning of cell padding and cell spacing?
A: The space from one cell edge to another and the space from the cell contents is declared by formatting and the method is named Cell padding. Cell spacing is different from cell padding because it declared the space from one cell to the other and not between the cells wall or contents.
8.Q: How can we include a file in another file?
A: The method used for doing this is are server-side includes when it is the case and if they are supported by the server. But this method is not so good because it slows down the document. If we use static footers in our documents the best method is using an editor for introducing files in the document or we can also use a preprocessor like the C language has. There are many HTML preprocessors for this.
9.Q: How is time and date displayed in a HTML document?
A: This can made using server-side includes, in case they are supported but in this case the displayed time will be the one of the server and not the one of the client computer with some incorrect numbers due to cache using after a while. We can use instead JavaScript but this will bring another useless click on the user screen which is not a really good thing.
10.How is page breaking specified in a HTML document?
A: Actually it isn’t, in HTML page break occurrence can’t be specified if the HTML version is the standard one. Because HTML is an independent language, things like user fonts and document size belong to page breaks and don’t fit here.
11.Q:Why the frames we made are not exactly as we specified regarding size?
A: The problem appear when we use the Netscape Navigator browser, which in its older versions makes conversions of the pixel-based frame dimension in percentages and uses the percentages at frame layout so the size will be different than specified in the document. This is seen when the windows are resized and this is something that can’t be changed, but the site design must be made in such a way that it adapts this inconvenient.
12.Q: Is it true that frames are not liked by search engines?
A: Search engines agree the frame contents but they disagree the frame combination of the design of the documents. It is a matter of direct access to the framed content which sometimes difficult. Several search engines simply ignore frame content and they try to index only non-frame content because it is more efficient.
13.Q:What is the right way to center tables?
A: The right way to center tables is : <TABLE ALIGN=CENTER>. But many respected browsers don’t allow this, so in this case we must use: <CENTER> at the beginning and at the end of the table. Some browser don’t allow tables even if they allow centering(Lynx), case in which the cells become centered, but that is not what we want. To make it right we must use this: <P ALIGN=left> or <DIV ALIGN=left> but the amount of text from the cell counts.
14.Q:How it is a back button made in HTML?
A: This is not really possible, it will mean going back in the last page from the history. A link can be made to the URL from the “HTTP_REFERER” variable, a link to a new point in the history. But several browsers are making a bad sending of the variable when bookmarks or manual URL’s are used so we will have an empty link. “history.back()” from JavaScript can be used but the only browser in which works is Netscape 2.
15.Q:How can we detect the browser type?
A: Usually the browser reveals its identity in the process of requesting documents and this is made by the use of a CGI script. The script uses an environment variable (HTTP_USER_AGENT) which optimizes the document type to fit the browser type. But this is not a rule to every browser, for instance even Internet Explorer says it is actually Mozilla1.2 when reading enhanced Netscape documents. Through cache a document like this can be received by another browser if the document it’s maintained by the cache proxy.
16.Q:What is the meaning of Semantic HTML and why should we validate HTML?
A: Semantic HTML is the usage of tags with implied meaning, Tags like div or span determine the content interpretation, these tags are used in a vast area, giving a coding standard on the web for HTML, better page speed and better search engine rating.
17.Q:Can we make the source of HTML hidden?
A: There is no real way to make a standard HTML source hidden but for the security of our HTML code we can take these three hints into consideration:
a)If we make the page using Flash or something like Flash the page user will be forced to get the Flash plug-in and the source of the applet will be hidden from him.
b)we can use different scripts that have the ability to disable right clicking on the page and the user will not be able to copy the images and the source code will inaccessible for the user. But the source is not totally hidden in this way because, for example in Internet Explorer users can use the “View/Source” feature or these scripts can be deactivated and the pictures will become downloadable to the disk.
c) There are some utilities to make a source code unreadable but again, this will not hide the code totally.
18.Q: How can we describe image mapping in HTML?
A: Image mapping means that an image link is created for multiple pages. As an example we can imagine having a map of a country and when we click a state from that country we get into another page.
19.Q:In what way is the exit from a frameset done?
A: It is not so hard if we are the makers of that frameset because we can do this by adding an attribute like TARGET on the link of the document that is out of the frame. The value we may give is _top. Because not all browsers are the same users have to request an URL of a frame manually by copying it. A full view of the frame is not possible with many browsers.
20.Q:What we do if we have to open a new window from a link?
A: The commands for this are: <a target=”_blank” href=…> or <a target=”name” href=…>. The first example is making a nameless window and the second is making a window named “name”. Being possible to create a window with the “name” name means a name like this wasn’t used before for a window. HTML 4 Strict, for instance does not use the attribute TARGET, in this case we will use JavaScript for window creation. Anyhow, if we don’t have a fair reason for opening new windows from link, we shouldn’t do it because most of the users find it as an annoying thing.
21.Q:Which are the common tools for HTML writing?
A: Opinions are different regarding this aspect, but usually the tools that give you too many automatic options for coding are the ones that generate the worst HTML output so we better use an enhanced notepad version and make everything on our own.
22.Q:What is the best method of copying content from a webpage to our own webpage?
A: The best methods for this are:
a)scripts- we have to see the source code of the page then copy everything that is found in between the <script> and </script> tags then the script will work on our page as well.
b)text-this can be seen and copied easily from the browser
c)embedded objects-we have to copy the file and the code associated with the embedding.
d)sounds, images and movies- all of these can be copied on our page but first they must be copied or downloaded on our machine. We can use the “save image as” feature or in the case of sounds saving file on a specific location ( we can find it also in cache), this works as well for the movies.
23.Q:What is the way for using sounds in old versions of Internet Explorer?
A: The method used for older versions of IE is <BG SOUND=”sound.ext”>.
24.Q:How is a link made?
. The result will be http://www.site.com>example.
25.Q:Can a form have more than one action?
A: One form is limited to one action, so the answer will be no. Anyhow to a single form a server-side program can make multiple tasks.
nice.
all question are very usefull for the intriviewers.
Thanks for all Question and Answers….these are very usefull ….
useful question answers
nice collections
hai ra this my QS
very nice and usefull…………………
6.Q: Can we stop the second submitting of forms? yes
hi ,
Questions are very good but the language of answer is not up to the markable. you sohuld try to use simple language with gramatical currection