Access and secure data (26%) Flashcards

1
Q

What type of input provides a color picker?

A

color

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What type of input provides a date picker?

A

date

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What type of input provides a date/time picker?

A

datetime

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What type of input enables users to select a numeric month and year?

A

month

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What type of input enables users to select a numeric week and year?

A

week

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What type of input enables users to select a time of day?

A

time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What type of input forces the input to be numeric?

A

number

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What type of input forces the input to be a properly formatted email address?

A

email

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What type of input allows users to select a value within a range by using a slider bar?

A

range

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What type of input formats entered data as a phone number?

A

tel

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What type of input formats entered data as a properly formatted URL?

A

url

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What type of input displays a radio button?

A

radio

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What type of input displays a checkbox?

A

checkbox

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What type of input displays a masked textbox for passwords?

A

password

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What type of input displays a button?

A

button

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What type of input resets all HTML elements within a form?

A

reset

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What type of input posts the form’s data to the web server?

A

submit

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What type of input displays a textbox?

A

text

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What is the syntax to define a textarea with a specified number of columns and rows?

A

<textarea></textarea>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What formats does the url input accept?

A

Absolute URL’s with protocol unless overridden with the pattern attribute.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Which input cannot have a default value or be updated with JavaScript?

A

password

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

How do you default a checkbox input to be checked?

A

Add the checked attribute

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

How do you create a radio button group?

A

Set the name attributes of the radio inputs to the same value.

<tr>
<td>
Rate your experience:
</td>
<td>
<input></input> 1 - Very Poor
<input></input> 2
<input></input> 3
<input></input> 4
<input></input> 5 - Very Good
</td>
</tr>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

What types of elements can act as buttons?

A

