Skip to content
CS-504 (A) · Internet and Web Technology/Quick Revision Short Notes

Internet and Web Technology (CS-504 (A)) - Unit 4 Short Notes

How unit 4 is examined

XML basics, DTD versus Schema, XSLT, then PHP: control structures, forms (GET/POST), cookies versus sessions and OOP carry the marks.

Introduction to XML

<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Medium weight</span>

Definition. <mark>XML (eXtensible Markup Language) is a W3C markup language for describing, storing and transporting data, in which the author defines his own tags.</mark>

Key points.

  1. XML describes what the data is, while HTML describes how data is displayed.
  2. XML tags are user-defined and extensible; HTML tags are predefined.
  3. XML is case-sensitive and strict: every tag must be closed and properly nested, while HTML tolerates errors.
  4. An XML document has a prolog (<?xml version="1.0"?>), exactly one root element, nested child elements and optional attributes.
  5. XML is platform-independent plain text, so different systems can exchange it.
Basis HTML XML
Purpose Displays data Describes and carries data
Tags Predefined User-defined
Case Not case-sensitive Case-sensitive
Closing tags Optional for some (<br>) Mandatory for all
Errors Browser ignores them Parser stops (must be well-formed)
Root Fixed <html> Any single root
Attribute quotes Optional Mandatory

Answer frame. Open with the definition; draw the comparison table; add one XML snippet showing prolog, root and nesting; close with "XML carries data, HTML presents it".

Asked: [7 marks] (Nov 2019, Jun 2025) Differentiate HTML and XML. What is XML and how does it differ from HTML? Describe the basic structure of an XML document.

Uses of XML

<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Low weight</span>

Definition. <mark>XML is used for platform-independent storage and exchange of structured data.</mark>

Key points.

  1. Extensibility: authors invent tags that fit their data, so one format serves books, orders or feeds.
  2. Readability: it is plain text that humans and programs can both read.
  3. Validation: a DTD or Schema checks the structure before use.
  4. Interoperability: different platforms and languages exchange data through it, as in RSS feeds, SOAP web services and configuration files.
  5. Data is separate from presentation, so XSLT can render one file in many forms.

Asked: [7 marks] (Jun 2025) Discuss the advantages of using XML for data storage and exchange in web applications.

Simple XML

<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Not asked since 2022</span>

Definition. A simple XML document is a well-formed document: prolog, one root element, nested elements.

Key points.

  1. Every start tag has a matching end tag, or is self-closed like <a/>.
  2. Elements nest properly and there is one root.
  3. Attribute values are quoted; names are case-sensitive.
  4. Comments are written <!-- ... -->.
<?xml version="1.0"?>
<student><name>Ravi</name><roll>101</roll></student>

XML keycomponents

<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">High weight</span>

Definition. <mark>An XML document is built from a prolog, elements, attributes, text, comments, entities and a root element; it is well-formed when it obeys the syntax rules.</mark>

Key points.

  1. Prolog: the declaration <?xml version="1.0" encoding="UTF-8"?> states the version and encoding.
  2. Element: a start tag, content and end tag, such as <name>Ravi</name>; elements nest to form a tree.
  3. Root element: exactly one element contains all others.
  4. Attribute: a name="value" pair inside the start tag giving extra information about the element, such as <book id="5">; the value must be quoted and the name unique within the element.
  5. Text (PCDATA) is the character data inside an element; CDATA sections hold text that the parser must not interpret.
  6. Entities: predefined references such as &lt; &gt; &amp; &quot; &apos; stand for reserved characters.
  7. Comments and processing instructions: <!-- --> for notes.
  8. Well-formed rules: one root, proper nesting, closed tags, quoted attributes, case-sensitive names.
  9. Valid: well-formed and also conforming to a DTD or Schema.

Example.

<?xml version="1.0"?>
<library>
  <book id="5"><title>PHP</title></book>
</library>

Answer frame. Open with the XML definition; then list components 1-7 with the example above; state attributes with the id example; close with well-formed versus valid, and mention the HTML difference in one line.

Asked: [7 marks] (Dec 2020) What is XML? What are the attributes of XML? Asked: [14 marks] (Dec 2024) Write a short note: XML Key Components (with OOP in PHP, MySQL and Need for CSS).

