MCQs / Computer Science / HTML Links, Images, Colours, Frames and Tables

HTML Links, Images, Colours, Frames and Tables MCQs — Computer Science

45 multiple-choice questions on HTML Links, Images, Colours, Frames and Tables from Computer Science, each with the correct answer and, where available, a teacher's explanation. Read through them to revise the chapter, then practise the same questions one by one to test yourself.

1. The hexadecimal code for black is:

  1. 0000FF
  2. FFFFFF
  3. FF0000
  4. 000000

Answer: D) 000000

Explanation: All colour components are zero.

Discuss this question

2. A link written as href="contact.html" is a(n):

  1. email link
  2. absolute URL
  3. image tag
  4. relative URL

Answer: D) relative URL

Explanation: It refers to a file in the same site/folder.

Discuss this question

3. The space between adjacent cells is set by:

  1. cellspacing
  2. width
  3. rowspan
  4. cellpadding

Answer: A) cellspacing

Explanation: Spacing is between cells.

Discuss this question

4. The tag used to insert an image is:

  1. <src
  2. <pic
  3. <img
  4. <image

Answer: C) <img

Explanation: <img is an empty tag.

Discuss this question

5. A table row is defined with:

  1. <td
  2. <th
  3. <row
  4. <tr

Answer: D) <tr

Explanation: tr = table row.

Discuss this question

6. The frameset attribute that divides the window into vertical columns is:

  1. rows
  2. cols
  3. span
  4. width

Answer: B) cols

Explanation: cols="30%,70%".

Discuss this question

7. To link to a section with id="fees" on the same page you write:

  1. <a href="fees"
  2. <a name="fees.html"
  3. <a href="fees"
  4. <a src="fees"

Answer: C) <a href="fees"

Explanation: The refers to an id in the page.

Discuss this question

8. The body attribute used to set the colour of visited links is:

  1. link
  2. text
  3. vlink
  4. alink

Answer: C) vlink

Explanation: v = visited.

Discuss this question

9. Frames divide the browser window into:

  1. multiple tables
  2. separate browsers
  3. a single paragraph
  4. multiple sections, each showing a separate page

Answer: D) multiple sections, each showing a separate page

Explanation: Each frame loads its own HTML file.

Discuss this question

10. Which attribute opens a link in a new tab?

  1. target="blank"
  2. href="new"
  3. target="self"
  4. open="tab"

Answer: A) target="blank"

Explanation: blank opens a new window/tab.

Discuss this question

11. The title of a table is given using:

  1. <th
  2. <title
  3. <head
  4. <caption

Answer: D) <caption

Explanation: Caption appears above the table.

Discuss this question

12. A table with 3 <tr tags and 4 <td tags in each row has:

  1. 4 rows and 3 columns
  2. 3 rows and 4 columns
  3. 12 rows
  4. 7 columns

Answer: B) 3 rows and 4 columns

Explanation: tr = rows; td per row = columns.

Discuss this question

13. Which code creates a link to send email?

  1. <a href="email:ali@uni.edu.pk"
  2. <a src="ali@uni.edu.pk"Email</a
  3. <a href="mailto:ali@uni.edu.pk"Email</a
  4. <mail to="ali@uni.edu.pk"Email</mail

Answer: C) <a href="mailto:ali@uni.edu.pk"Email</a

Explanation: mailto: opens the email program.

Discuss this question

14. The attribute of the body tag used to set a background image is:

  1. bgimage
  2. src
  3. bgcolor
  4. background

Answer: D) background

Explanation: <body background="bg.jpg".

Discuss this question

15. To merge three cells vertically you use:

  1. rowspan="3"
  2. colspan="3"
  3. height="3"
  4. span="3"

Answer: A) rowspan="3"

Explanation: The cell spans three rows.

Discuss this question

16. The attribute that divides the window into horizontal sections is:

  1. rows
  2. align
  3. colspan
  4. cols

Answer: A) rows

Explanation: rows="20%,".

Discuss this question

17. Which is the correct HTML to insert "logo.png" with a border of 2?

  1. <img src="logo.png" border="2"
  2. <image src="logo.png" border=2</image
  3. <img alt="logo.png" size="2"
  4. <img href="logo.png" border="2"

Answer: A) <img src="logo.png" border="2"

Explanation: src gives the file and border the thickness.

Discuss this question

18. The attribute of <img that gives the image file path is:

  1. href
  2. alt
  3. link
  4. src

Answer: D) src

Explanation: src = source.

Discuss this question

19. The attribute used to change the background colour of a page is:

  1. color
  2. face
  3. bgcolor
  4. text

Answer: C) bgcolor

Explanation: <body bgcolor="...".

Discuss this question

20. Which attributes change the size of an image?

  1. border and align only
  2. href and target
  3. width and height
  4. src and alt

Answer: C) width and height

Explanation: e.g. width="300" height="200".

Discuss this question

21. Which code makes an image clickable as a link?

  1. <a src="logo.png"index.html</a
  2. <a href="index.html"<img src="logo.png"</a
  3. <link img="logo.png"
  4. <img href="index.html" src="logo.png"

Answer: B) <a href="index.html"<img src="logo.png"</a

Explanation: Put the img inside the anchor.

Discuss this question

22. A hyperlink is created with the:

  1. <a tag
  2. <link tag only
  3. <href tag
  4. <h1 tag

Answer: A) <a tag

Explanation: a = anchor.

Discuss this question

23. By default, unvisited links are shown in:

  1. green
  2. red
  3. blue
  4. black

Answer: C) blue

Explanation: Visited links are purple; active links are red.

Discuss this question

24. Which attribute gives a background colour to a single table cell?

  1. text in the <table tag
  2. face in the <td tag
  3. bgcolor in the <td tag
  4. color in the <tr tag only

Answer: C) bgcolor in the <td tag

Explanation: <td bgcolor="yellow".

Discuss this question

25. Which code gives a navy background and white text to the whole page?

  1. <body bgcolor="navy" text="white"
  2. <font bgcolor="navy"
  3. <body text="navy" bgcolor="white"
  4. <body color="navy"

Answer: A) <body bgcolor="navy" text="white"

Explanation: bgcolor = background, text = foreground.

Discuss this question

Page 1 of 2 Next

Practise HTML Links, Images, Colours, Frames and Tables MCQs

More Computer Science chapters