Jump to content

Help with OOP final tests


slevin741

Recommended Posts

Hello to all,I finished a web developing course and had about 16 tests to take.

i have passed them all and have about 5 left that I cannot answer and score only about 30%.The questions seem ambiguous and the answers even more confusing.

The tests are on some paste website you just have to press ctrl-d to edit and ctrl-s to save.If someone could help I'd appreciate it maybe even give a reward.

http://hastebin.com/evupilaxum.coffee

http://hastebin.com/fobojebuyo.coffee

http://hastebin.com/ubegejanuw.lua

http://hastebin.com/ibinokenem.coffee

Edited by slevin741
Link to comment
Share on other sites

That took a long time. Here's the first one, I need to go to bed.

XML

1. In SimpleXML, what are the four basic rules for how an XML document is accessed? (Four answers.)
 a. Properties are [elements, or more precisely,] element iterators
 b. Numeric indexes are elements
 c. Non-numeric indexes are element attributes
 d. Converting an element to a string gets its text data
 e. Element namespaces are denoted by the ‘namespace’ attribute

2. SimpleXML objects can be created *directly* from what types of data sources? (Three answers. Yes, three.)
 a. A database resource
 b. A URI
 c. A DOMDocument object
 d. An array
 e. A string

3. What is the primary benefit of an XML reader based on SimpleXML compared to one based on the DOM classes? (Not a very good question.)
 a. All of the specified options
 b. Easier to develop a reader
 c. Requires less memory than DOM
 e. Faster than DOM methods

4. Event-based XML parsing is an example of which parsing model? (I have no idea what this is asking about.)
 a. XQuery
 b. XPath
 c. XML object naming
 d. DOM
 e. SAX

5. PHP 5 supports which of the following XML parsing/reading methods out-of-the-box? (Two or three answers, depending how you consider it.)
 a. XPath
 b. DOM
 c. FastDOM
 d. SimpleXMLElement

6. Which of the following will display the HREF attribute? (One answer.)

$sxml = simplexml_load_string('<html><body><h1>please go <a href = "http://yahoo.com"> http://yahoo.com</a></h1></body></html>');

 a. echo $sxml->body->h1->a['href'];
 b. echo $sxml->body->h1->a<href>;
 c. echo $sxml->h1->a->href;
 d. echo $sxml->body->h1->a->href;

7. What XML technology can be used to combine two XML documents in one? (One answer.)
 a. Namespaces
 b. Transformations
 c. DTD
 d. Validators

8. Replace the ???? to print "hello world" - with no leading/trailing whitespace or markup. (Probably one answer - I would have to check myself.)

$xmldata = '
 <?xml version="1.0" encoding="utf-8"?>
 <html>
  <body>
   <p>
    <b>hello world</b>
   </p>
  </body>
 </html>
';
$sxe = simplexml_load_string($xmldata);
$p = $sxe->body->p;
$string = // ???????
print $string;

 a. strip_tags(($p->asXML()))
 b. trim(($p->asXML()))
 c. trim(strip_tags(($p->asXML())))
 d. trim(strip_tags(($p->asText())))
 e. trim(($p[1]))

9. Creating new nodes in XML documents using PHP can be done using...? (Two answers.)
 a. DOM
 b. SimpleXML
 c. XPath
 d. XQuery
Edited by requinix
1/howtf does one post plain text? 2/found a way
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.