MCQs on Links and Navigation | HTML

Master the fundamentals of HTML navigation with these 30 MCQs on Anchor Tags, Internal and External Links, Relative vs Absolute URLs, and the Target Attribute for Opening Links in New Tabs. Perfect for enhancing your web development knowledge!


MCQs on Anchor Tags, Links, and Navigation in HTML

Anchor Tags (<a>) and Internal/External Links

  1. What does the <a> tag represent in HTML?
    • a) Image
    • b) Anchor (link)
    • c) Video
    • d) Table
  2. Which attribute in the <a> tag specifies the destination URL?
    • a) href
    • b) src
    • c) link
    • d) target
  3. How can you create a link to an external website in HTML?
    • a) <a href=”internal-link.html”>
    • b) <a href=”http://example.com”>
    • c) <a href=”/path/to/file”>
    • d) <a href=”#section1″>
  4. Which of the following is an example of an internal link?
    • a) <a href=”http://www.example.com”>
    • b) <a href=”about.html”>
    • c) <a href=”https://www.example.com”>
    • d) <a href=”https://www.google.com”>
  5. What does the href attribute define in an anchor tag?
    • a) Image source
    • b) Hyperlink destination
    • c) Font style
    • d) Page title
  6. What type of link does <a href="contact.html">Contact Us</a> represent?
    • a) External
    • b) Internal
    • c) Dynamic
    • d) Multimedia
  7. How can you link to a section within the same page?
    • a) <a href=”#section1″>
    • b) <a href=”section1.html”>
    • c) <a href=”/#section1″>
    • d) <a href=”index.html”>
  8. Which attribute is used to specify the name of the anchor in HTML?
    • a) name
    • b) href
    • c) id
    • d) target
  9. Which tag would you use to open a link in a new tab?
    • a) <a target=”new”>
    • b) <a target=”_blank”>
    • c) <a target=”new-tab”>
    • d) <a target=”_new”>
  10. To create a hyperlink to a mailto: address, you would use which format?
    • a) <a href=”mailto:someone@example.com”>
    • b) <a href=”tel:1234567890″>
    • c) <a href=”http://example.com”>
    • d) <a href=”mailto:someone@example”>

Relative vs Absolute URLs

  1. What is an example of a relative URL in HTML?
  2. What does a relative URL depend on?
    • a) The absolute path of the file
    • b) The location of the file on the server
    • c) The content of the file
    • d) The target attribute
  3. Which of these is an example of an absolute URL?
  4. When should you use an absolute URL over a relative URL?
    • a) For linking to local files
    • b) For linking to external resources
    • c) For linking to images only
    • d) For linking to external databases
  5. What would the URL ../folder/page.html represent?
    • a) Absolute link
    • b) Internal link
    • c) Relative link
    • d) External link
  6. What is the purpose of using relative URLs in a website?
    • a) To create external links
    • b) To refer to pages on the same website
    • c) To link to media files
    • d) To add JavaScript to the page
  7. Which of the following is true about an absolute URL?
    • a) Always starts with ‘/’
    • b) Can reference files within the current directory
    • c) Always starts with ‘http://’
    • d) Contains the full address of a resource
  8. What is the key difference between relative and absolute URLs?
    • a) Relative URLs are specific, absolute URLs are generic
    • b) Absolute URLs include the full path, relative URLs don’t
    • c) Relative URLs work only within the same domain
    • d) There is no difference
  9. Which of these URLs is relative?
  10. How would you reference a file one directory level up from the current folder?
    • a) ./folder/filename
    • b) ../filename
    • c) ../../filename
    • d) /folder/filename

Target Attribute for Opening Links in New Tabs

  1. Which target attribute value opens the link in a new window or tab?
    • a) _self
    • b) _top
    • c) _blank
    • d) _parent
  2. What happens when you use target="_blank" in an anchor tag?
    • a) The link opens in the current window
    • b) The link opens in a new tab or window
    • c) The link opens in the same tab
    • d) The link opens in the parent frame
  3. What is the default behavior of an anchor tag if no target attribute is specified?
    • a) Opens in a new window
    • b) Opens in the same window
    • c) Opens in a frame
    • d) Does not open at all
  4. How can you prevent a link from opening in the same window or tab?
    • a) Use target=”_top”
    • b) Use target=”_blank”
    • c) Use target=”new”
    • d) Use target=”_parent”
  5. What should be used to open a link in the parent frame?
    • a) target=”_parent”
    • b) target=”_self”
    • c) target=”_top”
    • d) target=”_blank”
  6. What does the target="_top" attribute do?
    • a) Opens the link in the current frame
    • b) Opens the link in the entire browser window
    • c) Opens the link in a new tab
    • d) Opens the link in the same frame
  7. How can you ensure a link opens in the same window where the user clicked it?
    • a) Use target=”_parent”
    • b) Use target=”_self”
    • c) Use target=”_blank”
    • d) Use target=”_top”
  8. Which of the following values would make a link open in a new tab?
    • a) _self
    • b) _top
    • c) _blank
    • d) _parent
  9. Which target attribute is commonly used to open a hyperlink in the same frame?
    • a) _self
    • b) _top
    • c) _blank
    • d) _parent
  10. What is the purpose of using target="_parent" in a link?
    • a) To open the link in the current window
    • b) To open the link in a parent window or frame
    • c) To open the link in a new tab
    • d) To open the link in the entire browser

Answer Key

QnoAnswer
1b) Anchor (link)
2a) href
3b) <a href=”http://example.com”>
4b) <a href=”about.html”>
5b) Hyperlink destination
6b) Internal
7a) <a href=”#section1″>
8c) id
9b) <a target=”_blank”>
10a) <a href=”mailto:someone@example.com”>
11b) /images/pic.jpg
12b) The location of the file on the server
13c) https://www.example.com/images/logo.png
14b) For linking to external resources
15c) Relative link
16b) To refer to pages on the same website
17d) Contains the full address of a resource
18b) Absolute URLs include the full path, relative URLs don’t
19b) /folder/page.html
20c) ../../filename
21c) _blank
22b) The link opens in a new tab or window
23b) Opens in the same window
24b) Use target=”_blank”
25a) target=”_parent”
26b) Opens the link in the entire browser window
27b) Use target=”_self”
28c) _blank
29a) _self
30b) To open the link in a parent window or frame

Use a Blank Sheet, Note your Answers and Finally tally with our answer at last. Give Yourself Score.

X
error: Content is protected !!
Scroll to Top