DTD andSchemas

<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">High weight</span>

Definition. <mark>A DTD (Document Type Definition) is a grammar that defines the legal elements, attributes and entities of an XML document, so that the document can be validated.</mark>

Key points.

  1. Purpose: a DTD checks the structure of an XML file; a document that obeys it is valid.
  2. Element declaration: <!ELEMENT name (content)>; content can be #PCDATA, EMPTY, ANY or a child list, with + one or more, * zero or more, ? optional, , sequence and | choice.
  3. Attribute declaration: <!ATTLIST book id CDATA #REQUIRED>; types are CDATA, ID, enumerated; defaults are #REQUIRED, #IMPLIED, #FIXED.
  4. Entity declaration: <!ENTITY co "RGPV"> defines a reusable text; used as &co;.
  5. Internal DTD sits inside the XML file in <!DOCTYPE root [ ... ]>.
  6. External DTD is a separate .dtd file, linked by <!DOCTYPE root SYSTEM "file.dtd"> or PUBLIC "id" "url", and can be shared by many documents.
  7. Both together: the DOCTYPE names an external file and also holds an internal subset in [ ]; the internal declarations are read first and override the external ones.
  8. XML Schema (XSD) is the XML-based, richer alternative to a DTD.

Example (internal plus external).

<?xml version="1.0"?>
<!DOCTYPE note SYSTEM "note.dtd" [
  <!ELEMENT note (to,body)>
  <!ATTLIST note id CDATA #REQUIRED>
]>
<note id="1"><to>Ravi</to><body>Hi</body></note>
Basis DTD XML Schema (XSD)
Syntax Own non-XML syntax Written in XML
Data types Only text (PCDATA, CDATA) Rich types: string, integer, date, boolean
Namespaces Not supported Supported
Extensibility Limited, cannot extend types Types can be extended and reused
Occurrence control Only ? * + Exact minOccurs/maxOccurs
Parsing Needs a separate parser Same XML parser and tools

Answer frame. DTD question: define, give purpose, components (element, attribute, entity), internal versus external, then the example; close with "the DTD validates structure". Both-DTDs question: draw the example above and explain the DOCTYPE line. Comparison: table above plus one XSD snippet, <xs:element name="age" type="xs:integer"/>.

Asked: [7 marks] (Nov 2019, Dec 2020, Dec 2024) Explain the term DTD in detail. What is DTD? Why do we use it? What are its applications? Asked: [7 marks] (Jun 2020) Explain the different components of DTD with example. Asked: [7 marks] (Nov 2023) Compare the critical differences between DTD and XML Schema. Asked: [7 marks] (Dec 2024) How can both Internal and External DTDs be used in an XML file? Show with an example. Asked: [7 marks] (Dec 2025) Explain XML components, DTD and XML schemas.

Using XML with applications

<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Not asked since 2022</span>

Definition. An XML parser reads an XML file and gives an application access to its data.

Key points.

  1. DOM parser loads the whole file as a tree in memory, allowing random access and change.
  2. SAX parser is event-based and streams the file, using little memory but only forward reading.
  3. PHP reads XML with simplexml_load_file("a.xml") or the DOM classes.
  4. Applications use XML for config files, feeds and web services.

Transforming XML using XSL and XSLT

<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Medium weight</span>

Definition. <mark>XSL is the stylesheet language for XML, and XSLT (XSL Transformations) converts an XML document into another format such as HTML, using template rules.</mark>

Key points.

  1. XSLT is itself written in XML, and the stylesheet root is <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">.
  2. <xsl:template match="/"> defines a rule applied to the node matched by an XPath expression; / is the root.
  3. <xsl:value-of select="name"/> writes the value of a node.
  4. <xsl:for-each select="students/student"> loops over repeated nodes.
  5. <xsl:if> and <xsl:choose> give conditions, and <xsl:sort> orders output.
  6. The XML file links the stylesheet with <?xml-stylesheet type="text/xsl" href="s.xsl"?>, and the processor produces the output tree.
  7. Its use is to present the same XML data as HTML for browsers.

Example. s.xml: <students><student><name>Ravi</name></student></students>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
  <html><body>
  <xsl:for-each select="students/student">
    <p><xsl:value-of select="name"/></p>
  </xsl:for-each>
  </body></html>
