MCQ

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

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. DNS translates __________

A the domain name as IP address

B IP address as a domain name

C Both A and B are true.

D the domain name as physical address (MAC)

A
DNS stands for Domain Name System (or Service or Server), an Internet service that translates domain names into IP addresses. Because domain names are alphabetical, they are easier to remember. However, the Internet is really based on IP addresses.

 

 
 

2. Which tag is used to list items with bullets?

A <bullet>…</bullet>

B <list>…</list>

C <ul>…</ul>

D <ol>…</ol>

C
The <ul> tag defines an unordered list. Example :
<ul>
  <li>JavaScript</li>
  <li>HTML / CSS</li>
  <li>PHP</li>
</ul>
Output:

  • JavaScript
  • HTML / CSS
  • PHP

 

 

3. How to define a link that should open in a new page in HTML?

A <a href = “https://stackhowto.com” target = “blank”>Click Here</a>

B <a href = “https://stackhowto.com” target =“_blank”>Click Here</a>

C <a href = “https://stackhowto.com” target = “#blank”>Click Here</a>

D <a href = “https://stackhowto.com” target = “@blank”>Click Here</a>

B
If you add the attribute target = "_ blank" to your links. When a visitor clicks on this link, it will open in a new window or tab.

 

 

4. How to define a background image for a web page?

A <body background = “test.jpg”>

B <body background image = “test.jpg”>

C <background = “test.jpg”>

D <background image = “test.jpg”>

A
If you want to add a background image instead of a color, one solution is using <body background = “test.jpg”> or with CSS body { background-image: url("test.jpg");}. It specifies a background image for a web page.

 

 

5. The first page of a website is called _____.

A Design page

B Home page

C Front page

D Main page

B
A home page is the default page of a website. It is the first page that visitors see when they enter a URL.

 

 
 

6. The Head tag is used for?

A Writing CSS styles

B Writing Javascript

C Including CSS and JS files

D All the answers are true

D
The <head> tag is used to contain specific information about a web page, often called metadata. This information includes items such as the document title (required), as well as scripts or links to scripts and CSS files.

 

 

7. By default, links are displayed with an underline. How can you remove the underline from all links using CSS code?

A a {text: no-underline;}

B a {text-decoration:none;}

C a {text-style: no-underline;}

D a {text-decoration: no-underline;}

B
Links can be styled with any CSS property. This a {text-decoration:none;} removes the underline from all links.

 

 

8. What is the correct syntax of the following CSS code?

A Body:color=black

B {body;color:black}

C {body:color=black(body}

D Body {color: Black}

D
This defines the text color for the “body” element. Anything you apply to the “body” element in CSS will affect the whole page.

 

 
 

9. Which of the following selectors selects all E elements with the attribute Attr that ends with the given value?

A E[attr^=value]

B E[attr$=value]

C E[attr*=value]

D None of the above

B
The selector E[attr$=value] is used to select elements whose attribute value ends with a specified value.

 

 

10. Which of the following selectors selects the checkboxes that is checked or enabled?

A E ~ F

B ::after

C :checked

D None of the above

C
Example : Set the “height” and “width” properties for all checked <input> elements:
  <input type="checkbox"> Lorem Ipsum<br>
  <input type="checkbox"> Lorem Ipsum<br>
  <input type="checkbox" checked="checked"> Lorem Ipsum<br>
  <input type="checkbox"> Lorem Ipsum
input:checked {
  height: 50px;
  width: 50px;
}

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 *