Upwork E4X Skill Test Questions

Question: 01
Which of the following is not a reserved keyword in E4X and JavaScript?


a.volatile
b.transient
c.super
d.version
e.synchronized


Question: 02
Which of the following methods would give the output corresponding to the code snippet?


var test =
<type name=”Joe”>
<base name=”Bob”></base>
example
</type>;

output:

<type name=”Joe”>
<base name=”Bob”/>
example
</type>

a.alert(test.toString());
b.alert(test.toXMLString());
c.alert(test.text());
d.alert(test.elements());


Question: 03
Which of the following is the correct way to create an XML object in E4X?


a.var languages = new XML(‘<languages type=”dynamic”><lang>JavaScript</lang><lang>Python</lang></languages>’);

b.var languages XML = new XML(‘<languages type=”dynamic”><lang>JavaScript</lang><lang>Python</lang></languages>’);

c.var languages = <languages type=”dynamic”>
<lang>JavaScript</lang>
<lang>Python</lang>
</languages>;

d.All of the above are correct.

e.a and c

f.b and c



Question: 04
Which of the following options would be returned by the code shown in the code snippet:


var f =
<foo>
<a>
text
</a>
<a>
<b/>
</a>
</foo>;
alert(f.a[0].hasComplexContent());// p
alert(f.a[1].hasComplexContent());//q
alert(f.a[0].hasSimpleContent());//r
alert(f.a[1].hasSimpleContent());//s

a.p-false,q-true,r-true,s-false

b.p-true,q-false,r-false,s-true

c.p-1,q-0,r-0,s-1

d.p-0,q-1,r-1,s-0



Question: 05
Which of the following is the correct syntax for calling the Namespace constructor as a function in E4X?


a.Namespace()
b.Namespace(prefixValue)
c.Namespace(uriValue)
d.Namespace(prefixValue,uriValue)


Question: 06
Which of the following options is used to access the attributes in E4X?


a.@
b.::
c.#
d.*


Question: 07
State whether true or false: An arbitrary xml file can be loaded as an E4X ready object.


a.True
b.False


Question: 08
What is the default value of the property prettyIndent in E4X?


a.2
b.0
c.4
d.1


Question: 09
Which of the following are not global methods and properties in E4X?


a.ignoreComments
b.ignoreWhiteSpace
c.setName()
d.setNamespace()
e.a and b
f.c and d


Question: 10
Which of the following is not a valid built-in method for XMLList objects in E4X?


a.attributes()
b.descendants([name])
c.hasOwnProperty(propertyName)
d.append()


Question: 11
Which of the following is not true of the Namespace constructor in E4X?


a.If the value of the prefixValue parameter is undefined, the prefix is set to undefined.
b.If the value is a valid XML name, the prefix property is set to a string.
c.If the value is not a valid XML name, the prefix property is set to undefined.
d.If a QName object is passed, the uri property is set to the value of the QName object’s uri property.


Question: 12
State whether true or false: The QName.prototype.toString() method throws a TypeError exception if its value is not a QName object.


a.True
b.False


Question: 13
Which of the following options can be used for adding direct support for XML to JavaScript?


a.E4X
b.regex
c.Generators and Iterators
d.let


Question: 14
What will be the output of the following code snippet?


element = <xhtml:p xmlns:xhtml=”http://www.example.org”>Kibology
for all.</xhtml:p>;
elementName = element.name();
alert(elementName.localName); //1
alert(elementName.uri); // 2
a.1-p,2-http://www.example.org
b.1-http://www.example.org,2-p
c.1-http://www.example.org,2-http://www.example.org
d.1-p,2-p


Question: 15
Which of the following settings are there in E4x to influence parsing and serialization?


element = <xhtml:p xmlns:xhtml=”http://www.example.org”>Kibology
for all.</xhtml:p>;
elementName = element.name();
alert(elementName.localName); //
alert(elementName.uri); //
a.ignoreComments
b.ignoreProcessingInstructions
c.ignoreWhitespace
d.All of the above


Question: 16
What will be the output of the following code snippet?


var xml = <body></body>;
xml.appendChild(“hello”);
Xml.appendChild(” world”);
xml.normalize();
alert(xml.children().length());

a.1
b.2
c.3

Question: 17
Which of the following characters are treated as white space characters?


a.tab
b.space
c.Line feed
d.enter