</xsl:template>
</xsl:stylesheet>

Output: <html><body><p>Ravi</p></body></html>

Answer frame. Open by defining XSL and XSLT; show the XML, the stylesheet and the output; explain the template, value-of and for-each lines; close with "XSLT separates data from presentation".

Asked: [7 marks] (Nov 2023, Dec 2025) Briefly explain XSL transformation with an example of script. Explain transformation of XML using XSL/XSLT.

PHP introduction and basic syntax

<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Low weight</span>

Definition. <mark>PHP (Hypertext Preprocessor) is an open-source, server-side scripting language embedded in HTML.</mark>

Key points.

  1. PHP code sits between <?php and ?> and every statement ends with a semicolon; files use .php.
  2. Variables start with $, need no type declaration and are case-sensitive; comments use //, # and /* */.
  3. echo and print output text; operators are arithmetic, comparison, logical, assignment and string (.).
  4. Types are integer, float, string, boolean, array, object and NULL.
  5. The server runs the script and sends only the HTML result to the browser.
<?php $n = "RGPV"; echo "Hello " . $n; // Hello RGPV ?>

Asked: [7 marks] (Dec 2025) Explain PHP syntax, arrays, functions and form processing.

Decision and looping

<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Low weight</span>

Definition. Control structures decide which statements run (decision) or repeat them (loops).

Key points.

  1. Decision: if, if...else, elseif and switch with case, break, default.
  2. Loops: for (known count), while (test first), do...while (runs at least once) and foreach (arrays).
  3. break leaves a loop and continue skips one iteration.
  4. Example below shows if and for.
<?php
$m = 55;
if ($m >= 40) { echo "Pass"; } else { echo "Fail"; }   // Pass
for ($i = 1; $i <= 3; $i++) { echo $i; }               // 123
foreach (["a", "b"] as $v) { echo $v; }                // ab
?>

Asked: [7 marks] (Nov 2022) Explain about the control structures in PHP with illustrations.

PHP and HTML

<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Not asked since 2022</span>

Definition. PHP is embedded in HTML so the page mixes static markup with generated content.

Key points.

  1. Switch between them with <?php ... ?>, and <?= $x ?> is a shortcut for echo.
  2. Output from echo may contain HTML tags.
  3. The server executes the PHP first; the browser never sees the PHP code.
  4. Loops can wrap HTML to build tables.

Arrays

<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Not asked since 2022</span>

Definition. An array stores many values under one variable name.

Key points.

  1. Indexed: $a = array(10, 20); accessed by number, $a[0].
  2. Associative: $p = ["name" => "Ravi"]; accessed by key.
  3. Multidimensional: an array of arrays, $m[1][0].
  4. Useful functions: count(), sort(), array_push(), in_array().

Functions

<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Not asked since 2022</span>

Definition. A function is a named, reusable block of code.

Key points.

  1. User-defined: function add($a, $b) { return $a + $b; } called as add(2, 3).
  2. Built-in functions include strlen(), count() and date().
  3. Arguments may have defaults, function f($x = 5), and can be passed by reference with &.
  4. Variables inside a function are local unless declared global.

Browser control and detection

<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Not asked since 2022</span>

Definition. PHP detects the visitor's browser from the HTTP header and can control it by sending headers.

Key points.

  1. $_SERVER['HTTP_USER_AGENT'] holds the browser and OS name.
  2. get_browser() decodes it into details.
  3. header("Location: page.php"); redirects the browser and must run before any output.
  4. Detection lets the page serve content suited to the browser.

String

<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Not asked since 2022</span>

Definition. A string is a sequence of characters in single or double quotes.

Key points.

  1. Double quotes expand variables, single quotes do not; . joins strings.
  2. Common functions: strlen(), strrev(), strtoupper(), strpos(), substr(), str_replace().
  3. explode() splits a string into an array and implode() joins an array.
  4. trim() removes surrounding spaces.

Form processing

<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Medium weight</span>

Definition. <mark>Form processing is collecting user input from an HTML form and handling it in a PHP script through the $_GET or $_POST superglobals.</mark>

