Links and Image Questions with Answers

32 practice questions on Links and Image (HTML & CSS) with answers and step-by-step solutions. Try 10 samples below, then practise all 32 free in the AptiNest app.

Sample questions

Question 1Medium

One of the following methods is used to send email with default subject "hello"

  1. < a href="mailto:sam@gmail.com?subject=hello">email
  2. < a href="mailto:sam@gmail.com &subject:hello"> email
  3. < a href="mailto:sam@gmail.com, subject=hello"> email
  4. None of these.

Answer: A. < a href="mailto:sam@gmail.com?subject=hello">email

Explanation

?subject=hello after the address sets the default subject of the email to hello. Example: <a href="mailto:sam@gmail.com?subject=hello">email</a>. The other options use & or a comma instead of ?, so they are wrong.

Step-by-step solution

  1. A mailto link takes an address, then a question mark, then parameters.
  2. The subject parameter is written as subject=hello after the question mark.
  3. Option B uses an ampersand and a colon, so the subject is not read.
  4. Option C uses a comma and no question mark, so it is malformed.
  5. So the correct answer is option A, with ?subject=hello after the address.

Why the other options are wrong

  • B. The ampersand and colon are wrong; the parameter must follow a question mark and use an equals sign.
  • C. A comma and no question mark do not start the parameters, so the subject is not set.

Tip: In mailto links the first extra setting starts with a question mark, and the next ones join with an ampersand.

Question 2Medium

How to set background color to the web page?

  1. < body bgcolor="#E6E6FA">
  2. < body color="#E6E6FA">
  3. < bgcolor="#E6E6FA">
  4. None of these

Answer: A. < body bgcolor="#E6E6FA">

Explanation

The given color will be set as background color to the web page.

Step-by-step solution

  1. The bgcolor attribute on the body tag sets the page background colour.
  2. The value #E6E6FA is a hex colour code.
  3. So option A, body bgcolor #E6E6FA, is the correct answer.

Why the other options are wrong

  • B. Color is not the attribute that sets the page background.
  • C. There is no body tag, so the colour is not set on the page.
  • D. Option A is valid, so none of these is wrong.

Tip: Hex colour codes start with a hash sign.

Question 3Medium

What do you mean by internal link?

  1. A page on same server or directory.
  2. A section on current page or documents.
  3. A page or site on different server or directory.
  4. None of these

Answer: B. A section on current page or documents.

Explanation

you can do this by two different ways:-assign the place of the page where u want the pointer to move, and bookmark it by adding this code in it
< A NAME="your bookmark name"></A>
"u need to add a link in anyplace in your page to let the user move to your bookmark point from it
< A HREF="#your bookmark name ">
Add the text to be displayed and clicked by the user </A></P>

Step-by-step solution

  1. An internal link points to a place within the same document.
  2. It usually uses an anchor like #section.
  3. So option B is correct: a section on the current page.

Why the other options are wrong

  • A. That describes a link to another page on the same site.
  • C. That describes an external link.
  • D. Option B is a correct description.

Tip: Internal links jump within the page; external links leave the site.

Question 4Medium

How to give alert after clicking on html button?

  1. onclick=alert("hello world")
  2. afterclick=alert("hello world")
  3. click=alert("hello world")
  4. none of the above.

Answer: A. onclick=alert("hello world")

Explanation

After clicking on button alert message will be shown. the total syntax is as follows:
<button type="button" onclick="alert('Hello world!')">Click Me!</button>

Step-by-step solution

  1. Onclick attribute calls alert function when button is clicked.
  2. Alert function displays message in popup window.
  3. Syntax requires quotes around the message text.
  4. Correct syntax is onclick=alert("hello world")
  5. Other options use incorrect event names or syntax.

Why the other options are wrong

  • B. Afterclick is not a valid HTML event attribute.
  • C. Click is not the correct syntax for triggering alerts.

Tip: Use onclick=alert("message") for simple alerts in HTML.

Question 5Medium

If image cannot be displayed then ____ specifies an alternate text for image.

  1. Caption attribute
  2. Alt attribute
  3. Value attribute
  4. Text attribute

Answer: B. Alt attribute

Explanation

if image cannot be displayed then in place of image the alternate given text is displayed.
e.g.

Step-by-step solution

  1. Alt attribute provides alternative text for images.
  2. If image fails to load, Alt attribute shows the text instead.
  3. Other attributes like Caption or Value do not replace images.
  4. Text attribute is used for regular text, not images.
  5. Therefore, Alt attribute is correct answer.

Why the other options are wrong

  • A. Caption is for image description, not replacement.
  • C. Value is for form inputs, not image text.
  • D. Text is for normal content, not images.

Tip: Remember Alt attribute is used for image text alternatives.

Question 6Medium

What do you mean by external link?

  1. A page on same server or directory.
  2. A section on current page or documents.
  3. A page or site on different server or directory.
  4. None of these

