Professional Documents
Culture Documents
1.What is HTML?
Ans:
HTML is short for HyperText Markup Language, and is the language of the World Wide Web.
It is the standard text formatting language used for creating and displaying pages on the
Web.
HTML documents are made up of two things: the content and the tags that formats it for
proper display on pages.
Ans:
Content is placed in between HTML tags 0in order to properly format it. It makes use of the less than
symbol (<) and the greater than symbol (>).
Ans:
No, there are single HTML tags that does not need a closing tag. Examples are the < img> tag and <
br> tags.
4.What are some of the common lists that can be used when designing a page?
Ans:
– ordered list
– unordered list
– definition list
– menu list
– directory list
Each of this list types makes use of a different tag set to compose
Ans:
HTML elements communicate to the browser how to render text. When surrounded by angular
brackets < > they form HTML tags. For the most part, tags come in pairs and surround text.
Ans:
The head of an HTML document is an unordered collection of information about the
document.
Ans:
Semantic HTML is a coding style where the tags embody what the text is meant to convey.
In Semantic HTML, tags like < b> < /b> for bold, and < i> < /i> for italic should not be used,
reason being they just represent formatting, and provide no indication of meaning or
structure.
The semantically correct thing to do is use < strong> < /strong> and < em> < /em> .
These tags will have the same bold and italic effects, while demonstrating meaning and
structure (emphasis in this case).
Ans:
The term DOCTYPE tells the browser which type of HTML is used on a webpage.
Failing to use DOCTYPE or using a wrong DOCTYPE may load your page in Quirks Mode. See
example:< !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">.
Ans:
Quirks Mode is a default compatibility mode and may be different from browser to browser,
which may result to a lack of consistency in appearance from browser to browser.
Ans:
No, there are some character entities that cannot be displayed when the operating system
that the browser is running on does not support the characters. When that happens, these
characters are displayed as boxes.
Ans:
Image map lets you link to many different web pages using a single image. You can define shapes in
images that you want to make part of an image mapping.
12.What is the advantage of collapsing white space?
Ans:
White spaces are blank sequence of space characters, which is actually treated as a single space
character in html. Because the browser collapses multiple space into a single space,
you can indent lines of text without worrying about multiple spaces. This enables you to organize the
html code into a much more readable format.
13.Can attribute values be set to anything or are there specific values that they accept?
Ans:
Some attribute values can be set to only predefined values. Other attributes can accept any
numerical value that represents the number of pixels for a size.
Ans:
To insert the copyright symbol, you need to type © or & #169; in an HTML file.
Ans:
Links can be created using the tag, with referencing through the use of the number (#) symbol
16.Is there any way to keep list elements straight in an html file?
Ans:
If you indent each subnested list in further than the parent list that contains it, you can at a
glance determine the various lists and the elements that it contains.
17.If you see a web address on a magazine, to which web page does it point?
Ans:
Every web page on the web can have a separate web address.
The published web address that appears within magazines typically points this top-most
page.
From this top level page, you can access all other pages within the web site.
Ans:
When you use image maps, it can easily become confusing and difficult to determine which
hotspots corresponds with which links. Using alternative text lets you put a descriptive text
on each hotspot link.
Ans:
Yes, older html files are compliant to the HTML standard. Most older files work on the newer
browsers, though some features may not work.
Ans:
No, hyperlinks can be used on text as well as images. That means you can convert an image
into a link that will allow user to link to another page when clicked. Just surround the image
within the < a href=” “> …< /a> tag combinations.
21.If the user’s operating system does not support the needed character, how can the symbol be
represented?
Ans:
In cases wherein their operating system does not support a particular character, it is still possible to
display that character by showing it as an image instead.
Ans:
The < li > tag includes two attributes – type and value. The type attribute can be used to change the
numbering type for any list item. The value attribute can change the number index.
Ans:
Style sheets enable you to build consistent, transportable, and well-defined style templates. These
templates can be linked to several different web pages, making it easy to maintain and change the
look and feel of all the web pages within a site.
Ans:
With ordered lists, you can select to use a number of different list types including alphabetical and
Roman numerals. The type attribute for unordered lists can be set to disc, square, or circle.
Ans:
To create text with different colors, use the < font color=”color”> …< /font> tags for every character
that you want to apply a color. You can use this tag combination as many times as needed,
surrounding a single character or an entire word.
26.Why are there both numerical and named character entity values?
Ans:
The numerical values are taken from the ASCII values for the various characters, but these
can be difficult to remember.
Because of this, named character entity values were created to make it easier for web page
designers to use.
Ans:
Although checkboxes don’t affect one another, grouping checkboxes together helps to
organize them.
Checkbox buttons can have their own name and do not need to belong to a group.
Ans:
Perhaps the biggest issue is the poor browser support XHTML currently enjoys.
Internet Explorer and a number of other user agents cannot parse XHTML as XML.
29.How many HTML tags are should be used for the most simple of web pages?
Ans:
< HTML> < HEAD > < TITLE > Simplest page ever! < /TITLE > < /HEAD > < BODY > Doesn’t get simpler
than this. < /BODY > < /HTML >
30.How do you make comments without text being picked up by the browser?
Ans:
Comments are used to explain and clarify code or to prevent code from being recognized by the
browser. Comments start with “*< !--” and end with ” --> “.
31.What is the difference between linking to an image, a website, and an email address?
Ans:
To link an image, use < img> tags. You need specify the image in quotes using the source attribute,
src in the opening tag. For hyperlinking, the anchor tag, < a> , is used and the link is specified in the
href attribute. Text to be hyperlinked should be placed between the anchor tags. Little known fact:
href stands for “hypertext reference.” When linking to an email, the href specification will be
“mailto:send@here.com.” See examples below:
32.What is the syntax difference between a bulleted list and numbered list?
Ans:
Bulleted lists use the < ul > tag, which stands for “unordered,” whereas < ol > is used to create an
ordered list.
33.< h2 > What is the difference between < div > and < frame > ?
Ans:
A < div > is a generic container element for grouping and styling, whereas a < frame > creates
divisions within a web page and should be used within the < frameset > tag. The use of < frame > and
< frameset > are no longer popular and are now being replaced with the more flexible < iframe > ,
which has become popular for embedding foreign elements (ie. Youtube videos) into a page.
Ans:
To ensure one shared HTML coding standard in the World Wide WebTo ensure smooth spiderability
of the HTML pageTo ensure better positioning of the HTML in Search Engines
Ans:
is used for highlighting text of any color desired, for adding colored text, for adding background
image to text.
SPAN doesn't cause a line break. It delimits text and it allows styles to be applied to a 'elemental'
region, or for the 'elemental' region to be identified, without causing a break in the text flow.
Ans:
It consists of :
Ans:
The body element defines the documents' body. It contains all the contents of the document (like
text, images, colors, graphics, etc.).
38.How do you make decision when to use use HTML & xHTML ?
Ans:
HTML and XHTML are very similar, but XHTML follows a stricter set of rules, making it easier to
validate data and design pages
CSS
1.What is CSS ?
Ans:
1. CSS stands for Cascading Style Sheets and is a simple styling language which allows attaching style
to HTML elements. Every element type as well as every occurrence of a specific element within that
type can be declared an unique style, e.g. margins, positioning, color or size.
3. CSS is a language that adds style (colors, images, borders, margins…) to your site. It’s really that
simple. CSS is not used to put any content on your site, it’s just there to take the content you have
and make it pretty. First thing you do is link a CSS-file to your HTML document.
Ans:
However, font families, URLs to images, and other direct references with the style sheet may
be.
The trick is that if you write a document using an XML declaration and an XHTML doctype,
then the CSS class names will be case sensitive for some browsers.
3.What is a class? What is an ID?
Ans:
A class is a style (i.e., a group of CSS attributes) that can be applied to one or more HTML elements.
This means it can apply to instances of the same element or instances of different elements to which
the same style can be attached.
Classes are defined in CSS using a period followed by the class name.
It is applied to an HTML element via the class attribute and the class name.
The following snippet shows a class defined, and then it being applied to an HTML DIV element.
test
Also, you could define a style for all elements with a defined class. This is demonstrated with the
following code that selects all P elements with the column class specified.
In turn, it can be associated with one HTML element with the assigned ID.
Within CSS, ID selectors are defined with the # character followed by the selector name.
The following snippet shows the CSS example1 defined followed by the use of an HTML element’s ID
attribute, which pairs it with the CSS selector.
Ans:
CSS Background
CSS Text
CSS Font
CSS Border
CSS Outline
CSS Margin
CSS Padding
CSS List
CSS Table
Ans:
Limitations are:
•No expressions
Ans:
Advantages are:
•Bandwidth
•Site-wide consistency
•Page reformatting
•Accessibility
Ans:
font-style
font-variant
font-weight
font-size/line-height
font-family
Ans:
An ID selector identifies and sets style to only one occurrence of an element, while CLASS can be
attached to any number of elements.
Ans:
It is a string of individual selectors separated by white space (search pattern), where only the
last element in the pattern is addressed providing it matches the specified contex
10.What is Grouping?
Ans:
When more than one selector shares the same declaration, they may be grouped together via a
comma-separated list; this allows you to reduce the size of the CSS (every bit and byte is important)
and makes it more readable. The following snippet applies the same background to the first three
heading elements.
Ans:
A child selector is used when you want to match an element that is the child of another
specific element.
The following selector locates an unordered list element within a paragraph element and
makes a text within that element bold.
Ans:
Pseudo classes allow you to identify HTML elements on characteristics (as opposed to their name or
attributes).
The classes are specified using a colon to separate the element name and pseudo class.
A good example is the :link and :visited pseudo classes for the HTML A element.
Another good example is first-child, which finds an element’s first child element.
The following CSS makes all visited links red and green, the actual link text becomes yellow when the
mouse pointer is positioned over it, and the text of the first element of a paragraph is bold.
Ans: The z-index property specifies the stack order of an element. An element with greater stack
order is always in front of an element with a lower stack order. Here is the Example, where using z-
index property you can display in front of image.
Ans:
Benefits:
•One file can be used to control multiple documents having different styles.
•Multiple HTML elements can have many documents, which can have classes.
•To group styles in composite situations, methods as selector and grouping are used.
Demerits:
•To render the document, the external style sheet should be loaded.
Ans:
•Styles, in complex situations, can be applied by using Selector and Grouping methods.
Ans:
There are two types of CSS rules: —> ruleset and at-rule.
Ruleset identifies selector or selectors and declares style which is to be attached to that selector or
selectors. For example P
{text-indent: 10pt} is a CSS rule. CSS rulesets consist of two parts: selector, e.g. P and declaration, e.g.
{text-indent: 10pt}.
Ans: Imported Style Sheet is a sheet that can be imported to (combined with) another sheet. This
allows creating one “main sheet” containing declarations that apply to the whole site and” partial
sheets” containing declarations that apply to specific elements (or documents) that may require
additional styling. By importing partial sheets to the main sheet a number of sources can be
combined into one. To import a style sheet or style sheets include the @import notation or notations
in the STYLE element. The @import notations must come before any other declaration. If more than
one sheet is imported they will cascade in order they are imported – the last imported sheet will
override the next last; the next last will override the second last, and so on. If the imported style is in
conflict with the rules declared in the main sheet then it will be overridden.
Ans: To combine multiple/partial style sheets into one set the TITLE attribute taking one and the
same value to the LINK element. The combined style will apply as a preferred style, e.g.
Ans:
Parent-child selector is a selector representing the direct descendent of a parent element. Parent-
child selectors are created by listing two or more tilde (~) separated selectors.
The P element will be declared the specified style only if it directly descends from the BODY
element:
< BODY& gt; < P > Red and white paragraph < /P > < /BODY >
The EM element will be declared the specified style only if it directly descends from the P element
which in its turn directly descends from the BODY element:
< P > < EM> Red and white EM < /EM > < /P > < /BODY >
Ans:
With CSS, you can suggest a background image (and a background color, for those not using your
image) with the background property. Here is an example:
body {
color: black ;
If you specify a background image, you should also specify text, link, and background colors since
the reader’s default colors may not provide adequate contrast against your background image. The
background color may be used by those not using your background image. Authors should not rely
on the specified background image since browsers allow their users to disable image loading or to
override document-specified backgrounds.
Ans:
With CSS, you can use the background-attachment property. The background attachment can be
included in the shorthand background property, as in this example:
body {
color: black ;
Note that this CSS is supported by Internet Explorer, Mozilla, Firefox Opera, Safari, and other
browsers. In contrast, Microsoft’s proprietary BGPROPERTIES attribute is supported only by Internet
Explorer.
JAVA SCRIPT
1.What is JavaScript?
Ans:
JavaScript is a general-purpose programming language designed to let programmers of all skill levels
control the behavior of software objects.
The language is used most widely today in Web browsers whose software objects tend to
represent a variety of HTML elements in a document and the document itself.
But the language can be--and is--used with other kinds of objects in other environments.
For example, Adobe Acrobat Forms uses JavaScript as its underlying scripting language to
glue together objects that are unique to the forms generated by Adobe Acrobat.
Therefore, it is important to distinguish JavaScript, the language, from the objects it can
communicate with in any particular environment.
When used for Web documents, the scripts go directly inside the HTML documents and are
downloaded to the browser with the rest of the HTML tags and content.
Ans:
Yes, absolutely. For example, the function getElementById is not the same as the function
getElementbyID. Keeping your capitalization consistent is important.
Ans:
Java is a powerful object - oriented programming language like C++, C whereas JavaScript is a
client-side scripting language with some limitations.
Ans:
‘This’ keyword is used to point at the current object in the code. For instance: If the code is presently
at an object created by the help of the ‘new’ keyword, then ‘this’ keyword will point to the object
being created.
5.Explain the different types of pop-up boxes you can create in JavaScript.
Ans:
There are three main types of pop-up boxes in JavaScript: alert boxes, confirm boxes, and prompt
boxes.
•Alert Box: Used to confirm that a user understands a vital piece of information before proceeding.
The user must click OK to exit the box.
window.alert("Alert text here."); •Confirm box:a Used when user verification is required. It will
return TRUE if the user clicks OK, and FALSE if the user clicks CANCEL.
window.confirm("Confirm text here."); •Prompt box: Used if the user needs to input something
before proceeding. When the user inputs a value and presses OK, the prompt box will return the
input value. If the user clicks CANCEL without inputting a value, the input value will return as null.
Ans:
JavaScript Data Types are Number, String, Boolean, Function, Object, Null, Undefined
Ans:
JavaScript supports the for loop, while loop, do-while loop, but there is no foreach loop in JavaScript.
Ans:
Ans:
avaScript was developed by Brendan Eich of Netscape Java was developed at Sun Microsystems.
While the two languages share some common syntax, they were developed independently of each
other and for different audiences. Java is a full-fledged programming language tailored for network
computing it includes hundreds of its own objects, including objects for creating user interfaces that
appear in Java applets (in Web browsers) or standalone Java applications. In contrast, JavaScript
relies on whatever environment it's operating in for the user interface, such as a Web document's
form elements.
JavaScript was initially called LiveScript at Netscape while it was under development. A licensing deal
between Netscape and Sun at the last minute let Netscape plug the "Java" name into the name of its
scripting language. Programmers use entirely different tools for Java and JavaScript. It is also not
uncommon for a programmer of one language to be ignorant of the other. The two languages don't
rely on each other and are intended for different purposes. In some ways, the "Java" name on
JavaScript has confused the world's understanding of the differences between the two. On the other
hand, JavaScript is much easier to learn than Java and can offer a gentle introduction for newcomers
who want to graduate to Java and the kinds of applications you can develop with it.
Ans:
The == checks for value equality, but === checks for both type and value.
Ans:
•if statement
•switch statement
Ans:
Since 1 is a string, everything is a string, so the result is 124. In the second case, its 93.
Ans:
GET: Parameters are passed in the query string. Maximum amount of data that can be sent via the
GET method is limited to about 2kb.
POST: Parameters are passed in the request body. There is no limit to the amount of data that can be
transferred using POST. However, there are limits on the maximum amount of data that can be
transferred in one name/value pair.
Ans:
Yes. Since JavaScript is a client-side script it does require the web server's help for its computation, so
it is always faster than any server-side script like ASP, PHP, etc.
Ans:
No. Javascript does not have block level scope, all the variables declared inside a function possess
the same level of scope unlike c, c++, java.
Ans:
Ans:
The user can be given control over the browser like User input validation Simple
computations can be performed on the client's machine The user's browser, OS, screen size,
etc.
Ans:
Undefined value means the variable used in the code doesn't exist or is not assigned any value or the
property doesn't exist
Ans:
(i) Undefined value cannot be explicitly stated that is there is no keyword called undefined whereas
null value has keyword called null
(ii) typeof undefined variable or property returns undefined whereas typeof null value returns
object
Ans:
It is perfectly legal to assign a number to a variable and then assign a string to the same variable as
follows
example
i = 10;
i = "string";
Undeclared variables are those that are not declared in the program (do not exist at all),
trying to read their values gives runtime error.But if undeclared variables are assigned then
implicit declaration is done .
Undefined variables are those that are not assigned any value but are declared in the
program. Trying to read such variables gives special value called undefined value.
Ans:
In JavaScript === is strict equality operator ,it returns true only when the two operands are having
the same value without any type conversion.
Ans:
document.getElementById("myObject").disabled = true;
Ans:
Changing the contents of an element is a much better solution. When the method showStatus is
invoked it will change the content of the span.
function showStatus(message) {
return true;
Ans:
Below line will help us how to create a popup warning box in JavaScript....
Ans:
Below line will help us how to create a Confirmation box in JavaScript....
Ans:
Ans:
Between CSS and JavaScript is a weird symmetry. CSS style rules are laid on top of the DOM. The CSS
property names like "font-weight" are transliterated into "myElement.style.fontWeight". The class of
an element can be swapped out. For example:
document.getElementById("myText").style.color = "green";
document.getElementById("myText").style.fontSize = "20";
-or-
document.getElementById("myText").className = "regular";
Ans:
Change the "visibility" attribute of the style object associated with your element. Remember that a
hidden element still takes up space, use "display" to make the space disappear as well.
if ( x == y) {
myElement.style.visibility = 'visible';
} else {
myElement.style.visibility = 'hidden';
Ans:
In theory, we should cache the current state of the cursor and then put it back to its original state.
document.body.style.cursor = 'wait';
document.body.style.cursor = 'auto';
< !--
location.href="http://www.globalguideline.com";
//-- >
Ans:
We can use the parseInt() and parseFloat() methods in JavaScript to convert a string to a number or
numeric value. Notice that extra letters following a valid number are ignored, which is kinda wierd
but convenient at times.
Ans:
//or
Ans:
Time inside a date object is stored as milliseconds since Jan 1, 1970 in JavaScript.
e.g.
new Date(06,01,02) // produces "Fri Feb 02 1906 00:00:00 GMT-0600 (Central Standard Time)"
Ans:
Math.PI, Math.E
Ans:
The delete operator is used to delete all the variables and objects used in the program ,but it does
not delete variables declared with var keyword.
Ans:
It creates a function called square with argument x and returns x multiplied by itself.
Ans:
Use document.forms[0].submit()
(0 refers to the index of the form – if we have more than one form in a page, then the first one has
the index 0, second has index 1 and so on).
Ans:
I/O operations like reading or writing a file is not possible with client-side JavaScript. However , this
can be done by coding a Java applet that reads files for the script
In order to detect the operating system on the client machine, the navigator.appVersion string
(property) should be used.
Ans:
In the case of Netscape with Windows OS, all the cookies are stored in a single file called
cookies.txt
c:Program FilesNetscapeUsersusernamecookies.txt
c:WindowsCookiesusername@Website.txt
Ans:
Ans:
&&, || and !
Ans:
Ans:
47.How to access an external JavaScript file that is stored externally and not embedded?
Ans: This can be achieved by using the following tag between head tags or between body tags.
How to access an external JavaScript file that is stored externally and not embedded? where abc.js is
the external JavaScript file to be accessed.
Ans:
That being said, namespacing is used to bundle up all your functionality using a unique
name.
In JavaScript, a namespace is really just an object that you’ve attached all further methods,
properties and objects.