Key points.

  1. The form's method attribute chooses GET or POST and action names the script.
  2. GET appends data to the URL as ?name=Ravi, so it is visible, bookmarkable and limited in length (about 2000 characters).
  3. POST sends data in the request body, so it is hidden and has no practical size limit.
  4. Use GET for searches and POST for passwords and uploads.
  5. isset() and empty() test for missing input, and filter_var($e, FILTER_VALIDATE_EMAIL) checks the email format.
Basis GET POST
Data location URL query string Request body
Visibility Visible Hidden
Length Limited Practically unlimited
Security Weak Better
Bookmark/cache Yes No
PHP array $_GET $_POST

Example (validation script).

<form method="post">
 User <input name="u"> Pass <input name="p" type="password"> Email <input name="e"><input type="submit">
</form>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
  if (empty($_POST["u"]) || empty($_POST["p"]) || empty($_POST["e"])) echo "Fill all fields";
  elseif (!filter_var($_POST["e"], FILTER_VALIDATE_EMAIL)) echo "Invalid email";
  else echo "Welcome " . htmlspecialchars($_POST["u"]);
}
?>

Answer frame. GET/POST question: define form handling, table above, one short form with $_GET and $_POST; close with when to use each. Script question: draw the form, then the empty check, then the email check, then the success message.

Pitfall: Sending a password with GET exposes it in the URL and browser history.

Asked: [7 marks] (Jun 2020) Write a PHP script which takes the user name, password and email values and checks whether the textboxes are filled and whether the email format is correct. Asked: [7 marks] (Nov 2022, Nov 2023) State the differences between GET and POST methods. Explain form handling with the get and post methods in PHP.

Files

<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Not asked since 2022</span>

Definition. PHP reads, writes and uploads files on the server.

Key points.

  1. fopen("a.txt", "r") opens a file; modes are r, w, a; close with fclose().
  2. fread(), fgets() read and fwrite() writes; file_exists() and unlink() check and delete.
  3. Uploads use a form with enctype="multipart/form-data", read from $_FILES and saved with move_uploaded_file().

Advance features: cookies and sessions

<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">High weight</span>

Definition. <mark>A cookie is a small text file stored in the client's browser, and a session stores user data on the server, identified by a session ID; both let stateless HTTP remember a user.</mark>

Key points.

  1. Set a cookie with setcookie(name, value, expire, path) before any output, for example setcookie("user", "Ravi", time()+3600);.
  2. Read it through $_COOKIE["user"]; delete it by setting the expiry in the past.
  3. A cookie lives until its expiry time, so it can persist after the browser closes.
  4. session_start() begins a session and must be the first call on each page; data goes in $_SESSION["user"] = "Ravi";.
  5. The server keeps the data and sends only a session ID (PHPSESSID cookie) to the browser.
  6. session_destroy() ends the session and unset($_SESSION["user"]) removes one value.
  7. Session lifecycle: start, store, read on later pages, destroy at logout or timeout.
  8. Cookies suit preferences and "remember me", sessions suit login and shopping carts.
Basis Cookie Session
Storage Client browser Server
Security Less, user can edit it More, only the ID is at the client
Lifetime Until expiry date Until browser closes or logout
Capacity About 4 KB each Large, server limited
Function setcookie() session_start()
Array $_COOKIE $_SESSION

Example.

<?php
setcookie("user", "Ravi", time() + 3600);
session_start();
$_SESSION["role"] = "admin";
echo $_COOKIE["user"] ?? "new", $_SESSION["role"];
?>

Answer frame. Comparison: open with both definitions, table above, close with an example. Program question: define each, list the functions, then the program above with a second page reading $_SESSION.

Pitfall: setcookie() and session_start() after any HTML output cause a "headers already sent" error.

Asked: [7 marks] (Jun 2020, Nov 2023) Differentiate between Session and Cookie. What is the difference between sessions and cookies in PHP? Asked: [7 marks] (Nov 2022) Write about cookies and sessions in PHP with suitable program. Asked: [7 marks] (Dec 2025) Explain cookies, sessions and OOP concepts in PHP. Asked: [14 marks] (Dec 2024) Explain: i) Cookies and sessions ii) Creating Database iii) Planning and Publishing Websites (the last two belong to Units 5 and 1).

Object oriented programming with PHP

<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Medium weight</span>

