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
Q

What are the six default button types?

A
<input type="button"
<button type="button"
<input type="reset"
<button type="reset"
<input type="submit"
<input type="submit"
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

Which button element provides default text for display?

A

input

The button element does not automatically provide default text to display as the input element does.

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

Which attribute is used to make a control read-only?

A

readonly

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

Which attribute is used to spellcheck the user’s input?

A

spellcheck

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

Which attribute is used to validate the user’s input against a regular expression?

A

pattern

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

Which inputs support the pattern attribute?

A

text, search, url, tel, email, and password

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

Which attribute is used to display watermark text?

A

placeholder

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

Which attribute makes the input required?

A

required

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

What character is used to enclose regular expressions in JavaScript?

A

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.");
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

What two methods are available on regular expression objects?

A

test and exec

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

What method on the regular expression object returns true if the string matches the pattern?

A

test

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

What method on the regular expression object returns the portion of the string that matches the pattern or null if not match is found?

A

exec

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

What function is used to determine if a value is not a number?

A

isNan

Returns true if the value passed in is not a number

38
Q

What function is used to determine if a value is a number?

A

isFinite

Returns true is the value passed in is a number

39
Q

Which attribute is used to restrict what data can be placed in an iframe element?

A

sandbox

40
Q

What are the available values for the sandbox attribute of the iframe element?

A

”” (empty string), allow-same-origin, allow-top-navigation, allow-forms, allow-scripts

41
Q

What value for the sandbox attribute of the iframe element applies all restrictions and is the most secure?

A

”” (empty string)

<iframe></iframe>

42
Q

What value for the sandbox attribute of the iframe element treats iframe content as being from the same origin as the containing HTML document?

A

allow-same-origin

43
Q

What value for the sandbox attribute of the iframe element allows iframe content to load content from the containing HTML document?

A

allow-top-navigation

44
Q

What value for the sandbox attribute of the iframe element allows iframe content to submit forms?

A

allow-forms

45
Q

What value for the sandbox attribute of the iframe element allows iframe content to run script?

A

allow-scripts

46
Q

What object can be used to request JSON and XML from the server synchronously or asynchronously?

A

XMLHttpRequest

47
Q

What events are available for handling on the XMLHttpRequest object?

A

readystatechange and timeout

48
Q

Which event on the XMLHttpRequest object is used with asynchronous calls?

A

readystatechange

49
Q

Which event on the XMLHttpRequest object is raised when the request can’t be completed?

A

timeout

50
Q

What methods are available on the XMLHttpRequest object?

A

abort, getAllResponseHeaders, getResponseHeader, send, setRequestHeader, open

51
Q

Which method of the XMLHttpRequest object cancels the current request?

A

abort

52
Q

Which method of the XMLHttpRequest object gives a complete list of response headers?

A

getAllResponseHeaders

53
Q

Which method of the XMLHttpRequest object returns the specific response header?

A

getResponseHeader

54
Q

Which method of the XMLHttpRequest object makes the HTTP request and receives the response?

A

send

55
Q

Which method of the XMLHttpRequest object adds a custom HTTP header to the request?

A

setRequestHeader

56
Q

Which method of the XMLHttpRequest object sets properties for the request such as the URL, a user name, and a password?

A

open

57
Q

What properties are available on the XMLHttpRequest object?

A

readyState, response, responseBody, responseText, responseType, responseXML, status, statusText, timeout, withCredentials

58
Q

Which property of the XMLHttpRequest object gets the current state of the object?

A

readyState

59
Q

Which property of the XMLHttpRequest object gets the response returned from the server?

A

response

60
Q

Which property of the XMLHttpRequest object gets the response body as an array of bytes?

A

responseBody

61
Q

Which property of the XMLHttpRequest object gets the response body as a string?

A

responseText

62
Q

Which property of the XMLHttpRequest object gets the data type associated with the response, such as blob text, array-buffer, or document?

A

responseType

63
Q

Which property of the XMLHttpRequest object gets the response body as an XML DOM object?

A

responseXML

64
Q

Which property of the XMLHttpRequest object gets the HTTP status code of the request?

