HTML/CSS MCQ

HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 3

Multiple choice questions and answers (MCQs) on HTML/CSS to prepare for exams, tests, and certifications. These questions are taken from a real written exam and some parts are taken from an interview. So you will find questions on basic techniques such as tags, web standards, CSS selector, objects, and more. This quiz will easily prepare anyone to pass their online test.
 

1. Which tag is used to display pre-formatted text?

A <pre> … </pre>

B <prefor> … </prefor>

C <p> … </p>

D <pre-format> … </pre-format>

A
The <pre> (short for “preformatted text”) element in HTML is used to display text exactly as it’s written in the code, preserving spaces, tabs, and line breaks. Click here to see an example.

 

 

2. How to add alternative text to an image?

A <img src = “https://stackhowto.com/logo.png” alternate = “logo” />

B <img src = “https://stackhowto.com/logo.png” alt text = “logo” />

C <img src = “https://stackhowto.com/logo.png” alternate text = “logo” />

D <img src = “https://stackhowto.com/logo.png” alt = “logo” />

D
The alt attribute (short for “alternative text”) is used in HTML to provide a textual description of an image. This text is displayed if the image can’t be shown (e.g., due to a broken link or if the user is using a screen reader). Click here to see an example.

 

 
 

3. How to embed audio files in HTML?

A <embed src = “audio.mp3” width = “50” height = “10”>

B <embed sound = “audio.mp3” width = “50” height = “10”>

C <embed audio = “audio.mp3” width = “50” height = “10”>

D <embed music = “audio.mp3” width = “50” height = “10”>

A
The <embed> tag in HTML is used to embed external content like multimedia, applications, or interactive content directly into a webpage. This can include things like:

  • PDFs
  • Flash (historically, but now deprecated)
  • Videos
  • Audio files
  • HTML or SVG documents

 

 

4. In HTML, Uniform Resource Locator (URL) is used _____

A To create a frame document.

B To create an image map in a web page.

C To customize the image in a web page.

D To identify a name or a resource on the Internet.

D
A URL (Uniform Resource Locator) is a unique identifier used to locate a resource on the Internet. It is also called a Web address. URLs are made up of several parts – including a protocol and a domain name – that tell the Web browser where and how to retrieve a resource. Example: https://stackhowto.com/html-css-mcqs-multiple-choice-questions-and-answers-part-1/

 

 

5. CSS is an acronym for _____

A Cascading Style Sheet

B Costume Style Sheet

C Cascading System Style

D None of the above

A
Cascading Style Sheets (CSS) is a language used to describe the presentation of a document written in a markup language such as HTML.

 

 
 

6. Which of the following protocols is not used on the Internet?

A Gopher

B HTTP

C WIRL

D Telnet

C
  • HTTP (Hypertext Transfer Protocol) is the set of rules for transferring files (text, graphic images, audio, video and other multimedia files) over the World Wide Web.
  • Telnet is a network protocol used to access remote computers and terminals over the Internet or a TCP/IP computer network.
  • Gopher is an application layer protocol for retrieving and displaying web documents stored on remote web servers.

 

 

7. What should be the value of the “width” property of the following table: (<table style="width:'???'">), to make the width of the table fit the current width of the browser window?

A 100%

B 640px

C 100em

D 1024px

A
100% refers to the total width of the browser window.

 

 

8. Which element is used in <HEAD> of an HTML/XHTML page, if we want to use an external CSS to decorate the page?

A <src>

B <link>

C <style>

D <css>

B
The tag <link> defines a link between a document and an external resource. Example:
<link rel="stylesheet" type="text/css" href="style.css">

 

 
 

9. What attribute can be added to many HTML/XHTML elements to identify them as a member of a specific group?

A Id

B class

C div

D span

B
A class is used to identify several elements, and its name is preceded by a dot (.). Example:
<html>
	<head>
		<style>
			.city {
			  background-color: blue;
			  color: yellow;
			} 
		</style>
	</head>
	<body>
		<p class="city">London is the capital of England.</p>
		<p class="city">Paris is the capital of France.</p>
		<p class="city">Tokyo is the capital of Japan.</p>
		<p class="city">Rabat is the capital of Morocco.</p>
	</body>
</html>
 

10. When we write <img src = "img.png">, what does “img.png” imply?

A element

B attribute

C value

D operator

C
“img.png” is the value of the src attribute
mcqMCQPractice competitive and technical Multiple Choice Questions and Answers (MCQs) with simple and logical explanations to prepare for tests and interviews.Read More

Leave a Reply

Your email address will not be published. Required fields are marked *