Definition. <mark>Object oriented programming organises code into classes and objects that combine data (properties) and behaviour (methods).</mark>

Key points.

  1. Class is the blueprint declared with class; an object is an instance made with new.
  2. Properties and methods are reached with ->, and $this refers to the current object.
  3. The constructor __construct() runs automatically when an object is created.
  4. Encapsulation hides data using public, protected and private visibility.
  5. Inheritance: a child class takes the parent's properties and methods using extends, and adds its own.
  6. Polymorphism: a child overrides a parent method, so the same call behaves differently; interfaces (implements) also give this.
  7. Advantages: reuse, easy maintenance and modular web applications.

<figure class="ds-fig" style="margin:1.4rem 0;overflow-x:auto"><svg xmlns="http://www.w3.org/2000/svg" id="dsfig-u4-01" viewBox="0 0 283 134" width="283" height="134" role="img" aria-label="Inheritance: parent class Animal, child classes Dog and Cat"><style>#dsfig-u4-01 .e{stroke:#454C5A;stroke-width:1.4;fill:none}#dsfig-u4-01 .e.hi{stroke:#2340B8;stroke-width:2.6}#dsfig-u4-01 .n{fill:#FFFFFF;stroke:#16181D;stroke-width:1.4}#dsfig-u4-01 .n.hi{fill:#E3E9FC;stroke:#2340B8;stroke-width:2.2}#dsfig-u4-01 .n.rb-b{fill:#16181D;stroke:#16181D}#dsfig-u4-01 .n.rb-r{fill:#BD3227;stroke:#BD3227}#dsfig-u4-01 text{font-family:"JetBrains Mono",ui-monospace,Menlo,Consolas,monospace;font-size:13px}#dsfig-u4-01 .t{fill:#16181D;font-weight:500}#dsfig-u4-01 .t.inv{fill:#FFFFFF;font-weight:700}#dsfig-u4-01 .kd{stroke:#16181D;stroke-width:1.2}#dsfig-u4-01 .dot{fill:#16181D}#dsfig-u4-01 .ann{fill:#2340B8;font-size:11px;font-weight:700}#dsfig-u4-01 .lbl{fill:#6F7787;font-family:system-ui,-apple-system,sans-serif;font-size:12px;font-weight:700}#dsfig-u4-01 .ptr{fill:#2340B8;font-size:12px;font-weight:700}#dsfig-u4-01 .ah{fill:#454C5A}#dsfig-u4-01 .ah.hi{fill:#2340B8}#dsfig-u4-01 .wl rect{fill:#FFFFFF;stroke:#DCE0E7}#dsfig-u4-01 .wl .t{font-size:12px;font-weight:700}#dsfig-u4-01 .wl.hi rect{fill:#2340B8;stroke:#2340B8}#dsfig-u4-01 .wl.hi .t{fill:#FFFFFF}html.dark #dsfig-u4-01 .e{stroke:#B1B7C3}html.dark #dsfig-u4-01 .e.hi{stroke:#8FA3FF}html.dark #dsfig-u4-01 .n{fill:#161920;stroke:#E6E8ED}html.dark #dsfig-u4-01 .n.hi{fill:#1E2748;stroke:#8FA3FF}html.dark #dsfig-u4-01 .n.rb-b{fill:#E6E8ED;stroke:#E6E8ED}html.dark #dsfig-u4-01 .n.rb-r{fill:#FF7E71;stroke:#FF7E71}html.dark #dsfig-u4-01 .t{fill:#E6E8ED}html.dark #dsfig-u4-01 .t.inv{fill:#0F1115}html.dark #dsfig-u4-01 .kd{stroke:#E6E8ED}html.dark #dsfig-u4-01 .dot{fill:#E6E8ED}html.dark #dsfig-u4-01 .ann{fill:#8FA3FF}html.dark #dsfig-u4-01 .lbl{fill:#858D9C}html.dark #dsfig-u4-01 .ptr{fill:#8FA3FF}html.dark #dsfig-u4-01 .ah{fill:#B1B7C3}html.dark #dsfig-u4-01 .ah.hi{fill:#8FA3FF}html.dark #dsfig-u4-01 .wl rect{fill:#161920;stroke:#2A2E37}html.dark #dsfig-u4-01 .wl.hi rect{fill:#8FA3FF;stroke:#8FA3FF}html.dark #dsfig-u4-01 .wl.hi .t{fill:#0F1115}</style><defs><marker id="ah7" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path class="ah" d="M0,1 L9,5 L0,9 z"/></marker><marker id="ahh7" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path class="ah hi" d="M0,1 L9,5 L0,9 z"/></marker></defs><line class="e" x1="129.5" y1="39" x2="52.5" y2="103"/><line class="e" x1="129.5" y1="39" x2="206.5" y2="103"/><rect class="n" x="96" y="24" width="67" height="30" rx="8"/><text class="t" x="129.5" y="39" dy=".35em" text-anchor="middle">Animal</text><circle class="n" cx="52.5" cy="103" r="17"/><text class="t" x="52.5" y="103" dy=".35em" text-anchor="middle">Dog</text><circle class="n" cx="206.5" cy="103" r="17"/><text class="t" x="206.5" y="103" dy=".35em" text-anchor="middle">Cat</text></svg><figcaption style="font-size:.82em;opacity:.72;margin-top:.45rem">Inheritance: parent class Animal, child classes Dog and Cat</figcaption></figure>