A

status

65
Q

Which property of the XMLHttpRequest object gets the friendly HTTP text that corresponds with the status?

A

statusText

66
Q

Which property of the XMLHttpRequest object sets the timeout threshold on the request in milliseconds?

A

timeout

67
Q

Which property of the XMLHttpRequest object specifies whether the request should include user credentials?

A

withCredentials

68
Q

Study this simple synchronous example of using the XMLHttpRequest object.

A
$("document").ready(function () {
        $("#btnGetXMLData").click(function () {
                var xReq = new XMLHttpRequest();
                xReq.open("GET", "myXMLData.xml", false);
                xReq.send(null);
                #("#results").text(xReq.response);
        });
});
69
Q

What are the parameters of the open method of the XMLHttpRequest object?

A

method, url, async, username, password

70
Q

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.?

A

method

71
Q

Which parameter of the open method of the XMLHttpRequest object is used to specify the URL to make the request to?

A

url

72
Q

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?

A

async

If true, an event handler needs to be set for the onreadystatechanged

73
Q

Which parameter of the open method of the XMLHttpRequest object is used to specify a user name if the destination requires credentials?

A

username

74
Q

Which parameter of the open method of the XMLHttpRequest object is used to specify a password if the destination requires credentials?

A

password

75
Q

What must be done to make an asynchronous call using the XMLHttpRequest object?

A

Add a handler for the readystatechanged event and pass true for the async parameter of the open method.

76
Q

Which method of the XMLHttpRequest object actually makes the server request?

A

send

The open method does not make server requests. The send method does that.

77
Q

When are the username and password sent during an XMLHttpRequest request?

A

The username and password are only passed to the server in response to a 401 HTTP code from the server.

78
Q

What is the default value for the timeout property of the XMLHttpRequest object?

A

By default, the value for timeout is zero, which is infinite. A timeout value should always be specified.

79
Q

What value must be specified for the timeout property of the XMLHttpRequest object in order to wait indefinitely for the server’s response?

A

Zero which is infinite.

80
Q

Study this simple asynchronous example of using the XMLHttpRequest object.

A
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
Q

What are the possible values for the readyState property of the XMLHttpRequest object?

A
0 - request not initialized
1 - server connection established
2 - request received
3 - processing request
4 - request finished and response is ready
82
Q

What value of the readyState property of the XMLHttpRequest object indicates that the request is finished and the response is ready?

A

4

83
Q

Study this simple example of using the XMLHttpRequest object to send data.

A
var xmlData = "<Person firstName='Rick' lastName='Delorme'
     hairColor='Brown' eyeColor='Brown' /> ";
var xReq = new XMLHttpRequest();
xReq.open("POST", "/ReceiveXMLData.aspx", false);
xReq.send(xmlData);
84
Q

What object and method are used to serialize a JSON object into a string?

A

JSON.stringify

var person = {
     firstName: "Rick",
     hairColor: "Brown"
 };
var jsonString = JSON.stringify(person);
85
Q

What object and method are used to deserialize a string into a JSON object?

A

JSON.parse

var req = new XMLHttpRequest();
req.open("GET", "MyJsonData.json", false);
req.send(null);
var jsonPerson = JSON.parse(req.responseText);
86
Q

How should an XMLHttpRequest object be configure to send data serialized as binary?

A

Set the responseType property to ‘blob’.

var xReq = new XMLHttpRequest();
xReq.open("POST", "saveImage.aspx", false);
xReq.responseType = 'blob';
xReq.send(data);
87
Q

What object and method is used to deserialize binary data received from an XMLHttpRequest object?

A

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
Q

What is the syntax for the simplest form element?

A

<form>

| </form>

89
Q

What is the syntax for submitting a form using jQuery?

A

$(“form”).submit(function () {

});

90
Q

What jQuery method is used to serialize a form into a query string?

A

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
Q

What must be specified for all HTML elements in order for them to be serialized using jQuery.serialize?

A

The name attribute

92
Q

Which HTML elements will not be serialized by the jQuery.serialize method?

A

Elements without the name attribute and elements in an invalid state.