Elance JSON Test Answers 2015
·
JSON name/value pair is written as
name' : 'value'
name = 'value'
name = "value"
"name" : "value"
JSON strings have to be in
single quote
double quote
single quote or double quote
Which of the following code will return a
valid JSON object?
JSON.parse('({"FirstName":
"John", "LastName":"Doe"})');
JSON.parse("{'FirstName': 'John',
'LastName':'Doe'}");
JSON.parse("({'FirstName': 'John',
'LastName':'Doe'})");
JSON.parse('{"FirstName":
"John", "LastName":"Doe"}');
Which of these is proper a JSON array?
{ "letters" : [ "a",
"b", "c"; ] }
{ 'letters' : {"a", "b",
"c" } }
{ "letters" : [ a, b, c ] }
{ "letters" : [ "a",
"b", "c" ] }
In the below notation, Employee is of type {
"Employee": [ "Amy", "Bob", "John" ] }
Not a valid JSON string
Array
Class
Object
Which of the following is not a JSON type?
Object
date
Array
string
Which of these is correct about the JSON
standard?
It is an open standard
It is privately developed
It requires a license to use
What is the file extension of JSON?
.jn
.js
.jsn
.json
In modern websites what is the common usage
for JSON?
To store information remotely.
To send and receive bits of data.
To store information locally.
In the below notation, Employee is of type {
"Employee": { "Name": "Amy", "Age": 25
} }
Object
Array
Class
Not a valid JSON string
Which answer represents the following order of
TYPES? Object, String, Boolean, Number
"{ }", "a string",
"false", "0"
[ ], 0, "true", "0"
{ }, "0", false, 0
{ }, hello, "false", "0"
In this example, what is the TYPE of employee?
{ "employee" : { "type" : "Director",
"functions" : ['sales', 'marketing'] } }
String
Director
type
Object
Given this JSON example: {
"Employee": { "Name": "Amy", "Age": 25
} }; What is the type of Employee.Age ?
Number
Object
Array
String
Which of these is a benefit JSON has over XML?
JSON is more forgiving of poor formatting
JSON has less markup requirements and therefore is
lighter than XML
JSON can be written poorly and still be parsed
JSON does not need to be stored in a file to be
sent remotely
Which statement about the replacer parameter
in JSON.stringify() is true?
If null or omitted, all properties of the object
are included in the resulting JSON string
If a function, transforms values and properties
encountered while stringifying
All three statements are true
If an array, specifies the names of the properties
in the object to include in the resulting JSON string
What does JSON stand for?
JavaScript Object Nomenclature
JavaScript Objective Notation
JavaScript Object Notation
JavaScript Orientated Nomenclature
JSON elements are separated by
semi-colon
line break
comma
white space
What keywords are reserved in JSON and cannot
be used as keys?
Value
Object
There are none.
Key
What kind of format is JSON, and what does the
acronym mean?
A lightweight data-encoding framework. Java
Omnipresent Notation.
A lightweight data-interchange format. JavaScript
Object Notation.
A lightweight data-interchange format. Java
Objective Notion.
A lightweight database framework. JavaScript Object
Notation.
Can you use a double quote inside a JSON
string?
Yes, if you use the ascii code.
Yes, you can use it without any special treatment
Yes, if it is escaped like ( \" )
No, you should use single quotes
In this example, what is the TYPE of
employee.functions? { "employee" : { "type" :
"Director", "functions" : ['sales', 'marketing'] } }
String
Object
Array
Sales, Marketing
Which statement about the reviver parameter in
JSON.parse() is true?
All three statements are true
Used to reform generic objects into instances of
pseudo-classes
A function that will be called for every key and
value at every level of the final result
Each value will be replaced by the result of the
reviver function
Which of the following is a valid JSON string?
{ "meals" : { "breakfast" ,
"lunch" , "dinner" } }
{ "meals" : [ "breakfast" ,
"lunch" , "dinner" ] }
[ "meals" : { "breakfast" ,
"lunch" , "dinner" } ]
[ {"meals" : { "breakfast" ,
"lunch" , "dinner" } } ]
Which of the following code will throw an
error?
JSON.parse(null);
JSON.parse('{}');
JSON.parse(undefined);
JSON.parse('[]');
Which statement about the toJSON method is
true?
It customizes JSON stringification behavior
It allows an object to determine its own JSON
representation
All three statements are true
It is internally called by JSON.stringify()
Which of these data interchange formats has
seen a decline in usage in favor of JSON?
ASCII
Plain-text
SQL
XML
True or false? A disadvantage of JSON is that
it requires the use of JavaScript.
False, JSON is language independent.
False, JavaScript must be available although it is
not necessary to use.
True, though all browsers have JavaScript enabled.
True, though JavaScript is readily available in
today's browsers.
Which is true about JSON namespacing?
JSON namespaces can be accessed immediately after
receiving data.
JSON namespaces can be accessed after parsing data.
JSON doesn't have namespaces. Though every object
is inherently a namespace.
What function will convert a JavaScript object
to a JSON string?
JSON.text()
JSON.serialize()
JSON.toString()
JSON.stringify()
In this example, what would the VALUE of
employee.functions[1] be? { "employee" : { "type" :
"Director", "functions" : ['sales', 'marketing'] } }
null
undefined
marketing
sales
What is the MIME type of JSON?
application/x-json
text/json
application/json
application/javascript
In this example, what is the VALUE of
employee.type? { "employee" : { "type" :
"Director", "functions" : ['sales', 'marketing'] } }
String
Object
Director
In this example, what would the TYPE of
employee.hireDate be? { "employee" : { "type" :
"Director", "functions" : ['sales', 'marketing'],
"hireDate" : "March 8, 2011" } }
March 8, 2011
String
Date
Number
What is JSONP meant to mitigate?
Size constraints of JSON
Cross-domain communication
Future proofing JSON as JavaScript changes.
True or false? The order of elements in JSON
arrays is always preserved.
False
True
Which of these is supported as a JSON Value
type?
Infiniti
Null
Undefined
NaN
When coding a string object in JSON, what must
separate the string and the value?
A space
A semicolon
A comma
A colon
Does JSON support Unicode characters?
No, JSON has no support for any kind of character
encoding.
No, JSON only has support for UTF-8 characters.
Yes, JSON has support for Unicode characters.
Allowing for almost any information in any human language
Yes, only when stored as the key in a ( key : value
) pair.
What is the value of obj in the following
code? var obj = JSON.parse('{"fruit": "Apple"}',
function(k, v) { if (v == "Apple") return "Orange" else
return v; });
{ "fruit" : "Apple"}
{ "fruit" : "Orange"}
{"Orange"}
{"Apple"}
Does whitespace matter in JSON?
No, it will be stripped out.
Yes, only within strings.
Yes, only outside of strings.
Yes, both inside and outside of strings
What is the value of json in the following
code? var cars = []; cars[0] = 'Ford'; cars[1] = 'Toyota'; cars[2] = 'BMW'; var
json = JSON.stringify({x: cars});
{"x":['Ford','Toyota','BMW']}
{"x":{"Ford","Toyota","BMW"}}
{"x":["Ford","Toyota","BMW"]}
{"cars":["Ford","Toyota","BMW"]}
What is the value of json in the following
code? var obj = { fruit: 'apple', toJSON: function () { return 'orange'; } };
var json = JSON.stringify({x: obj});
{"x":"orange"}
{"fruit":"apple"}
{"x":"apple"}
{"fruit":"orange"}
What types of values can you have in JSON
key:value pairs?
Strings, Arrays, and Primitives
Arrays, Primitives, and Objects stored as strings
Strings, Arrays, Primitives and Objects
Strings only
In what situation would you want to use XML
over JSON?
When JSON is not offered.
When you need to use tags to structure your
content.
You need message validation or you're using XSLT.
Never, JSON is worlds better.
What is a JSONStringer used for?
It is used to quickly create JSON text.
It quickly converts JSON to Java strings.
It is used to create number strings in JSON.
It is used to create JSON ordered pairs.
Which of the following control characters
cannot be used when writing a JSON string without escaping?
; or :
“ or \
< or >
/ or {
What is the value of json in the following
code? var days = {}; days['Monday'] = true; days['Wednesday'] = true;
days['Sunday'] = false; var json = JSON.stringify({x: days});
{"day":{"Monday":"true","Wednesday":"true","Sunday":"false"}}
{"x":{"Monday":true,"Wednesday":true,"Sunday":false}}
{"day":{"Monday":true,"Wednesday":true,"Sunday":false}}
{"x":["Monday":true,"Wednesday":true,"Sunday":false]}
How does JSON being "lightweight"
translate into a benefit for the site visitors?
Faster transfer times over the internet
Parsing JSON is noticeably faster than parsing XML
Web apps have a smaller footprint
What error does JSON.parse() throw when the
string to parse is not valid JSON?
ReferenceError
EvalError
SyntaxError
TypeError
What two structures is JSON built on?
A collection of name/value pairs, and an ordered
list of values, or array.
A collection of object/item pairs, and an ordered list
of pairs, or array.
A collection of name/value objects, and an ordered
list of objects, or array.
A collection of native-value pairs, and an ordered
list of arrays, or values.
Which of the following is not a valid way to
parse JSON string?
JSON.eval()
JSON.parse()
jQuery.parseJSON()
eval()
What does JSONP stand for?
JSON Procedures
JSON Parsing
JSON with padding
JSON Programming
Which of the following code will not throw an
error?
JSON.parse('');
JSON.parse(null);
JSON.parse();
JSON.parse({});
How does JSON handle numeric values that
cannot be represented by a sequence of digits (like Infiniti and Nan)?
They are stored as strings and then converted when
parsed.
They are not permitted.
They are stored fine but it's the parsers job to
convert them to numeric values.
Which of the following number formats are not
used in JSON?
Octal and gate
Octal and binary
Binary and hexadecimal
Octal and hexadecimal
What is used by the JSONObject and JSONArray
constructors to parse JSON source strings?
JSONTokener
JSONParser
JParser
ParserJ
Which statement about the space parameter in
JSON.stringify() is false?
It controls spacing in the resulting JSON string
All three statements are false
It removes whitespace
It is an optional parameter
True of False? The external form of a JSON
object always begins and ends with {}
True
False
True of False. The order of JSON objects is
always preserved.
False
True
Subscribe to:
Posts (Atom)