Which CSS property controls the display of elements as either block or inline?
a) visibility b) float c) display d) position
Correct Answer: c) display
Explanation: The display property controls how an element is rendered, whether as a block-level or inline-level element.
Question 22
Which HTML5 tag is used to define an area inside an image map?
a) <area> b) <map> c) <polygon> d) <img>
Correct Answer: a) <area>
Explanation: The <area> tag defines a clickable area within an image map.
Question 23
Which HTML5 tag defines metadata about an HTML document?
a) <meta> b) <title> c) <link> d) <data>
Correct Answer: a) <meta>
Explanation: The <meta> tag is used to provide metadata such as keywords, author information, and character sets for an HTML document.
Question 24
Which tag is used to insert a line break in HTML?
a) <break> b) <lb> c) <br> d) <hr>
Correct Answer: c) <br>
Explanation: The <br> tag inserts a line break, forcing the text after it to move to a new line.
Question 25
Which HTML5 tag is used to represent user input from a keyboard?
a) <kbd> b) <code> c) <pre> d) <input>
Correct Answer: a) <kbd>
Explanation: The <kbd> tag is used to represent user input from a keyboard, often styled with monospace font.
Question 26
Which CSS property is used to control the order in which elements are stacked when they overlap?
a) z-index b) position c) stack d) layer
Correct Answer: a) z-index
Explanation: The z-index property controls the vertical stacking order of elements, with higher values appearing above lower values.
Question 27
Which HTML attribute defines the default action to be performed by a form upon submission?
a) method b) action c) target d) submit
Correct Answer: b) action
Explanation: The action attribute specifies the URL where form data is sent when the form is submitted.
Question 28
What does the CSS opacity property control?
a) Transparency of the element b) Visibility of the element c) Background color of the element d) Height of the element
Correct Answer: c) <header>
Explanation: The <header> tag defines a header section, which typically contains headings, logos, or navigation elements.
Question 29
Which tag is used to define a header for a section in HTML5?
a) <head> b) <h1> c) <header> d) <title>
Correct Answer: b) background-image
Explanation: The background-image property allows the use of multiple background images by separating the values with commas.
Question 30
What is the purpose of the defer attribute in the <script> tag?
a) To execute the script after the document has been parsed b) To load the script immediately c) To prevent the script from running d) To disable the script for mobile devices
Correct Answer: a) To execute the script after the document has been parsed
Explanation: The defer attribute ensures the script runs after the HTML document is fully parsed, improving page load performance.
Question 31
Which CSS pseudo-class applies styles when a link is being clicked by the user?
a) :hover b) :active c) :focus d) :visited
Correct Answer: b) :active
Explanation: The :active pseudo-class applies styles to a link or element while it is being clicked by the user.
Question 32
What does the autofocus attribute do for a form input element?
a) Applies focus to the input element on page load b) Automatically submits the form c) Highlights the input field d) Clears the input field when clicked
Correct Answer: a) Applies focus to the input element on page load
Explanation: The autofocus attribute automatically focuses the input field when the page is loaded.
Question 33
Which CSS property is used to change the type of cursor displayed when hovering over an element?
a) pointer-events b) cursor c) hover-cursor d) display
Correct Answer: b) cursor
Explanation: The cursor property changes the appearance of the cursor when it hovers over an element.
Question 34
Which tag is used to define a title for an HTML document, displayed in the browser tab?
a) <head> b) <title> c) <meta> d) <caption>
Correct Answer: b) <title>
Explanation: The <title> tag defines the document’s title, which appears in the browser tab or window title bar.
Question 35
Which CSS property controls the order of items in a flex container?
a) order b) flex c) position d) z-index
Correct Answer: a) order
Explanation: The order property specifies the order of flex items within a flex container.
Question 36
What HTML element is used to define a description list?
a) <dl> b) <ol> c) <ul> d) <li>
Correct Answer: a) <dl>
Explanation: The <dl> element defines a description list, with terms and descriptions defined using <dt> and <dd> tags.
Question 37
Which CSS property is used to define the space between the content of an element and its border?
a) margin b) padding c) border d) spacing
Correct Answer: b) padding
Explanation: The padding property defines the space between the element’s content and its border.
Question 38
What does the <progress> element represent in HTML?
a) A gauge b) A progress bar c) A navigation link d) A file upload
Correct Answer: b) A progress bar
Explanation: The <progress> element represents a progress bar, used to show the completion of a task.
Question 39
Which HTML element is used to display bold text without implying importance?
a) <strong> b) <b> c) <em> d) <i>
Correct Answer: b) <b>
Explanation: The <b> tag is used for bold text without adding semantic importance, unlike <strong>.
Question 40
Which CSS property sets the width of an element’s border?
a) border-size b) border-width c) border d) width
Correct Answer: b) border-width
Explanation: The border-width property specifies the thickness of an element’s border.