Anything can be a button if it has a click event or a mousedown and mouseup event.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
What are the six default button types?
```
26
Which button element provides default text for display?
input The button element does not automatically provide default text to display as the input element does.
27
Which attribute is used to make a control read-only?
readonly
28
Which attribute is used to spellcheck the user's input?
spellcheck
29
Which attribute is used to validate the user's input against a regular expression?
pattern
30
Which inputs support the pattern attribute?
text, search, url, tel, email, and password
31
Which attribute is used to display watermark text?
placeholder
32
Which attribute makes the input required?
required
33
What character is used to enclose regular expressions in JavaScript?
The forward slash (/) ``` var s = $('#regExString').val(); var regExpression = /^[A-Z,a-z]\d[A-Z,a-z][\s{1}]?\d[A-Z,a-z]\d/; if (regExpression.test(s)) alert("Valid postal code."); else alert("Invalid postal code."); ```
34
What two methods are available on regular expression objects?
test and exec
35
What method on the regular expression object returns true if the string matches the pattern?
test
36
What method on the regular expression object returns the portion of the string that matches the pattern or null if not match is found?
exec
37
What function is used to determine if a value is not a number?
isNan Returns true if the value passed in is not a number
38
What function is used to determine if a value is a number?
isFinite Returns true is the value passed in is a number
39
Which attribute is used to restrict what data can be placed in an iframe element?
sandbox
40
What are the available values for the sandbox attribute of the iframe element?
"" (empty string), allow-same-origin, allow-top-navigation, allow-forms, allow-scripts
41
What value for the sandbox attribute of the iframe element applies all restrictions and is the most secure?
"" (empty string)
42
What value for the sandbox attribute of the iframe element treats iframe content as being from the same origin as the containing HTML document?
allow-same-origin
43
What value for the sandbox attribute of the iframe element allows iframe content to load content from the containing HTML document?
allow-top-navigation
44
What value for the sandbox attribute of the iframe element allows iframe content to submit forms?
allow-forms
45
What value for the sandbox attribute of the iframe element allows iframe content to run script?
allow-scripts
46
What object can be used to request JSON and XML from the server synchronously or asynchronously?
XMLHttpRequest
47
What events are available for handling on the XMLHttpRequest object?
readystatechange and timeout
48
Which event on the XMLHttpRequest object is used with asynchronous calls?
readystatechange
49
Which event on the XMLHttpRequest object is raised when the request can't be completed?
timeout
50
What methods are available on the XMLHttpRequest object?
abort, getAllResponseHeaders, getResponseHeader, send, setRequestHeader, open
51
Which method of the XMLHttpRequest object cancels the current request?
abort
52
Which method of the XMLHttpRequest object gives a complete list of response headers?
getAllResponseHeaders
53
Which method of the XMLHttpRequest object returns the specific response header?
getResponseHeader
54
Which method of the XMLHttpRequest object makes the HTTP request and receives the response?
send
55
Which method of the XMLHttpRequest object adds a custom HTTP header to the request?
setRequestHeader
56
Which method of the XMLHttpRequest object sets properties for the request such as the URL, a user name, and a password?
open
57
What properties are available on the XMLHttpRequest object?
readyState, response, responseBody, responseText, responseType, responseXML, status, statusText, timeout, withCredentials
58
Which property of the XMLHttpRequest object gets the current state of the object?
readyState
59
Which property of the XMLHttpRequest object gets the response returned from the server?
response
60
Which property of the XMLHttpRequest object gets the response body as an array of bytes?
responseBody
61
Which property of the XMLHttpRequest object gets the response body as a string?
responseText
62
Which property of the XMLHttpRequest object gets the data type associated with the response, such as blob text, array-buffer, or document?
responseType
63
Which property of the XMLHttpRequest object gets the response body as an XML DOM object?
responseXML
64
Which property of the XMLHttpRequest object gets the HTTP status code of the request?
status
65
Which property of the XMLHttpRequest object gets the friendly HTTP text that corresponds with the status?
statusText
66
Which property of the XMLHttpRequest object sets the timeout threshold on the request in milliseconds?
timeout
67
Which property of the XMLHttpRequest object specifies whether the request should include user credentials?
withCredentials
68
Study this simple synchronous example of using the XMLHttpRequest object.
``` $("document").ready(function () { $("#btnGetXMLData").click(function () { var xReq = new XMLHttpRequest(); xReq.open("GET", "myXMLData.xml", false); xReq.send(null); #("#results").text(xReq.response); }); }); ```
69
What are the parameters of the open method of the XMLHttpRequest object?
method, url, async, username, password
70
Which parameter of the open method of the XMLHttpRequest object is used to specify the HTTP method being used for the request: GET, POST, etc.?
method
71
Which parameter of the open method of the XMLHttpRequest object is used to specify the URL to make the request to?
url
72
Which parameter of the open method of the XMLHttpRequest object is used to specify a Boolean value to indicate whether the call should be made asynchronously?
async | If true, an event handler needs to be set for the onreadystatechanged
73
Which parameter of the open method of the XMLHttpRequest object is used to specify a user name if the destination requires credentials?
username
74
Which parameter of the open method of the XMLHttpRequest object is used to specify a password if the destination requires credentials?
password
75
What must be done to make an asynchronous call using the XMLHttpRequest object?
Add a handler for the readystatechanged event and pass true for the async parameter of the open method.
76
Which method of the XMLHttpRequest object actually makes the server request?
send The open method does not make server requests. The send method does that.
77
When are the username and password sent during an XMLHttpRequest request?
The username and password are only passed to the server in response to a 401 HTTP code from the server.
78
What is the default value for the timeout property of the XMLHttpRequest object?
By default, the value for timeout is zero, which is infinite. A timeout value should always be specified.
79
What value must be specified for the timeout property of the XMLHttpRequest object in order to wait indefinitely for the server's response?
Zero which is infinite.
80
Study this simple asynchronous example of using the XMLHttpRequest object.
``` var XMLHTTPReadyState_COMPLETE = 4; var xReq = new XMLHttpRequest(); xReq.open("GET", "myXMLData.xml", true); xReq.timeout = 2000; xReq.ontimeout = function () { $("#results").text("Request Timed out"); } xReq.onreadystatechange = function (e) { if (xReq.readyState == XMLHTTPReadyState_COMPLETE) { if (xReq.status = "200") { $("#results").text(xReq.response); } else { $("#results").text(xReq.statusText); } } } xReq.send(null); ```
81
What are the possible values for the readyState property of the XMLHttpRequest object?
``` 0 - request not initialized 1 - server connection established 2 - request received 3 - processing request 4 - request finished and response is ready ```
82
What value of the readyState property of the XMLHttpRequest object indicates that the request is finished and the response is ready?
4
83
Study this simple example of using the XMLHttpRequest object to send data.
``` var xmlData = " "; var xReq = new XMLHttpRequest(); xReq.open("POST", "/ReceiveXMLData.aspx", false); xReq.send(xmlData); ```
84
What object and method are used to serialize a JSON object into a string?
JSON.stringify ``` var person = { firstName: "Rick", hairColor: "Brown" }; var jsonString = JSON.stringify(person); ```
85
What object and method are used to deserialize a string into a JSON object?
JSON.parse ``` var req = new XMLHttpRequest(); req.open("GET", "MyJsonData.json", false); req.send(null); var jsonPerson = JSON.parse(req.responseText); ```
86
How should an XMLHttpRequest object be configure to send data serialized as binary?
Set the responseType property to 'blob'. ``` var xReq = new XMLHttpRequest(); xReq.open("POST", "saveImage.aspx", false); xReq.responseType = 'blob'; xReq.send(data); ```
87
What object and method is used to deserialize binary data received from an XMLHttpRequest object?
URL.createObjectURL ``` var xReq = new XMLHttpRequest(); xReq.open("GET", "orange.jpg", false); xReq.responseType = 'blob'; xReq.send(null); var blob = xReq.response; document.getElementById("result").src = URL.createObjectURL(blob); ```
88
What is the syntax for the simplest form element?
|
89
What is the syntax for submitting a form using jQuery?
$("form").submit(function () { | });
90
What jQuery method is used to serialize a form into a query string?
serialize ``` $("form").submit(function () { var qString = $(this).serialize(); alert(qString); $.ajax({ url: 'processSignUp.aspx', type: "POST", data: qString, success: function (r) { } }); return false; // Cancel the event. }); ```
91
What must be specified for all HTML elements in order for them to be serialized using jQuery.serialize?
The name attribute
92
Which HTML elements will not be serialized by the jQuery.serialize method?
Elements without the name attribute and elements in an invalid state.