Question: 18
Consider the following code snippet. Which of the given options would be used in E4X to change the color of the descendant node chair?


var element = <Home>
<Room>
<Furniture>
<chair color=”Brown”/>
<Furniture>
</Room>
</Home>

a.element.chair.color=”light brown”
b.element.chair.@color=”light brown”
c.element..chair.@color=”light brown”
d.element…chair.@color=”light brown”


Question: 19
What is the value returned when the input parameter type of the XMLList() function in E4x is Number?


a.TypeError exception
b.The value is first converted to a string and then converted to an XMLList object.
c.The value is converted to an XMLList object.
d.The input value is returned unchanged.


Question: 20
Which of the following options can be used to delete a child node of an XML object in E4X?


a.delete xmlobject.child;
b.delete xmlobject.child[0];
c.delete xmlobject.@attribute;
d.All of the above


Question: 21
Consider the code snippet below. Which of the given options represents the correct output of the code attribute substitution for special characters in E4X?


var b = ‘Best of luck “Studentname & Roll no” for your exam’;
var el = <foo a={b}/>;
alert(el.toXMLString());

a.<foo a=”Best of luck “Studentname & Roll no” for your exam”/>
b.<foo a=”Best of luck Studentname & Roll no for your exam”/>
c.<foo a=”Best of luck “Studentname & Roll no” for your exam”/>
d.<foo a=”Best of luck “Studentname & Roll no” for your exam”/>


Question: 22
Which of the following options is the correct alternative to the code snippet so as to get the given output?


Code:
var e= <employee>
<name>Smith</name>
<designation>S/w Engineer</designation>
</employee>
e.prependChild(<prefix>Mr.</prefix>);
alert(e.toString());

Output:
<employee>
<prefix>Mr.</prefix>
<name>Smith</name>
<designation>S/w Engineer</designation>
</employee>

a.e.insertChildAfter(null,<prefix>Mr.</prefix>);
b.e.insertChildBefore(<prefix>Mr.</prefix>);
c.b.e.insertChildAfter(null,<prefix>Mr.</prefix>);
d.b.e.insertChildBefore(null,<prefix>Mr.</prefix>);


Question: 23
Which of the following operators is used for inserting XML objects in the context of their parent in E4X?


a.=
b.+
c.+=
d.=+


Question: 24
Consider the code snippet below. Which of the given options represents the correct sequence of outputs when this code is executed in E4X?


var p1 = <p>Kibology for all.</p>;
alert(p1.name().uri);
default xml namespace = ‘http://www.w3.org/1999/xhtml’;
var p2 = <p>Kibology for all.</p>;
alert(p2.name().uri);
default xml namespace = ”;
var p3 = <p>Kibology for all.</p>;
alert(p3.name().uri);
a.”,http://www.w3.org/1999/xhtml,”
b.”,”,”
c.”,http://www.w3.org/1999/xhtml,http://www.w3.org/1999/xhtml
d.None of the above


Question: 25
Which of the following can be used to create attribute values by placing variables and expressions within them?


a.[]
b.()
c.{}
d.<>


Question: 26
Which of the given options represents the correct length when alert(Emp..*.length()); is applied to the following code?


var Emp = <Emp>
<name>Mark</name>
<likes>
<os>Linux</os>
<browser>Firefox</browser>
<language>JavaScript</language>
<language>Python</language>
</likes>
</Emp>

a.11
b.5
c.7
d.12

 
Question: 27
Which of the following methods is not one of the global methods and properties in E4X?


a.isXMLName()
b.isScopeNamespaces()
c.namespaceDeclarations()
d.removeNamespaces()


Question: 28
What is the correct way to add a method to an XML.prototype in E4X?


a.XML.prototype.function::methodName
b.XML.prototype.function::[methodNameString]
c.XML.prototype.method::[methodNameString]


Question: 29
Which of the following public methods in E4X has the return type XML?


a.localName()
b.nodeKind()
c.parent()
d.valueOf()


Question: 30
What will be the output of the following code snippet?


var customer = <customer>
<phone type=”mobile”>888-555-1212</phone>
<phone type=”office”>888-555-2121</phone>
<preferred>mobile</preferred>
</customer>;
alert(customer.childIndex());

a.0
b.3
c.NaN
d.2

Don't Miss A Single Updates

Remember to check your email account to confirm your subscription.

Blogger
Disqus
Post a comment ➜

No Comment