HTML/CSS MCQ

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

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 method allows you to load a JavaScript file asynchronously without blocking the page rendering?

A async

B defer

C onload

D lazyload

A
The async attribute is used in the <script> tag to load the JavaScript file asynchronously. This ensures that the page rendering is not blocked during the script loading.
 

2. Which CSS property allows you to zoom an element when hovered?

A transform: scale()

B zoom: 1.5;

C hover: zoom-in;

D transform: enlarge()

A
The transform: scale() property allows you to zoom in or out an element. For example, transform: scale(1.1); zooms the element slightly on hover.
 

3. Which CSS property allows you to make an image responsive and fit its container size?

A max-width: 100%;

B width: auto;

C img-responsive: true;

D flex-size: 100%;

A
The max-width: 100%; property makes an image responsive by ensuring it does not exceed the container’s width while maintaining its proportions.
 
 

4. Which HTML tag creates a form field for entering a decimal number with automatic validation?

A <input type="decimal">

B <input type="number" step="any">

C <input type="float">

D <input type="range" step="0.01">

B
The step="any" attribute allows the <input type="number"> element to accept any decimal number with built-in validation to ensure the value entered is a valid number.
 

5. Which CSS property allows you to apply styles only on small screens (mobile-first)?

A @media screen and (max-width: 1000px)

B @media (min-width: 600px)

C @media (max-width: 600px)

D @media screen and (min-width: 100px)

C
The rule @media (max-width: 600px) applies styles only to screens with a width of 600px or less, typically used for mobile-first responsive designs.
 

6. Which HTML syntax is used to create a link that directly calls a phone number from a mobile device?

A <a href="tel:1234567890">Call</a>

B <a href="call:1234567890">Call</a>

C <a href="phone:1234567890">Call</a>

D <a href="tel:+1234567890">Call Us</a>

A
The href="tel:1234567890" attribute creates a link that, when clicked on a mobile device, opens the phone app to call the specified number.
 
 

7. Which HTML tag is used to structure text as a long quotation?

A <quote>

B <q>

C <cite>

D <blockquote>

D
The <blockquote> tag is used to indicate a long quotation, usually visually indented in the text. Example:

Albert Einstein said:

Life is like riding a bicycle. To keep your balance, you must keep moving.

 

8. Which CSS property creates a 3-column grid?

A grid-columns: 3;

B grid-template-columns: 1fr 1fr 1fr;

C grid-layout: 3 columns;

D grid-template-columns: 33% 33% 33%;

B
grid-template-columns: 1fr 1fr 1fr; creates three equal-width columns in a CSS Grid container, where “fr” stands for a fraction of the available space. See a full example.
 

9. Which HTML tag allows you to add an audio file with controls (play, pause, volume) to the page?

A <audio controls>

B <media controls>

C <sound controls>

D <music controls>

A
The <audio controls> tag is used to embed an audio file with native controls such as play, pause, and volume.
 
 

10. Which HTML tag allows you to add a placeholder text in a text input field?

A placeholder

B label

C hint

D prompt

A
The placeholder attribute in an <input> field displays a hint text inside the field until the user types something. Example:

<input type="email" placeholder="Enter your email address">

Output:

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 *