Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1. Difference between GET and POST
- Ans. http://www.w3schools.com/tags/ref_httpmethods.asp
- 2. A .css with background image, red background for table heading, Headings aligned to left, links not having underlines and paragraph having right & left margins of 100px.
- Ans. Here is style.css:-
- body{background-image:url('C:\Pictures\bg.jpeg');}
- th{background-color:#FF0000;}
- h1,h2,h3,h4,h5,h6{text-align:left;}
- a{text-decoration: none}
- p{margin-right:100px;margin-left:100px;}
- 3. JavaScript build-in objects with description of its methods.
- Ans. An object is an unordered collection of properties, each of which has a name and a value
- i.Array: Used to store multiple values in one variable.
- Methods: concat(), indexOf(), lastIndexOf(), push(), pop(), sort(), etc.
- ii.Boolean: Used to convert a non-boolean value to a boolean.
- Methods: toString() and valueOf()
- iii.Date: To implement date and time.
- Methods: getDate(), getDay(), getFullYear(), getSeconds(), getMilliSeconds(), etc.
- iv.Math: For Mathematical methods.
- Methods: sin(), cos(), tan(), floor(), ceil(), log(), etc
- v.Number: Wrapper for primitive numbers
- Methods: toString(), valueOf(), toFixed(), toPrecision(), toExponential()
- vi.String: To store characters.
- Methods: charAt(), concat(), indexOf(), lastIndexOf(), split(), substring(), etc.
- vii.Regular Expression: To describe a pattern of characters.
- Methods: exec(), test() and toString()
- 4. Explain URL.
- Ans. URL is Universal/Uniform Resource Locator. It's a unique path/address of a file that can be accessed through the internet. The file can be of any format-HTML, mp3 or an java applet. The URL contains the name of the protocol to be used to access the file resource, a domain name that identifies a specific computer on the Internet, and a pathname, a hierarchical description that specifies the location of a file in that computer.
- For Example: http://facebook.com/index.php
- Here, http is the name of the protocol(Hypertext Transfer Protocol), facebook.com is the domain name, and /index.php is the location & file name.
- 5. Create a table with HTML tags
- Ans.
- <html>
- <head>
- <title>Table</title>
- </head>
- <body>
- <table border = "1" cellpadding = "5">
- <tr>
- <th rowspan ="2">Name of train</th>
- <th rowspan ="2">Place</th>
- <th rowspan ="2">Destination</th>
- <th colspan ="2">Time</th>
- <th rowspan ="2">Fare</th>
- </tr>
- <tr>
- <th>Departure</th>
- <th>Arrival</th>
- </tr>
- <tr>
- <td>Rajhdhani</td>
- <td>Mumbai</td>
- <td>Delhi</td>
- <td>07.30</td>
- <td>08.45</td>
- <td>Rs. 989.00</td>
- </tr>
- <tr>
- <td>Madras Mail</td>
- <td>Mumbai</td>
- <td>Madras</td>
- <td>09.00</td>
- <td>10.15</td>
- <td>Rs. 450.00</td>
- </tr>
- <tr>
- <td>Konark Exp</td>
- <td>Mumbai</td>
- <td>Manglore</td>
- <td>13.30</td>
- <td>14.45</td>
- <td>Rs. 756.00</td>
- </tr>
- <tr>
- <td>Deccan Exp</td>
- <td>Mumbai</td>
- <td>Pune</td>
- <td>16.00</td>
- <td>17.30</td>
- <td>Rs. 345.00</td>
- </tr>
- </table>
- </body>
- </html>
- 6. Write a code in JavaScript to set a cookie.
- Ans.
- function setCookie(cName,cValue,exdays){
- var expires = "expires="+new Date().getTime();
- document.cookie = cName + "=" + cValue + "; " + expires;
- }
- 7. Note on Web System Architecture
- Ans. http://blog.simcrest.com/what-is-3-tier-architecture-and-why-do-you-need-it/
- 8.What's the need of style sheet? Explain different CSS with examples.
- Ans. A style sheet is a file that defines the visual layout of web pages. We need them because:-
- a. speed: Overall, users experience of a site utilizing style sheets will generally be quicker than sites that don’t use them. After the first page is loaded with the content and style sheet, the subsequent pages will load faster as the style sheet will be in the cache memory.
- b.Maintainability: Holding all the presentation styles in one file significantly reduces maintenance time and reduces the chance of human errors, thereby improving presentation consistency.
- c.Accessibility: Sites that use CSS with either XHTML or HTML are easier to tweak so that they appear extremely similar in different browsers.
- d.Customization: If a page's layout information is all stored externally, a user can decide to disable the layout information entirely, leaving the site's bare content still in a readable form. Site authors may also offer multiple style sheets, which can be used to completely change the appearance of the site without altering any of its content.
- e.Consistency: Because the semantic file contains only the meanings an author intends to convey, the styling of the various elements of the document's content is very consistent.
- f.Portability: The deferment of presentational details until the time of presentation means that a document can be easily re-purposed for an entirely different presentation medium with merely the application of a new style sheet already prepared for the new medium and consistent with elemental or structural vocabulary of the semantic document.
- The different ways to implement CSS are:-
- a.External:An external style sheet can be written in any text editor. The file should not contain any html tags. Your style sheet should be saved with a .css extension. With an external style sheet, you can change the look of an entire Web site by changing one file. Each page must link to the style sheet using the <link> tag. The <link> tag goes inside the head section. Eg:-
- <head>
- <link rel="stylesheet" type="text/css" href="style.css">
- </head>
- b.Internal:You define internal styles in the head section of an HTML page, by using the <style> tag. Eg:-
- <head>
- <style>
- p {margin-left:10px;}
- </style>
- </head>
- c.Inline:To use inline styles you use the style attribute in the relevant tag. The style attribute can contain any CSS property. Eg: <p style="margin-left:10px;">
- 9. Write a java code to:-
- a. display digital clock on screen.
- Ans.
- <html>
- <head>
- <script type = "text/javascript">
- function getTime(){
- setTimeout("getTime()", 1000);
- document.getElementById('time').innerHTML=new Date().toLocaleTimeString();
- }
- getTime();
- </script>
- </head>
- <body>
- <h4>Current Time: <span id="time" /></h4>
- </body>
- </html>
- b. change image ads automatically after 5 seconds
- Ans.
- <html>
- <head>
- <script type="text/javascript">
- var image1 = new Image()
- image1.src = "a.jpg"
- var image2 = new Image()
- image2.src = "b.jpg"
- </script>
- </head>
- <body>
- <img src="a.jpg" width="500" height="300" name="change" />
- <script type="text/javascript">
- var step=1;
- function changeImg()
- {
- document.images.change.src = eval("image"+step+".src");
- if(step<2)
- step++;
- else
- step=1;
- setTimeout("changeImg()",5000);
- }
- changeImg();
- </script>
- </body>
- </html>
- 10.Explain DNS.
- Ans. http://computer.howstuffworks.com/dns.htm
- 11.Explain DOM with example
- Ans. http://www.w3schools.com/js/js_htmldom.asp
- 12.List and explain elements for getting user input in HTML.
- Ans. http://www.w3schools.com/html/html_forms.asp
- 13. Make a resume in HTML.
- Ans. Trick question. Resumes are made in Microsoft Word.
- 14. Write code to validate a form.
- Ans.
- <html>
- <head>
- <script>
- function validateForm(){
- var fname=document.forms["myForm"]["fname"].value;
- var age=parseInt(document.forms["myForm"]["age"].value);
- var address=document.forms["myForm"]["address"].value;
- var gender=document.forms["myForm"]["gender"].value;
- var state=document.forms["myForm"]["state"].value;
- if (fname==null || fname==""){
- alert("First name must be filled out");
- return false;
- }
- if(age<0||age>100||isNaN(age)) {
- alert("age has to be a positive number");
- return false;
- }
- if (address==null || address==""){
- alert("Please enter your address.");
- return false;
- }
- if (gender==""){
- alert("Please select your gender.");
- return false;
- }
- if (state==null || state==""){
- alert("Please enter your state");
- return false;
- }
- }
- </script>
- </head>
- <body>
- <form name="myForm" onsubmit="return validateForm()" method="post">
- First name: <input type="text" name="fname"><br>
- Age: <input type="text" name ="age"><br>
- Gender:<select name ="gender">
- <option></option>
- <option>male</option>
- <option>female</option>
- </select><br>
- Address: <textarea rows="4" cols="50" name="address"></textarea><br>
- State:<input type="text" name="state"><br>
- <input type="submit" value="Submit">
- </form>
- </body>
- </html>
- 15. Explain 3-tier architechture.
- Ans.Three-tier or multi-tier architecture are often used when describing how clients connect to servers. It consists of 3 layers:-
- a. Client Tier consists of client computers. This tier handles the presentation logic.
- b. Business Logic Tier consists of business logic servers. This tier handles the bussiness logic.
- c. Database Tier consists of database servers. This tier handles the back-end data.
- The advantages are:-
- a.Good security
- b. Faster execution
- c. very scalable
- The disadvantages are:-
- a. More expensive
- b. More complex
- 16. Write an HTML file which has a drop down menu containing colors. On selecting an option, the background color should change to the color selected.
- Ans.
- <html>
- <head>
- <script>
- function changeBackground(){
- document.body.style.backgroundColor= document.getElementById("colors").value;
- }
- </script>
- </head>
- <body>
- <form>
- <select id="colors" onchange="changeBackground()">
- <option>white</option>
- <option>red</option>
- <option>green</option>
- <option>blue</option>
- <option>grey</option>
- </select>
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement