New Post has been published on Html Use
New Post has been published on http://www.htmluse.com/52-helpful-ui-developer-web-designer-or-html-interview-questions-and-answers/
52 Helpful UI Developer, Web Designer or HTML interview questions and answers
1- iframe in HTML is used to display a web page within a web page.
2- An HTML file written in notepad can be saved with an extension:
ANSWER – Any of the above
3- Which of the following is true about links by default?
ANSWER – An unvisited link is underlined and blue.
4- HTML Event Attributes onload fires just before the page is finishing loading.
5- HTML Event Attributes onunload fires
ANSWER – when the browser window has been closed
6- HTML Form Events ___________, fires the moment that the element loses focus.
7- Which of the following tags below are used for a multi-line text input control?
ANSWER – Used to separate cell walls from their contents.
9- What are meta tags used for?
ANSWER – To store information usually relevant to browsers and search engines.
10- When you use a heading tag in a document, what does the Web browser assume?
ANSWER – Heading information is shown as a size six
11- What is the difference between XML and HTML?
ANSWER – XML is used for exchanging data, HTML is not.
ANSWER – Document type definition
ANSWER – Document object model
14- Text/Html is called the __________ of the page
ANSWER – content type/MIME type
15- Which HTML attribute is used to define inline styles?
16- Which is the correct CSS syntax?
ANSWER – body color: black
17- What does an HTML tag do?
ANSWER – It specifies formatting and layout instructions for your web page.
18- When you use a heading tag in a document, what does the Web browser assumes?
ANSWER – Heading information is to appear on its own line
19- What is meant by the cellspacing attribute?
ANSWER – It specifies the space between two cells
20- Which of the following attributes comes in handy when borders have to be put between groups of columns instead of every column?
1. Do all HTML tags come in pair?
ANSWER – No, not all HTMLS tags come in pair. For e.g. <img>, <br>
22. What are some of the common lists that can be used when designing a page?
ANSWER – Some of the common lists that can be used are:
a.) Ordered list
b.) Unordered list
c.) Definition list
d.) Menu list
e.) Directory list
23. What is the advantage of collapsing white space?
- The browser collapses the multiple white spaces into a single white space in HTML.
- This allows the developers to arrange the HTML code in a well organized and legible format.
24. Is it possible to list elements straight in an html file?
ANSWER – Yes, it is possible with the use of indents.
25. Does a hyperlink apply only to text?
- No. The hyperlinks can be applied to both text as well as the images.
- It means that even the images can become clickable links with a capability to take the visitor to the next page.
- This can be done simply by using <a href> tag.
26. What hierarchy is being followed when in style sheets?
- Inline style takes priority over embedded style sheets.
- Embedded style take priority over external style sheets.
- If a single selector includes three different style definitions, the definition that is closest to the actual tag gets the priority.
27. What happens if the list-style-type property is used on a non-list element like a paragraph?
ANSWER – Here the property will be ignored without having any effect on the paragraph.
28. What is the advantage of using frames?
- Frames make it easier to navigate through a site.
- The links that appear in the frame can appear through out the site.
29. How can I hide my source?
ANSWER – No. you can’t hide your source as it is required by the browser to display your document.
30. How will you align a table to the right or left?
- To align the table to the right, you can use <TABLE ALIGN=”right”>
- To align the table to the left, you can use <TABLE ALIGN=”left”>
31. Why doesn’t <TABLE WIDTH=”100%”> use the full browser width?
- This is because the graphical browser is designed to leave a margin between the display area and actual content.
- The navigator also leaves some space for the scroll bar on the right side of the display area. Though, if the page is not long enough, the scroll bar doesn’t appear.
32. How would you automatically transfer your visitors to a new web page?
- You can do it with the help of meta tag mentioned below:
<META HTTP-EQUIV=”Refresh” CONTENT=”2″; URL=”http://www.yourname.com”>
- Place this tag between <HEAD></HEAD> .
- It will load yousite.com in 2 seconds.
33. You want only a vertical scrollbar and no horizontal scrollbar on your page. How would you do it?
- This can be done by defining the frame with SCROLLING = auto and having content to just fit into this frame.
- SCROLLING=”yes” gets the scroll bar on both the sides, even when not needed.
- SCROLLING=”no” doesn’t get the scrollbars at all, even when they are needed.
34. How do you refer to the .css file in the web page?
- .css file in the web page can be referred with the use of <link> tag.
- It should be kept between <head></head> tag.
- Eg. <link href=”/css/mystyle.css” type=”text/css” rel=”stylesheet” />
35. What is a better way to design the layout of a web page – a table tag or div?
- The better way to design the layout of the webpage is by using the <div> tag.
- The <table> tag is used to present the data in tabular format.
36. What is a <dl> tag in HTML?
- <dl> is a definition list tag used in HTML.
- It is used with <dt> and <dd>.
- <dt> list the item while <dd> describes it.
37. What are empty HTML elements?
- HTML elements with no content are called empty elements.
- For eg. <br>
38- What does the elements mean in syntax given for URL in HTML?
URL stands for Uniform Resource locater. This helps just like the Internet pooling concept where the people recognize themselves and others people connected together with each other. URL allows a document to be located on World Wide Web (www). The example of the URL is as follows with the complete element:
scheme://host.domain:port/path/filename
This code has got with no meaning but there are some elements that are defined:
• scheme- is the type of internet service. In this HTTP can be used which has to most common type.
• Host – it is used to control the host name and fetch the information from other templates as well.
• Domain – it defines the internet domain that is google.com.
• :port – it defines the port number on the Host where the default port that is being used is 80.
• path – this defines the path of the server that consists of a hierarchical directory structure.
• filename- it defines the unique name for the file or the document that saves it.
39- How to add helper plug-ins on the webpage using HTML?
A helper application is a program that is used in the browser to help the users with lots of information that is not being provided with the applications. These helper application is known as Plug-ins. Helper application includes audio, video, etc. The tag that is used to embed is <object>. Helper application allows easy incorporation of audio and video that is controlled by the user. Helper application allow the control over the volume setting and other functions like play, stop,etc.
<object width=”420″ height=”360″
classid=”clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B”
codebase=”http://www.career.com/qtplugin.cab”>
<param name=”src” value=”hello.wav” />
<param name=”controller” value=”true” />
</object>
40- What is the purpose of canvas in HTML?
Canvas is an element that is used for the graphics for the web page. It uses JavaScript to bring the graphics functionality live. It allows easy way to draw the graphics and use different types of tools to create drawing on the web page. Canvas is just a rectangular area that controls the pixel of every element that is used in the web page. Canvas uses methods like paths, circles, etc. The canvas element will be used as follows:
<canvas id=”can” width=”200″ height=”100″></canvas>
The canvas element includes id, width and height settings and with the javascript it gets used like:
<script type=”text/javascript”>
var c=document.getElementById(“can”);
var ctx=c.getContext(“2d”);
ctx.fillStyle=”#FF0000″;
ctx.fillRect(0,0,150,75);
</script>
41- What is the purpose of iframe in HTML?
Iframe is called as inline frame that places one HTML document in a frame. It is different from the object element as the inline frame can be made in the target frame. The target frame consists of the links that is defined by other elements used in the web page. Iframe is used to focus on printing or viewing of the source. Iframe can be used by the user in those browser that supports it. If they have used iframe also then the incompatible browser won’t display the actual but display of the alternative text will take place. The content of the iframe is being written in between <iframe>…… </iframe>. The sample example is given below:
<iframe src=”http://www.w3schools.com”></iframe>
42- What are the different types of frames tags used in HTML?
Frames allow the display of the document visually. It allows the window to be split into segments that can contain multiple different documents. It can utilize many resources and repeat some parts of the layout that can be used in a frame. Frames consists of different types of tags and they are as follows:
<frameset>…</frameset>: it consists of the frames that includes the layout using the attributes of rows and cols.
<frame> or <frame/>: it conists of a single frame and gets included within the frameset. It is always come up with a src attribute that provides the source that has to be shown in a particular frame.
<noframes>…</noframes>: it consists of the normal HTML content that is used to show no frames.
<iframe>…</iframe>: it consists of internal frame that will contain the src attribute to include the frame that is internal to a particular region.
43- Write a code to change the color of the background or text? Explain the elements involved in it.
To change the color of the background of the body or the text there is a <body> tag that has to be included where there are some elements that has to be used to set the properties of it. The code is as follows:
<html>
<head>
</head>
<BODY BGCOLOR=”#ffffff” TEXT=”#000000″ LINK=”#000000″ VLINK=”#000000″ ALINK=”#ffff00″>
</body>
</html>
The elements that are used in this tag is as follows:
BGCOLOR: represents the background color which will be applied totally on the body if there is no other bgcolor used with any other tag internally.
TEXT: represents the color of the text that will be applied to the complete text present in the body.
LINK: represents the color of all the text links that are present inside the body.
VLINK: represents the color of the links that has already been visited.
ALINK: represents the color of the text links that will change when the page accessed will be active.
44- What is the main function of <pre> tag in HTML?
<pre> tag defines the pre-formatted text that is used to display the text with the fixed width and uses a predefined fonts and it keeps both spaces and line breaks separate and show the text as it is. The code that can be used to display the text that can be written in whatever way the user wants is as follows:
<pre>
Text in a pre element —-//
is displayed in a fixed-width
font, and it preserves
both spaces and
line breaks
</pre>
45- How can tables be made nested in HTML?
Tables can be made nested by making it come in another table. This consists of many attributes and tags that can be used in nesting the tables. The tags that are used for the table is as follows:
<TR>: This is the tag that has to be written after the <table> tag and before any other tags. This makes a table row that store the data elements.
<TD>: This tag can be used anywhere and it consists of the data that has to come on the website.
<TH>: This tag consists of the table heading.
The sample code will explain the above explanation much better:
<table>
<tr>
<td>this is the first cell</td>
<td>this is the second cell
<table> <!–Starting of the table that is embedded inside another table–>
<tr>
<td>this is the first cell second table</td>
<td>this is the second cell of second table</td>
</tr>
</table>
</td>
</tr>
</table>
46- How can tables be used inside a form? Explain with an example.
A form can consist of the table and its properties to display it on the web page. The form is placed with the <td> tag that includes the data of the table. This can also be used to position the form in relation to the other content. The table will be added within the form. The code is given as:
<FORM ACTION=”[URL]“>
<TABLE>
<TR>
<TH>This is the table heading</TH>
<TD><INPUT TYPE=”text” NAME=”account”></TD>
</TR>
<TR>
<TH>This is another heading for a button</TH>
<TD><INPUT TYPE=”password” NAME=”password”></TD>
</TR>
<TR>
<TD> </TD>
<TD><INPUT TYPE=”submit” NAME=”Log On”></TD>
</TR>
</TABLE>
</FORM>
In this the form elements are getting used inside the table tags like <input type>, <text area>, etc. The form input will be given using the <td> tag that displays the table data and related information accordingly.
47- What are the different ways to use different colors for different links or same link?
The presentation is being done by CSS that is used with the HTML, to give the style to the HTML content. This is called as style sheet. The links can be specified in different colors by the following way:
a:link color: blue; background: white
a:visited color: purple; background: white
a:active color: red; background: white
This is the CSS properties that is being defined to set the color for the links that are active, visited and normal link. User can use the class attribute in the tags like <a> to use it and see the change in the link color. It is shown as:
<a class=”exp” href=”[URL]“>example of the link</a>
The style sheet can be modified according to the code that is being written. The coding will include:
a.exp:link color: yellow; background: black
a.exp:visited color: white; background: black
a.exp:active color: red; background: black
48- How to upload files using HTML to website?
The uploading of files requires some necessary configuration like:
An HTTP server that acts as a transaction between the user and the server.
Access to the directory of cgi-bin that consists of the receiving script. There are some scripts that are already available.
Form for the implementation and the coding of it will be like:
<form method=”post” enctype=”multipart/form-data” action=”up.cgi”>
The form that has to be uploaded will be done by the following given code:
<input type=file name=upload><br>
This tag will contain the file name that has to be uploaded on the website.
Any remarks about the file will be written like:
<input type=text name=remark><br>
<input type=submit value=Press> This form will allow user to upload their own file in an easy way.
</form>
There is a module named as Perl CGI.pm that supports the file upload.
49- Write a program to include the custom button with the form
Custom button can be given just by putting the image with the button or by using any other button then normal. Usually the button is being made by the <input> tag like:
<input type= “submit” value= submit>
An image can be used for the custom button as an input type like:
<input type = ”image” value = submit>
The input in the image format defines the graphical button that has to be placed in the form of submit on the web site. Image input type return the x-y coordinates rather than the normal text as a value. The attributes of Value and Alt will be used to set the name value attribute. The example for the same will be given as:
<input type=”image” name=”submit” alt=”submit” value=”submit” src=”submit.jpg”>
50- How to prevent the display of “Getting framed in HTML?
Getting framed refers to the document that is being displayed in someone else’s frameset in your HTML. This will be password protected and the permissions has to be taken before inserting the frameset. The framing of the document can be avoided by using TARGET=_top applied to all the links that will lead to the document that are outside the scope of a particular user without permission. A javaScript can be used that will automatically handle the request to remove the existing framesets. This can be given as:
<script type=”text/javascript”>
if (top.frames.length!=0)
if (window.location.href.replace)
top.location.replace(self.location.href);
else
top.location.href=self.document.href;
</script>
51- How to include a frameset inside another frameset?
One frameset can be defined inside another frameset if the accessing permission are provided directly. The frameset can be stored by using the JavaScript in the document that is being written by the user and the script is as follows:
<SCRIPT TYPE=”text/javascript”>
if (parent.location.href == self.location.href)
if (window.location.href.replace)
window.location.replace(‘frame.html’);
else
// causes problems with back button, but works
window.location.href = ‘frame.html’;
</SCRIPT>
The anchor <a> tag is used to link the frameset that can be used to restore the frames that has been stored.
<A HREF=”frameset.html” TARGET=”_top”>Restore the frame
There is always a separate frameset document written for every content document. The frameset documents are generated automatically. The content document can be linked separately rather than linking them together.
52- How to update two frames at the same time using HTML?
To update the two frames at the same time there is a requirement for the HTML based techniques that links the documents with a new frameset document. It specifies a new frames that can be combined with other frames. There is a JavaScript that will be used to link the updated frame and the method that will be used is onClick(). HTML based technique allow the new frameset document with the attribute of TARGET=_top. In this the first frameset document uses a secondary frameset document that will be defined as the nested frameset. The following code explains it further:
<frameset cols=”*,3*”>
<frame src=”first.html” name=”first_frameset”>
<frame src=”second.html” name=”sec_frameset”>
<noframes>
</body></noframes>
</frameset>
The link that is given in the TARGET= “sec_frameset” attribute it replaces all the frames that is defined as second.html.