Sample Midterm - PowerPoint PPT Presentation

1 / 26
About This Presentation
Title:

Sample Midterm

Description:

FOOTBALL BR INPUT type='radio' name='BB' value='BB' checked BASKETBALL BR ... INPUT TYPE='image' src='logo.jpg' INPUT TYPE='reset' value='RESET' /BODY /HTML ... – PowerPoint PPT presentation

Number of Views:136
Avg rating:3.0/5.0
Slides: 27
Provided by: birgl
Category:

less

Transcript and Presenter's Notes

Title: Sample Midterm


1
Sample Midterm
2
True or False
  • The Dynamic HTML event model exists so that
    scripts can respond to user actions and change
    the page accordingly.
  • True
  • It is not necessary to use the id attribute for
    an XHTML element which you want to respond to an
    onclick event handler.
  • False
  • Inline scripting allows the programmer to specify
    event handling within the tag of the targeted
    element.
  • True

3
True or False
  • The onload event fires only when an XHTML page
    has finished loading successfully.
  • False Not only on page but also on any
    element
  • The onerror event fires when a user inputs an
    incorrect value to a prompt window.
  • False When there is error in code
  • The onmousemove event fires once when the mouse
    first moves after being motionless.
  • False continuously when moving

4
True or False
  • The offsetX and offsetY properties of the event
    object give the location of the mouse cursor
    relative to the top-left corner of the object on
    which the event was triggered.
  • True
  • It is possible to tell whether the Shift key was
    held down when an event fired.
  • True
  • The rollover event fires when the mouse cursor
    moves over an element.
  • False - onMouseOver

5
True or False
  • The expression event.srcElement.id is a method
    call which returns the id attribute of the
    targeted element.
  • False id of element that fired the event
  • If you want a form's submit button to do
    something other than submit the form, you should
    set the returnValue property to false.
  • True

6
Multiple Choice
  • The ________ model of registering event handlers
    requires adding parentheses at the end of the
    function name and surrounding it in quotes.
  • a) inline
  • b) traditional
  • c) div
  • d) onclick
  • Ans a
  • The ________ model of registering event handlers
    involves passing a function object to be invoked
    when the event fires.
  • a) inline
  • b) traditional
  • c) div
  • d) onclick
  • Ans b

7
Multiple Choice
  • In an event-handling function, this refers to
  • a) The property of the document that is to be
    altered.
  • b) The event that triggered the event-handling
    function.
  • c) The event-handling function.
  • d) The object on which the event occurred.
  • Ans d
  • What do the srcElement and target event
    properties contain?
  • a) a reference to the source code of an element
  • b) a reference to the element targeted by the
    action
  • c) a reference to the source code of an image
  • d) a reference to the name of the event that
    fired the action
  • Ans b

8
Multiple Choice
  • The onfocus event fires when ________.
  • a) an element is loaded from the document
  • b) an image is loaded into the document
  • c) an element is clicked or selected using the
    tab key
  • d) an image is downloaded
  • Ans c
  • The onblur event is associated with ________.
  • a) data transfer within the document
  • b) image resolution
  • c) background effects
  • d) an element losing focus
  • Ans d

9
Question-1
  • Write the code to add the colortext applet into
    HTML code where
  • colortext.class is at class folder
  • text parameter will have value Name
  • backgroundcolor parameter will have color
    white in numeric value red would be (255,0,0)
  • fontsize parameter will be 24

10
Answer-1
  • ltapplet code/class/colortext.classgt
  • ltparam name text value Namegt
  • ltparam name backgroundcolor
    value 255,255,255gt
  • ltparam name fontsize value 24gt
  • lt/appletgt

