AMP

Chapter-3 Web Designing with HTML5 & CSS — Online MCQ Test

INFORMATION TECHNOLOGY · Grade 7 · CBSE(NCERT)
Practice Chapter-3 Web Designing with HTML5 & CSS with a free chapter-wise online MCQ test. This chapter covers: HTML tags - image tag - anchor tag - table tag - attributes - hyperlinks - inline CSS - external CSS - text styling. AI-generated questions from basic to board-exam level, with instant results and explanations.

Start Exam on Full Site →

Chapter-3 Web Designing with HTML5 & CSS — Important Questions & Answers

Which HTML tag is used to insert an image in a web page?
  • A. <img>
  • B. <image>
  • C. <picture>
  • D. <photo>
Answer: A. <img>
The <img> tag is the standard HTML5 tag used to embed images in web pages.
What is the correct syntax for the 'src' attribute in an image tag?
  • A. <img src='image.jpg'>
  • B. <img source='image.jpg'>
  • C. <img href='image.jpg'>
  • D. <img link='image.jpg'>
Answer: A. <img src='image.jpg'>
The 'src' attribute specifies the source path of the image file. 'source', 'href', and 'link' are not valid image tag attributes.
Which HTML tag is used to create hyperlinks in a web page?
  • A. <link>
  • B. <a>
  • C. <href>
  • D. <url>
Answer: B. <a>
The <a> (anchor) tag is used to create hyperlinks. The 'href' attribute inside <a> specifies the destination URL.
What does the 'href' attribute in an anchor tag specify?
  • A. The height of the link
  • B. The destination URL or web page address
  • C. The color of the link
  • D. The font of the link text
Answer: B. The destination URL or web page address
The 'href' attribute stands for 'hypertext reference' and contains the URL that the link should navigate to.
What is the 'alt' attribute in an image tag used for?
  • A. To align the image on the page
  • B. To provide alternative text if the image cannot be loaded
  • C. To change the image color
  • D. To create a link from the image
Answer: B. To provide alternative text if the image cannot be loaded
The 'alt' attribute provides alternate text that is displayed when an image fails to load or for accessibility purposes.
What is the difference between <td> and <th> tags in a table?
  • A. <td> is for headers, <th> is for data cells
  • B. <th> is for header cells, <td> is for regular data cells
  • C. Both are identical and can be used interchangeably
  • D. <td> is for title, <th> is for hyperlink
Answer: B. <th> is for header cells, <td> is for regular data cells
<th> (table header) is used for header cells and is typically bold and centered, while <td> (table data) is used for regular data cells.
A student creates a table with 3 rows and 4 columns. How many <td> tags will be needed in total (excluding <th> tags)?
  • A. 7
  • B. 12
  • C. 3
  • D. 4
Answer: B. 12
Each cell in a table requires one <td> tag. With 3 rows and 4 columns, the total is 3 × 4 = 12 <td> tags.
Consider the code: <a href='page.html' target='_blank' style='color: blue'>Link</a>. What will happen when this link is clicked?
  • A. It will open 'page.html' in the same window with blue text
  • B. It will open 'page.html' in a new tab with blue text
  • C. It will open a new window but the page won't load
  • D. It will change the background color to blue
Answer: B. It will open 'page.html' in a new tab with blue text
The target='_blank' opens the link in a new tab, href='page.html' specifies the destination, and style='color: blue' makes the link text blue.
Consider a scenario where CSS is applied both inline and externally to the same element. Which CSS will take precedence?
  • A. External CSS will always override inline CSS
  • B. Inline CSS will override external CSS due to higher specificity
  • C. The first CSS encountered will take precedence
  • D. Both will be applied equally; browser will choose randomly
Answer: B. Inline CSS will override external CSS due to higher specificity
Inline CSS has higher specificity than external or internal CSS, so inline styles override conflicting external styles in the CSS cascade.
A student writes: <a href='#section2'>Go to Section 2</a> with <h2 id='section2'>Section 2</h2> later on the same page. What happens when the link is clicked?
  • A. The page navigates to 'section2.html' file
  • B. The page scrolls to the element with id='section2'
  • C. Nothing happens because the syntax is incorrect
  • D. The link opens in a new window showing section2
Answer: B. The page scrolls to the element with id='section2'
The hash symbol (#) in href creates an internal page link. #section2 links to the element with id='section2', causing the page to scroll to that location.