DWAF Revision Question
DWAF Revision Question
REVISION QUESTION
Section 1: PHP
1. PHP Tags: All PHP code must be enclosed within which special tags? List at least two
variations.
2. Variable Declaration: Explain how to declare a variable in PHP and assign it the string
value "Hello World". .
4. String Concatenation: How do you concatenate two strings together in PHP? Provide
an example.
6. Include vs. Require: What is the difference between include and require in PHP?
Explain how they handle file inclusion errors.
7. Function Definition: How do you define a function in PHP? Give an example of a simple
function that adds two numbers and returns the result.
Section 2: HTML
1. Table Elements: Explain the roles of the <table>, <tr>, <th>, and <td> tags in
creating tables in HTML. Provide a simple example demonstrating their use.
2. Input Types: In HTML forms, various input element types exist. Name at least three
different input types and describe their purpose.
3. Anchor Tag: Describe the function of the <a> tag and its essential attribute (href).
Provide an example of how to create a link to an external website.
4. HTML Comments: Explain the purpose of using comments in HTML code and
demonstrate how to write a single-line and a multi-line comment.
5. Special Characters: If you want to include special characters like the copyright
symbol (©) or the less than sign (<) in your HTML, how would you do it? Provide at
least two methods.
6. Basic HTML Structure: Provide the basic structure of an HTML5 document, including
the doctype declaration, <html>, <head>, and <body> tags.
7. Meta Tag: What is the purpose of the <meta> tag in HTML? Give two examples of
how it's used, including setting the character set and providing a description for
search engines. .
8. Div vs. Span: Explain the difference between a <div> and a <span> in HTML in terms
of their usage and how they affect the layout of a web page..
Section 3: CSS
1. Embedding CSS: Describe two ways to embed CSS styles into an HTML document:
using internal stylesheets and using external stylesheets.
2. Padding vs. Margin: Explain the difference between padding and margin in CSS. Use
diagrams to illustrate your answer
3. CSS Box Model: Explain the concept of the CSS Box Model, including its components
(content, padding, border, margin) and how they affect the size and layout of an
element.
4. Button Styling: Write the CSS to style a button with the following properties: blue
background color, white text color, 10px padding, rounded corners (using border-
radius), and a hover effect that changes the background color to a darker blue.
Centering a Div: Write the CSS to center both horizontally and vertically
a <div> element with a fixed width of 300px and a height of 200px on the page.
5. Display Inline vs. Block: What is the difference between display: inline and display:
block in CSS? Explain how each affects the layout of an element and provide examples
of when you would use each.
6. Responsive Design: How do you use CSS to create a responsive design that adapts to
different screen sizes? Explain the concept of media queries and provide a simple
example.
Section 4: JavaScript
3. Variable Declarations: Explain the difference between var, let, and const when
declaring variables in JavaScript in terms of scope and mutability.
4. Array Access: How can you access the third element in an array named colors in
JavaScript? Provide the code snippet.
6. JavaScript Functions: What is a JavaScript function? Explain its purpose and provide
a simple example of a function that takes two numbers as arguments and returns their
sum.
7. Event Handling: How do you handle events in JavaScript? Give an example of an event
handler that displays an alert message when a button is clicked (using either an inline
event handler or addEventListener).
1. <table>
</table>
5. HTML Navigation Bar: Create a basic HTML navigation bar with four links: Home,
About, Services, and Contact. Use an unordered list (<ul>) to structure the navigation
items, and ensure that each link points to a different page (even if those pages don't
exist, use placeholder URLs like #home, #about, etc.).
(b) Write the JavaScript code to display an alert box with the message "Button
Clicked!" when a button with the ID "myButton" is clicked. You can use either inline
event handlers or the addEventListener method.
7. Simple Form: Create a simple HTML form that asks the user for their first name and
email address. Use appropriate labels (<label>) and input fields (<input>) with the
correct type attributes. Give the form an appropriate title using a heading element.
8. Image with Caption: Write the HTML to display an image with a caption below it. Use
the <figure>, <img>, and <figcaption> elements to structure the image and caption
semantically. Provide placeholder values for the src and alt attributes of the image.