Example.

<?php
class Animal { function speak() { return "..."; } }
class Dog extends Animal { function speak() { return "Bark"; } }
$d = new Dog();
echo $d->speak();   // Bark
?>

Answer frame. OOP question: define class, object, then points 4-6 with the example; close with advantages. Inheritance question: define inheritance, draw the tree, show extends, state types (single, multilevel, hierarchical), close with reuse.

Asked: [7 marks] (Jun 2020, Jun 2025) Explain the concept of object oriented programming with PHP, including encapsulation, inheritance and polymorphism. Asked: [7 marks] (Nov 2019) Explain about inheritance with suitable diagram.

Last-minute revision

  • XML is case-sensitive, has one root, and every tag must close.
  • HTML displays data; XML describes data; XML tags are user-defined.
  • DTD: <!ELEMENT>, <!ATTLIST>, <!ENTITY>; internal uses [ ], external uses SYSTEM "x.dtd".
  • XSD is written in XML and has data types and namespaces; DTD has neither.
  • XSLT elements: template, value-of, for-each, if, choose, sort.
  • PHP tags are <?php ... ?>, variables start with $, statements end with ;.
  • GET is in the URL and limited; POST is in the body and safer.
  • Cookie on client with setcookie(), session on server with session_start().
  • Cookie is about 4 KB; call both before any output.
  • OOP: class, new, extends, __construct, visibility public/protected/private.

Memory hooks

  • DTD grammar: E-A-E, Element, Attlist, Entity.
  • GET = Glass window (visible), POST = Post box (hidden).
  • Cookie crumbs stay with the client; the session ticket is held by the server.
  • Inheritance: child extends parent.

Coverage checklist

  • Introduction to XML: HTML vs XML (Nov 2019, Jun 2025).
  • uses of XML: advantages of XML (Jun 2025).
  • simple XML: well-formed structure.
  • XML keycomponents: what is XML, attributes (Dec 2020); short note (Dec 2024).
  • DTD andSchemas: DTD, components, DTD vs Schema, internal and external, XML components (Nov 2019 to Dec 2025).
  • Using XML with application: DOM and SAX parsers.
  • Transforming XML using XSL and XSLT: XSLT example (Nov 2023, Dec 2025).
  • PHP: Introduction and basic syntax of PHP: PHP syntax (Dec 2025).
  • decision and looping with examples: control structures (Nov 2022).
  • PHP and HTML: embedding.
  • Arrays: indexed, associative, multidimensional.
  • Functions: user-defined and built-in.
  • Browser control and detection: user agent, header.
  • string: string functions.
  • Form processing: GET vs POST, validation script (Jun 2020, Nov 2022, Nov 2023).
  • Files: fopen, uploads.
  • Advance Features: Cookies and Sessions: comparison, program, short note (Jun 2020 to Dec 2025).
  • Object Oriented Programming with PHP: OOP, inheritance (Nov 2019, Jun 2020, Jun 2025).
Go to where you left off?

Quick Add to Notes

Save questions, your own notes and screenshots into notes filed by unit. It takes a free account.

Create free account

Have an account? Log in