logo

Crowdly

24-25 CS1840/CS2841: Internet Services

Looking for 24-25 CS1840/CS2841: Internet Services test answers and solutions? Browse our comprehensive collection of verified answers for 24-25 CS1840/CS2841: Internet Services at moodle.royalholloway.ac.uk.

Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!

Choose the statement that best describes the purpose of the HTML table element.
0%
0%
100%
0%
View this question
Assuming that the variable element refers to the DOM node representing a paragraph in an HTML document, which of the following options demonstrates correct use of the DOM API to change its background colour to grey?
0%
0%
100%
0%
View this question

Consider the following DTD (Document Type Definition) schema rules.

<!ELEMENT customer (#PCDATA)>

<!ELEMENT item (#PCDATA)>

Along with these, which of the DTD schema rules below correctly defines an XML order element that may contain any number of item elements, but must always contain a customer element?

0%
0%
100%
0%
View this question

Consider the following JavaScript code.

let y = 10;

while (y > 1) {

console.log("Looping...");

y = y - 2;

}

How many times will the text “Looping...” be output to the console when the code is executed?

0%
0%
100%
0%
View this question

What is the effect of executing the following JavaScript code?

let box = document.getElementById("box");

btn.addEventListener("mouseover", function() {

console.log("Mouse is over the box!");

});

100%
0%
0%
0%
View this question
Choose the statement that best describes the purpose of the HTML dl element.
100%
0%
0%
0%
View this question

Consider the following DTD (Document Type Definition) schema.

<!ELEMENT employees (employee+)>

<!ELEMENT employee (name, department, salary)>

<!ELEMENT name (#PCDATA)>

<!ELEMENT department (#PCDATA)>

<!ELEMENT salary (#PCDATA)>

Which of the following XML documents is valid with respect to this schema?

100%
0%
0%
0%
View this question

What is the correct way to specify a DTD (Document Type Definition) for an XML document?

0%
100%
0%
0%
View this question

When you validate the XML against the given DTD schema, you will find that the document is invalid.

This is because the rules for defining some elements and attributes are

missing.

Examine the error messages, and try to identify what information and structure

in the XML document is not specified in the document type definition.

  • To validate the XML document, you will need to add DTD rules to describe

    the following structure.

    • Add a rule specifying the

      name

      element, whose contents

      should be character data.

    • Modify the rule for the

      menuitem

      element, so that its

      contents begins with a

      name

      element.

    • Add a rule specifying the

      item

      element, which should be an

      empty element.

    • Add a rule specifying the

      ingredients

      element; its contents

      should be zero or more occurrences of the

      item

      element.

    • Modify the rule for the

      menu

      element, so that its contents

      requires an

      ingredients

      element, before zero or more

      occurrences of the

      service

      element.

    • Modify the rule specifying the attributes of the

      item

      element, to add the

      id

      attribute; this should be of type

      ID

      , and it is required.

    • Add a rule specifying that the

      service

      element should have

      an attribute called

      name

      ; its value must be one of

      breakfast, lunch, or dinner

      and

      it is a required attribute.

    • Lastly, write a rule specifying the

      ref

      and

      amount attributes of the ingredient

      element.

      The

      ref

      attribute is required, and it should be of type

      IDREF

      : this means that the value of this attribute must

      refer to the value of an

      ID

      type attribute somewhere in the

      XML document.

      The value of the

      amount

      attribute is allowed to be an

      arbitrary string, and it should have a default value of

      1.0

      .

  • Now try to validate the document again using the

    xmllint

    tool.

    You will find that there are two more errors.

    Fix these errors, by making one change in the XML code.

Once you have written all the ncessary DTD schema rules, and the XML validates, enter your final DTD schema in to the box below, or upload it as a separate file.

View this question
Which of the following is a correct DOCTYPE declaration specifying a DTD (Document Type Definition) for an XML document whose root element name is “bibliography”?
0%
100%
0%
0%
View this question

Want instant access to all verified answers on moodle.royalholloway.ac.uk?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!