Answer: C. A page or site on different server or directory.

Explanation

To link to any page in the world, you need the (URL) of the page you want to link to.
< a href = "URL for the website"> text to click on </a>

Step-by-step solution

  1. An external link points to a page on another site or server.
  2. Such a link uses the full URL of the page in the href attribute.
  3. A page on a different server is the correct answer 2.

Why the other options are wrong

  • A. A page on the same server or directory is an internal link.
  • B. A section on the current page is an anchor link, not an external link.
  • D. Option C is correct, so none of these is wrong.

Tip: Internal link stays on the same site. External link goes to another site with a full URL.

Question 7Medium

What does URL encoding means?

  1. URL encoding passes characters into a original format .
  2. URL encoding converts characters into a format that can be transmitted over the Internet.
  3. URL encoding does nothing.
  4. None of these

Answer: B. URL encoding converts characters into a format that can be transmitted over the Internet.

Explanation

URLs can only be sent over the Internet using the ASCII character-set.
Since URLs often contain characters outside the ASCII set, the URL has to be converted into a valid ASCII format.
URL encoding converts characters into a format that can be transmitted over the Internet.
URL encoding replaces non ASCII characters with a "%" followed by two hexadecimal digits.
URLs cannot contain spaces. URL encoding normally replaces a space with a + sign.

Step-by-step solution

  1. URLs can only be sent over the internet using a limited set of characters.
  2. URL encoding replaces other characters with a percent sign and two hex digits.
  3. So URL encoding converts characters into a format that can be sent over the internet.
  4. The correct answer is option B.

Why the other options are wrong

  • A. URL encoding changes characters into a transmittable form; it does not restore an original format.
  • C. URL encoding does change characters, so it is not doing nothing.
  • D. Option B is correct, so none of these is wrong.

Tip: Percent encoding replaces unsafe characters with percent and two hex digits, for example a space becomes %20.

Question 8Medium

What do you mean by email link?

  1. A page on same server or directory.
  2. Open the visitors email program.
  3. A page or site on different server or directory.
  4. A file for visitor to download.

Answer: B. Open the visitors email program.

Explanation

A mailto link opens the visitor's email program with the address filled in, so the visitor can send an email. Example: <a href="mailto:mail_address@mail.com">click here to send me e-mail</a>.

Step-by-step solution

  1. Email link opens visitor's email program.
  2. It automatically fills the email address in the 'To' field.
  3. This allows user to send message directly from their email client.
  4. The link uses mailto: protocol to trigger email app.
  5. Correct answer is option B.

Why the other options are wrong

  • A. Same server link refers to internal navigation, not email.
  • C. Different server link refers to external links, not email.

Tip: Remember 'mailto:' protocol is used for email links.

Question 9Medium

Value of attribute href is also called as ____ of destination web address.

  1. URM
  2. USK
  3. URL
  4. URK

Answer: C. URL

Explanation

Value of attribute href is also called as Url(uniform resource locator) of destination web address.

Step-by-step solution

  1. Href stands for Hypertext Reference.
  2. It is used to specify the destination of a link.
  3. The value of href is called Url in full form.
  4. Url stands for Uniform Resource Locator.
  5. Uniform Resource Locator is the complete address of a web page.
  6. So, the correct answer is URL.

Why the other options are wrong

  • A. URM is not related to web addresses.
  • B. USK is not a standard term for web addresses.
  • D. URK is not the correct full form of href.

Tip: Remember: Href's value is always a URL.

Question 10Medium

If we need to include some of the lines to mail body then we can use following approach?

  1. < a href="mailto:sam@gmail.com? body=hello">email
  2. < a href="mailto:sam@gmail.com& body:hello">email
  3. < a href="mailto:sam@gmail.com, body=hello">email
  4. None of these

Answer: A. < a href="mailto:sam@gmail.com? body=hello">email

Explanation

?body=hello after the address fills in the body of the email with hello. Example: <a href="mailto:sam@gmail.com?body=hello">email</a>. The other options use & or a comma instead of ?, so they are wrong.

Step-by-step solution

  1. A mailto link adds the body text after a question mark with the body parameter.
  2. Option A writes body=hello after the question mark, so the body is set to hello.
  3. Option B uses an ampersand and a colon, so the body is not read.
  4. Option C uses a comma and no question mark, so the body is not set.
  5. So the correct answer is option A.

Why the other options are wrong

  • B. The ampersand and colon do not start the parameter list, so the body is missed.
  • C. A comma replaces the question mark, so the body parameter is not read.

Tip: Mail link parameters start with a question mark, and the body is set with body equals the text.

Practise all 32 questions free

The full question bank with timed practice, progress tracking and Vidya, your AI tutor. Free, no ads.

Open this topic in the app →

Related topics

See all HTML & CSS topics · All topics