SFDV2001 Mid Term Exam

Page 1

SFDV2001 Mid Term Exam MCQS � 20 marks (Each ques on carries 1 mark) 1. Which one of the following is true about JavaScript? a) JavaScript is a programming language b) JavaScript is a scrip ng language c) JavaScript is a version of Java d) JavaScript does not use objects

Name : ID: Group: Instructions: Time : 90 minutes Marks : 50 (15% of course)

Answer ALL Questions Return this question sheet and your answer sheet back

2. Which one of the following is used to validate a form? a) HTML b) CSS c) JavaScript d) None of the above 3. In JavaScript objects have _______ a) func ons only b) methods only c) variables only d) methods and variables 4. document.writeln() is an example of a _________ a) variable of document object b) func on of document object c) method of document object d) all of the above 5. document.body.bgColor is an example of a a) variable of body object b) func on of body object c) method of body object d) all of the above 6. onClick in an example of a a) a variable b) a func on c) a method d) an event 7. What is the output of the following JavaScript func on? x = 1; y = 2; if (y <= x) document.writeln("x"); else document.writeln("y"); a) it prints y b) it print x c) it prints x and y d) there is no output SFDV2001 / Mid Term Exam /2010

1


8. What does the following func on do? function X(num) { return num * num * num; } a) prints the num three mes with two stars in between b) prints the num two mes with three stars c) returns the square of num d) returns the cube of num 9. Which one of the following can be done using JavaScript? a) Server side processing b) Client side processing c) both a) and b) d) none of the above 10. Which of the following can be used to take an input value from the user using JavaScript? a) alert() b) prompt() c) document.writeln() d) onClick 11. What is the color of body and what is the color of the font according to the following CSS for the body: body { background‐color: black; color: white; } a) font is black and background is black b) font is white and background is white c) font is black and background is white d) font is white and background is black 12. Which one of the following CSS rules are needed to make an element such as div or p float at the fixed posi on of top le4 of the browser window? a) float:le4; posi on:fixed; top: 5px; le4 : 5px; b) float:le4; posi on:absolute; top: 5px; le4 : 5px; b) float:le4; posi on:absolute; b) float:le4; posi on:rela ve; top: 5px; le4 : 5px; 13. Internal style sheets are placed ___________ a) in an external CSS file b) inside tags c) in the body d) in the header

SFDV2001 / Mid Term Exam /2010

2


14. Which of the following is NOT true about naviga on? a) Naviga on should be simple and consistent b) Naviga on should be different on different pages c) Naviga on should be same on the different pages d) Naviga on should look the same on different pages 15. Which of the following a9ributes for a form should is used for submi:ng it to a the server? a) id a9ribute b) name a9ribute c) method a9ribute d) ac on a9ribute 16. Which method of the following is more secure for submi:ng the form to the server? a) POST b) GET C) MAILTO d) none of the above 17. What is the best way for using CSS on websites? a) use inline styles b) use embedded styles c) use external styles d) none of the above 18. Which tag used to link to an external stylesheet? a) <style> b) <a> c) <css> d) <link> 19. Which of the following styles is the most powerful? a) Linked styles b) Embedded style c) Inline styles d) Imported styles 20. Which one of the following is used for server side processing? a) JavaScript b) CSS c) Frames d) CGI

SFDV2001 / Mid Term Exam /2010

3


21. JavaScript Given the following registra on form, write a JavaScript func on validateForm() to validate the form as follows: [3 marks] Show an alert message when all the three ďŹ elds are empty. [3 marks] Show an alert message when the username is same as the password. <html> <head> <script language="JavaScript"> //......... </script> </head> <body> <h2>Registration Form</h2> <form name="regForm" action="#" onSubmit="validateForm()"> <p> Enter user name: <input type="text" name="userName"> </p> <p> Enter Email: <input type="text" name="email"> </p> <p> Enter Password: <input type="password" name="password"> </p> <p> <input type="submit" value="Register"> </p> </form> </body> </html> 22. CSS DeďŹ ne the following CSS styles for a web page 1) [1 mark] body background color should be lightgreen 2) [1 mark] body font color should be blue 3) [3 marks] h1 should be only 60% of the width, its font color should be orange and its margin should be 5px 4) [3 marks] p should be only 70% of the width, should have a white border and its padding should be 5px.

SFDV2001 / Mid Term Exam /2010

4


Short Answer Questions (Each question carries 2 marks) 23. When should you use id and when should you use class for your styles? 24. What are the advantages of using CSS? 25. Give some example of block level elements and some example of inline elements. 26. What is event driven programming? 27. What is an adjacent sibling selector? When can you use it? 28. What are things to avoid in naviga on? 29. Write a JavaScript func on to mul ply two numbers and show the product as a <h1>? 29. What are frames good for?

SFDV2001 / Mid Term Exam /2010

5


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.