MCQs / Computer Science / Lab: HTML Web Pages

Lab: HTML Web Pages MCQs — Computer Science

42 multiple-choice questions on Lab: HTML Web Pages 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. In <a href="index.html"<img src="logo.png"</a, clicking the logo:

  1. downloads the logo
  2. does nothing
  3. opens an email
  4. opens index.html

Answer: D) opens index.html

Explanation: The image works as a hyperlink.

Discuss this question

2. Which code opens HEC's website in a new tab?

  1. <a src="https://www.hec.gov.pk"HEC</a
  2. <a href="https://www.hec.gov.pk" target="blank"HEC</a
  3. <link href="hec"HEC</link
  4. <a href="https://www.hec.gov.pk" target="self"HEC</a

Answer: B) <a href="https://www.hec.gov.pk" target="blank"HEC</a

Explanation: blank opens a new tab.

Discuss this question

3. The output of <pA<brB</p is:

  1. AB in bold
  2. A and B on the same line
  3. A and B on separate lines in one paragraph
  4. an error

Answer: C) A and B on separate lines in one paragraph

Explanation: <br breaks the line.

Discuss this question

4. Text inside <th is displayed by default as:

  1. bold and centred
  2. underlined
  3. red
  4. italic and left aligned

Answer: A) bold and centred

Explanation: Header cells are emphasised.

Discuss this question

5. In a definition list, the description of a term is written in:

  1. <dd
  2. <li
  3. <dt
  4. <dl

Answer: A) <dd

Explanation: dd = definition description.

Discuss this question

6. In a table with 4 columns, if one cell uses colspan="2", how many <td tags are needed in that row?

  1. 2
  2. 3
  3. 4
  4. 5

Answer: B) 3

Explanation: One cell covers two columns.

Discuss this question

7. The default name commonly used for a website's home page file is:

  1. start.exe
  2. index.html
  3. home.txt
  4. main.doc

Answer: B) index.html

Explanation: Web servers look for index.html first.

Discuss this question

8. <ol type="i" numbers items as:

  1. I, II, III
  2. i, ii, iii
  3. 1, 2, 3
  4. a, b, c

Answer: B) i, ii, iii

Explanation: Lowercase Roman numerals.

Discuss this question

9. The code <a href="news" links to:

  1. a website called news
  2. a file named news.exe
  3. an email address
  4. the element with id="news" on the same page

Answer: D) the element with id="news" on the same page

Explanation: refers to an id on the page.

Discuss this question

10. In a frameset page, which attribute of <frame is used as a link target?

  1. noresize
  2. scrolling
  3. name
  4. src

Answer: C) name

Explanation: Links use target="frame name".

Discuss this question

11. The <caption tag is placed:

  1. after </table
  2. immediately after the opening <table tag
  3. in the head section
  4. inside <td

Answer: B) immediately after the opening <table tag

Explanation: Caption gives the table a title.

Discuss this question

12. The text written inside <title is displayed:

  1. nowhere
  2. on the browser tab
  3. as the first paragraph
  4. in the footer

Answer: B) on the browser tab

Explanation: Title appears on the tab and in bookmarks.

Discuss this question

13. The modern HTML5 tag used to embed another page or a YouTube video inside a page is:

  1. <iframe
  2. <frameset
  3. <video-link
  4. <embedpage

Answer: A) <iframe

Explanation: Inline frames are valid in HTML5.

Discuss this question

14. The <strike tag is used to show:

  1. blinking text
  2. text with a line through it
  3. superscript text
  4. underlined text

Answer: B) text with a line through it

Explanation: e.g. an old price.

Discuss this question

15. After editing and saving the HTML file, to see changes in the browser you press:

  1. F5 (Refresh)
  2. F7
  3. Ctrl + P
  4. F2

Answer: A) F5 (Refresh)

Explanation: The browser reloads the file.

Discuss this question

16. <ul type="circle" displays bullets as:

  1. filled squares
  2. letters
  3. numbers
  4. hollow circles

Answer: D) hollow circles

Explanation: circle = ○.

Discuss this question

17. The tag that shows a message to browsers that do not support frames is:

  1. <noscript
  2. <noframes
  3. <frame
  4. <iframe

Answer: B) <noframes

Explanation: Content inside noframes appears instead.

Discuss this question

18. The shortcut to view the HTML source of a page in most browsers is:

  1. Ctrl + H
  2. Ctrl + U
  3. Ctrl + S
  4. Ctrl + J

Answer: B) Ctrl + U

Explanation: View page source.

Discuss this question

19. Which code displays CO₂ correctly?

  1. CO<sup2</sup
  2. CO<sub2</sub
  3. CO<big2</big
  4. CO<b2</b

Answer: B) CO<sub2</sub

Explanation: Subscript lowers the 2.

Discuss this question

20. How many &nbsp; entities are needed to show 3 extra spaces?

  1. 0
  2. 3
  3. 6
  4. 1

Answer: B) 3

Explanation: One entity per space.

Discuss this question

21. Which program is suitable for writing HTML code?

  1. Calculator
  2. Notepad or VS Code
  3. MS Paint
  4. Windows Media Player

Answer: B) Notepad or VS Code

Explanation: Any plain text editor works.

Discuss this question

22. Which body attribute sets a background picture?

  1. bgcolor
  2. background
  3. text
  4. link

Answer: B) background

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

Discuss this question

23. Which attribute merges a cell across 3 columns?

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

Answer: C) colspan="3"

Explanation: colspan spans columns.

Discuss this question

24. The modern CSS property to change font colour is:

  1. fgcolor
  2. font-colour
  3. color
  4. text-colour

Answer: C) color

Explanation: style="color:blue".

Discuss this question

25. Which code makes an ordered list begin at 10?

  1. <ul start="10"
  2. <ol start="10"
  3. <ol begin="10"
  4. <ol type="10"

Answer: B) <ol start="10"

Explanation: start sets the first number.

Discuss this question

Page 1 of 2 Next

Practise Lab: HTML Web Pages MCQs

More Computer Science chapters