11
Question-2
  • What would the browser display if the following
    script was executed and the user entered 3 at
    both prompts?
  • ltSCRIPT LANGUAGE "JavaScript"gt
  • var firstNumber window.prompt("Enter an
    integer", 0)
  • var secondNumber window.prompt("Enter an
    integer",0)
  • var thirdNumber
  • thirdNumber firstNumber secondNumber
  • document.write( thirdNumber )
  • lt/SCRIPTgt

12
Answer-2
  • 33

13
Question-3
  • Write the necessary code to write You are not an
    Internet Explorer user if the browser is other
    than Internet Explorer, else it will write
    Thanks for using Internet Explorer.

14
Answer-3
  • ltHTMLgt
  • ltHEADgt
  • ltscript languageJavaScript"gt
  • var an navigator.appName
  • if ( an "Microsoft Internet Explorer" )
  • document.write ("Thanks for using Internet
    Explorer")
  • else
  • document.write ("You are not an Internet
    Explorer user")
  • lt/scriptgt
  • lt/HEADgt
  • ltBODYgtlt/BODYgtlt/HTMLgt

15
Question-4
  • Write the necessary code to print lines for each
    month including this month when the page is
    loaded. If this month is February, the result
    will look like this
  • Month 1 _______
  • Month 2 _______

16
Answer-4
  • ltHTMLgtltHEADgtltscript language"javascript"gt
  • function DisplayMonth()
  • var counter1
  • var mydate new Date()
  • var x mydate.getMonth() 1
  • while (counter lt x1 )
  • document.write ("Month " counter " ")
  • document.write ("____________________ ltbrgt")
  • counter counter 1
  • lt/scriptgt
  • lt/HEADgtltbody onload DisplayMonth()"gtlt/bodygtlt/HTM
    Lgt

17
Question-5
  • lthtmlgtltheadgtlttitlegtSPORT RESEARCHlt/titlegtlt/headgtltb
    odygt
  • ltFORM method"post" name"SPORT"
    action"mailtokutlu_at_boun.edu.tr"gt
  • ltTABLEgtltTRgtltTDgtNAME
  • ltTDgtltINPUT Type"text" name"Name" size"30"gt
    ltbrgt
  • ltTRgtltTDgtADDRESS
  • ltTDgtltTEXTAREA name"Address" rows3 cols30gt
  • lt/TEXTAREAgtltBRgt
  • lt/TABLEgt
  • ltBRgtYOUR FAVORITE SPORT ltBRgt
  • ltINPUT type"radio" name"FB" value"FB"gt
  • FOOTBALLltBRgt
  • ltINPUT type"radio" name"BB" value"BB" checkedgt
  • BASKETBALLltBRgt
  • ltINPUT type"radio" name"T" value"T"gt TENNISltBRgt

18
Question-5 (Contd)
  • ltBRgtSELECT ALL APPLICABLE FOR YOUR FAVORITE
    SPORT
  • ltSELECT Name"minterest" size"3" multiplegt
  • ltOPTION SELECTEDgt I LIKE PLAYING.
  • ltOPTIONgt I LIKE WATCHING IT ON SITE.
  • ltOPTIONgt I LIKE WATCHING IT ON TV.
  • lt/SELECTgt
  • ltBRgtltBRgt
  • ltINPUT TYPE"image" src"logo.jpg"gt
  • ltINPUT TYPE"reset" value"RESET"gt
  • lt/BODYgtlt/HTMLgt

19
Answer-5
20
Question-6
Write the code for the below page view. Top frame
height is 70 and left frame width is 220 pixels
21
Answer-6 Frame Page
  • ltHTMLgtltHEADgt
  • ltTITLEgtFramelt/TITLEgt
  • lt/HEADgt
  • ltframeset rows70,gt
  • ltframe name"top" src"top.htm"gt
  • ltframeset cols220,gt
  • ltframe name"left" src"left.htm"gt
  • ltframe name"right" src"right.htm"gt
  • lt/framesetgt
  • lt/framesetgt
  • ltBODYgtlt/BODYgt
  • lt/HTMLgt

22
Answer-6 Top Page
  • ltHTMLgtltHEADgtlt/HEADgt
  • ltBODY textbluegt
  • ltPgt
  • (THIS IS "TOP.HTM" ON FRAME "TOP",nbsp
  • TEXT COLORBLUE,nbsp IMAGELOGO.JPG)
  • lt/Pgt
  • ltPgt
  • ltIMG src"logo.jpg" aligncenter gt
  • BOGAZIÇI UNIVERSITY
  • lt/Pgt
  • lt/BODYgtlt/HTMLgt

23
Answer-6 Left Page
  • ltHTMLgtltHEADgtlt/HEADgtltBODYgt
  • THIS IS "LEFT.HTM" ltBRgtON FRAME "LEFT".
  • ltULgtltLIgt
  • ltA HREF"http//www.mis.boun.edu.tr"
    TARGET"_BLANK"gt
  • LINK TO MIS DEPARTMENT,
  • WILL DISPLAY ON A NEW WINDOW lt/Agt
  • ltLIgt
  • ltA HREF"REG.HTM" TARGET"RIGHT"gt
  • LINK TO REGULATIONS PAGE REG.HTM,
  • WILL DISPLAY AT "RIGHT" FRAMElt/Agt
  • ltLIgt
  • ltA HREF"MAILTOBOUN_at_BOUN.EDU.TR"gt
  • LINK TO BOUN_at_BOUN.EDU.TR lt/Agt
  • lt/ULgt
  • lt/BODYgtlt/HTMLgt

24
Answer-6 Right Page
  • ltHTMLgt
  • ltHEADgt
  • lt/HEADgt
  • ltBODYgt
  • THIS IS "RIGHT.HTM" ON FRAME "RIGHT".
  • lt/BODYgt
  • lt/HTMLgt

25
Question-7
  • Write the script code for displaying an alert box
    having text You are leaving with the location
    of the page while leaving the page.

26
Answer-7
  • ltHTMLgtltHEADgt
  • ltSCRIPT languageJavaScriptgt
  • var urldocument.location
  • function x()
  • alert(You are leaving url)
  • lt/HEADgt
  • ltBODY onUnloadx()gt
  • lt/BODYgt
  • lt/HTMLgt
Write a Comment
User Comments (0)
About PowerShow.com