Final Exam Review PDF

Download as pdf or txt
Download as pdf or txt
You are on page 1of 19

Second Question:

A- chose the correct answer :

HTML

1. What does HTML stand for?

Hyper Text Markup Language


Home Tool Markup Language
Hyperlinks and Text Markup Language

2. Who is making the Web standards?

Mozilla
Google
Microsoft
The World Wide Web Consortium

3. Choose the correct HTML element for the largest heading:

<h1>
<heading>
<head>
<h6>

4. What is the correct HTML element for inserting a line break?

<lb>
<break>
<br>

5. What is the correct HTML for adding a background color?

<body bg="yellow">
<background>yellow</background>
<body style="background-color:yellow;">
6. Choose the correct HTML element to define important text

<strong>
<b>
<important>
<i>

7. Choose the correct HTML element to define emphasized text

<i>
<italic>
<em>

8. What is the correct HTML for creating a hyperlink?

<a url="http://www.w3schools.com">W3Schools.com</a>
<a href="http://www.w3schools.com">W3Schools</a>
<a>http://www.w3schools.com</a>
<a name="http://www.w3schools.com">W3Schools.com</a>

9. Which character is used to indicate an end tag?

^
*
<
/

10. How can you open a link in a new tab/browser window?

<a href="url" new>


<a href="url" target="_blank">
<a href="url" target="new">
11. Which of these elements are all <table> elements?

<table><head><tfoot>
<table><tr><td>
<table><tr><tt>
<thead><body><tr>

12. Inline elements are normally displayed without starting a new line.

True
False

13. How can you make a numbered list?

<ul>
<dl>
<ol>
<list>

14. How can you make a bulleted list?

<ol>
<list>
<dl>
<ul>

15. What is the correct HTML for making a checkbox?

<input type="check">
<check>
<checkbox>
<input type="checkbox">
16. What is the correct HTML for making a text input field?

<textfield>
<input type="text">
<input type="textfield">
<textinput type="text">

17. What is the correct HTML for making a drop-down list?

<input type="list">
<list>
<select>
<input type="dropdown">

18. What is the correct HTML for making a text area?

<input type="textbox">
<input type="textarea">
<textarea>

19. What is the correct HTML for inserting an image?

<img href="image.gif" alt="MyImage">


<img alt="MyImage">image.gif</img>
<img src="image.gif" alt="MyImage">
<image src="image.gif" alt="MyImage">

20. What is the correct HTML for inserting a background image?

<body style="background-image:url(background.gif)">
<body bg="background.gif">
<background img="background.gif">

21. An <iframe> is used to display a web page within a web page.

True
False
There is no such thing as an <iframe>
22. HTML comments start with <!-- and end with -->

True
False

23. Block elements are normally displayed without starting a new line.

True
False

24. Which HTML element defines the title of a document?

<meta>
<head>
<title>

25. Which HTML attribute specifies an alternate text for an image, if the image
cannot be displayed?

src
alt
title
longdesc

26. HTML source file content begins with which tag?

a) <title>
b) <body>
c) <src>
d) <html>

27. Styles specified as attributes in a tag are referred to as ____ styles.

a) linked
b) outlined
c) inline
d) ordered
28. Which tag begins a new paragraph?

a) <br />
b) <para>
c) <p>
d) <sp>

29. The margin style requires 4 numbers which correspond in order to:

a) top bottom left right


b) left top bottom right
c) top left right bottom
d) top right bottom left

30. To create a table cell that spans two rows and three columns at the same time,
youenter the <td> tag as ____.

a) <td rows=“2” cols=“3”>


b) <td span=“2,3”>
c) <td span=“3,2”>
d) <td rowspan=“2” colspan=“3”>

31. ____ creates a generic block level element.

a) <section>
b) <span>
c) <div>
d) <class>

32. XHTML is a version of HTML written in which language?

a) SGML
b) HTML
c) W3C
d) XML
CSS
1. What does CSS stand for?

Colorful Style Sheets


Computer Style Sheets
Creative Style Sheets
Cascading Style Sheets

2. What is the correct HTML for referring to an external style sheet?

<link rel="stylesheet" type="text/css" href="mystyle.css">


<style src="mystyle.css">
<stylesheet>mystyle.css</stylesheet>

3. Where in an HTML document is the correct place to refer to an external style


sheet?

In the <body> section


At the end of the document
In the <head> section

4. Which HTML tag is used to define an internal style sheet?

<script>
<css>
<style>

5. Which HTML attribute is used to define inline styles?

styles
style
font
class
6. Which is the correct CSS syntax?

body:color=black;
body {color: black;}
{body:color=black;}
{body;color:black;}

7. How do you insert a comment in a CSS file?

' this is a comment


/* this is a comment */
// this is a comment
// this is a comment //

8. Which property is used to change the background color?

color
bgcolor
background-color

9. How do you add a background color for all <h1> elements?

all.h1 {background-color:#FFFFFF;}
h1.all {background-color:#FFFFFF;}
h1 {background-color:#FFFFFF;}

10. Which CSS property is used to change the text color of an element?

fgcolor
color
text-color
11. Which CSS property controls the text size?

text-style
font-style
font-size
text-size

12. What is the correct CSS syntax for making all the <p> elements bold?

p {text-size:bold;}
p {font-weight:bold;}
<p style="text-size:bold;">
<p style="font-size:bold;">

13. How do you display hyperlinks without an underline?

a {decoration:no-underline;}
a {underline:none;}
a {text-decoration:no-underline;}
a {text-decoration:none;}

14. How do you make each word in a text start with a capital letter?

text-transform:capitalize
You can't do that with CSS
text-transform:uppercase

15. Which property is used to change the font of an element?

Both font-family and font can be used


font
font-family

16. How do you make the text bold?

font-weight:bold;
font:bold;
style:bold;
17. How do you display a border like this:
The top border = 10 pixels
The bottom border = 5 pixels
The left border = 20 pixels
The right border = 1pixel?

border-width:10px 20px 5px 1px;


border-width:10px 5px 20px 1px;
border-width:5px 20px 10px 1px;
border-width:10px 1px 5px 20px;

18. Which property is used to change the left margin of an element?

padding-left
margin-left
indent

19. When using the padding property; are you allowed to use negative values?

No
Yes

20. How do you make a list that lists its items with squares?

list: square;
list-style-type: square;
list-type: square;

21. How do you select an element with id "demo"?

demo
*demo
#demo
.demo
22. How do you select elements with class name "test"?

#test
test
*test
.test

23. How do you select all p elements inside a div element?

div.p
div p
div + p

24. How do you group selectors?

Separate each selector with a space


Separate each selector with a plus sign
Separate each selector with a comma

25. What is the default value of the position property?

relative
absolute
static
fixed
JavaScript
1. Inside which HTML element do we put the JavaScript?

<javascript>
<js>
<script>
<scripting>

2. What is the correct JavaScript syntax to change the content of the HTML element
below?

<p id="demo">This is a demonstration.</p>

document.getElementById("demo").innerHTML = "Hello World!";


document.getElement("p").innerHTML = "Hello World!";
#demo.innerHTML = "Hello World!";
document.getElementByName("p").innerHTML = "Hello World!";

3. Where is the correct place to insert a JavaScript?

Both the <head> section and the <body> section are correct
The <body> section
The <head> section

4. What is the correct syntax for referring to an external script called "xxx.js"?

<script name="xxx.js">
<script href="xxx.js">
<script src="xxx.js">

6. How do you write "Hello World" in an alert box?

msgBox("Hello World");
alert("Hello World");
msg("Hello World");
alertBox("Hello World");
7. How do you create a function in JavaScript?

function = myFunction()
function:myFunction()
function myFunction()

8. How do you call a function named "myFunction"?

call myFunction()
call function myFunction()
myFunction()

9. How can you add a comment in a JavaScript?

'This is a comment
<!--This is a comment-->
//This is a comment

10. How to insert a comment that has more than one line?

//This comment has


more than one line//
/*This comment has
more than one line*/
<!--This comment has
more than one line-->

11. How do you declare a JavaScript variable?

v carName;
var carName;
variable carName;

12. Which operator is used to assign a value to a variable?

=
-
*
x
First Question: Short answer
1- Write code to create an ordered list with 2 items.

<ol>

<li> apples</li>

<li> bananas</li>

</ol>

2- Write code to create an unordered list with 2 items.

<ul>

<li> apples</li>

<li> bananas</li>

</ul>

3- Provide the inline style attribute value for:

text colour is red.

Style = " color : red "

4- Explain the difference between browser and web server.

○ A browser: is a program that can retrieve files from the World Wide Web
and render text, images, or sounds encoded in the files.

i.e. IE, Google, Firefox

○ A web server: is an application which waits for client requests, fetches


requested documents from disk and transmits them the client.

i.e. Apache

5- Explain Styles and how to apply style in HTML documents?

○ A style: is a set of formatting instructions that can be applied to a piece of


text.

○ Inline style

○ Embedded style

○ External style
6- Describe the following with an example:

A- Elements:

Elements are written with a start tag, with an end tag, with the content in
between:

<tagname>content</tagname>

Example:

<p>.......</p>

B- Attributes:

Attributes provide additional information about an element

Example:

<img src="w3schools.jpg" >

7. What is W3C ?

The World Wide Web Consortium (W3C) is an international community that develops
open standards to ensure the long-term growth of the Web.

8.The Box model describes the structure of page elements as they are laid out on the web page. List three
components of the box model.
1. Padding
2. Margins
3. Border
9. Name three attributes of the <link> tag.

rel rev href type

10. Specify the code to mark the main heading on your Web page.

<h1>content</h1>

11. Specify the code you would use to display the seasons of the year (Winter, Spring,
Summer, and Fall) as an unordered list.

<ul>
<li>Winter</li>
<li>Spring</li>
<li>Summer</li>
<li>Fall</li>
</ul>
12. What code would you enter to display the following text as a paragraph in your Web page? Include
both the block-level and inline element tags.

Hamlet, a play by William Shakespeare.

<p><i>Hamlet</i>, a play by William Shakespeare</p>

13. Specify the code you would enter to display the text “Product List” as an h2 heading,
centered horizontally on the page.

<h2 style="text-align: center">Product List</h2>

14. Specify the code you would enter to mark the text “Hamlet by William Shakespeare”
as a centered h1 heading with a line break after the word “Hamlet.”

<h1 style="text-align: center">Hamlet<br /> by William


Shakespeare</h1>

15. You want to add the graphic file portrait.gif to your Web page as an inline image.
For nonvisual browsers, your page should display the text “David Vinet” in place of
the image. Specify the code to do this.

<img src="portrait.gif" alt="David Vinet" />

16. Specify the code you would enter to display the text “<h2>Hamlet</h2>“ on your Web page.
&lt;h2&gt;Hamlet&lt;/h2&gt;

17.Specify the code for marking the text “CAMshots FAQ” as an h2 heading with the id “faq.”

<h2 id=“faq”>CAMshots FAQ</h2>

18. Specify the code to enter the following comment into a CSS file:

Sunny Acres Style Sheet

/* Sunny Acres Style Sheet */

19. Specify the code to set the text color of every paragraph element within the Web page to red.

p {color: red}

20. Specify the style declaration to display all h3 headings with both an overline and an underline.

h3 {text-decoration: overline underline}

21. What attributes do you add to the <img /> tag to set the size of the image to 200
pixels wide by 100 pixels high?

width = “200” height = “100”


22. An inline image has the id photoImage. Specify the style declaration you would
enter to float this inline image on the left margin.

#photoImage {float: left}

23. Specify the style declaration to set the right and bottom margins of the photoImage
inline image to 5 pixels each.

#photoImage {margin-right: 5px; margin-bottom: 5px}

24. You want your paragraphs to have a padding space above and below the paragraph
equal to 10 pixels. Specify the style declaration to do this.

p {padding-top: 10px; padding-bottom: 10px}

25. Write the HTML code for a custom button consisting of the image “back.gif” and the text

“Home Page”.

<button type=”button”>

<img src=”back.gif” />

Home Page

</button>

26. Write the HTML tag and code for a Submit button with the label “Assignment” on it.

<input type=”submit” value=”Assignment” >

27. Write code to create an ordered list with 2 items and with capital roman numeric labels.

<ol style=”list-style-type: upper-roman”>

<li> red</li>

<li> green</li>

</ol>
28. Rewrite this code as strict-DTD-compliant code:

<body>

<img src=“logo.jpg” alt=“Wizard Works” />

</body>

<body>

<div>

<img src=”logo.jpg” alt=”Wizard Works” />

</div>

</body>

29. In CSS, define the style to be used for headings hn, where:

for n even,

text font is monoscape and the background colour is white

for n odd,

text font is sans-serif and the background colour is cyan

h2, h4, h6 { text-family : monoscape; background-color : white }

h1, h3, h5 { text-family : sans-serif; background-color : cyan }

30. Write the HTML for a semantic link to an external CSS style sheet called “mystyle.css”.

<link rel=”stylesheet” href=”mystyle.css” type=”text/css”/>

31. Write the HTML code for a selection list with three options: VISA, AMEX and MCARD.

<select >

<option > VISA </option>

<option > AMEX </option>

<option > MCARD </option>

</select>
Section 3: Short Code Programming

1. A web page has three sections: top, middle and bottom. Write style sheet definitions for

these sections as follows:

• the top section is in blue font, except for <h1> tags, which have green font;

• the middle section is centred with a background colour yellow;

• the bottom section in indented 25 pixels from the left margin.

<style type=”text/css”>

#top {color: blue}

#top h1 {color: green}

#middle {text-align: center; background-color: yellow}

#bottom {text-indent: 25px}

</style>

2. Write some code for a web page that has links to www.uqu.edu.sa and www.ccg.uqu.edu.sa Provide

a rollover effect so that these links change size when the mouse cursor is moved over them.

<html>

<head>

<style type="text/css">

a:hover {color: red; font-weight: bold; font-size: 150%}

</style>

</head>

<body>

<br />

<a href="http://www.uqu.edu.sa">UQU</a>

<br />

<a href="http://www.ccg.uqu.edu.sa">CCG</a>

</body>

</html>

You might also like