50 multiple-choice questions with answers and detailed explanations. Untimed — choose an answer to check it instantly.
0/50 answered0 correct
Question 1 of 50
A web developer wants to group elements of a form together for easier readability. Which HTML5 element should they use to achieve this?
Correct answer: B) <legend>
Explanation: The <fieldset> element groups related elements in a form, making it easier for users to understand and navigate through different sections of the form.
Question 2 of 50
Which CSS property should a developer use if they want an image’s background to scale and fit within the specified content area of its container?
Correct answer: B) padding-box
Explanation: The contain value for the background-size property scales the image to fit within the content area, ensuring that both the width and height remain within the boundaries of the container.
Question 3 of 50
In the CSS box model, which property defines the area directly surrounding the content?
Correct answer: B) Padding
Explanation: In the CSS box model, padding is the space directly surrounding the content, inside the border.
Question 4 of 50
What JavaScript event occurs when a user moves the mouse pointer over an element like a link or an image?
Correct answer: B) mouseOver
Explanation: The mouseOver event is triggered when the user moves their mouse pointer over an element, such as a link or an image.
Question 5 of 50
Which HTML5 form attribute provides a hint to users about the kind of input that should be entered into the form field?
Correct answer: D) placeholder
Explanation: The placeholder attribute offers a hint within the input field, guiding users on the expected input type without enforcing any specific format.
Question 6 of 50
A developer wants to make sure an audio file automatically starts playing as soon as the page loads. Which attribute should they include?
Correct answer: B) autoplay="autoplay"
Explanation: The autoplay attribute causes the audio file to begin playing immediately upon page load without user intervention.
Question 7 of 50
To create a click-to-call feature on a mobile site, which protocol should be used in the href attribute?
Correct answer: B) tel
Explanation: The tel protocol enables users to tap a phone number and initiate a call directly from the mobile browser.
Question 8 of 50
Which CSS3 property would allow a developer to create rounded corners on an element?
Correct answer: B) border-radius
Explanation: The border-radius property creates rounded corners, enhancing the visual style of an element.
Question 9 of 50
A company needs to add an animation that moves an element from one position to another based on a user-triggered event. Which CSS property is most appropriate?
Correct answer: C) transition
Explanation: The transition property animates changes in CSS properties, moving elements based on events like hovering or clicking.
Question 10 of 50
In JavaScript, which method is used to generate a pop-up box that requests a user’s input?
Correct answer: C) prompt()
Explanation: The prompt() method generates a pop-up input box that lets users enter text.
Question 11 of 50
Which attribute should be added to the <input> element to allow users to select multiple files for upload in an HTML5 form?
Correct answer: A) multiple
Explanation: The multiple attribute allows users to select multiple files at once for upload.
Question 12 of 50
A developer needs a responsive layout that dynamically adjusts to fit the screen size. What CSS layout should they use?
Correct answer: C) Liquid layout
Explanation: The liquid layout is flexible and adapts to various screen sizes by using percentage-based widths, ideal for responsive designs.
Question 13 of 50
To select every disabled form field within a document using CSS, which selector should a developer use?
Correct answer: A) element:disabled
Explanation: The :disabled selector targets all disabled elements within a document.
Question 14 of 50
What CSS property keeps floating elements from overlapping with subsequent paragraphs?
Correct answer: C) clear
Explanation: The clear property controls the flow around floating elements, ensuring content does not wrap around them.
Question 15 of 50
If a developer needs to reference external files from a <script> tag, what type of data is “script.js” in src="script.js"?
Correct answer: C) Value
Explanation: In this context, “script.js” is the value assigned to the src attribute of the <script> tag, indicating the file location.
Question 16 of 50
Which HTML5 structural element is used to contain links for navigation within a website?
Correct answer: A) <nav>
Explanation: The <nav> element is specifically designed to contain navigation links for a website’s main sections.
Question 17 of 50
When creating a custom font for a website, which CSS3 rule should be used to specify the font family and source?
Correct answer: B) @font-face
Explanation: The @font-face rule enables the use of custom fonts by specifying the font family and its source location.
Question 18 of 50
If a developer needs to ensure their site is accessible offline, which file must they create?
Correct answer: A) Manifest file
Explanation: A manifest file lists resources that the browser should cache for offline use.
Question 19 of 50
Which CSS property defines the distance between an element’s content and its border?
Correct answer: B) Padding
Explanation: Padding is the space between an element’s content and its border.
Question 20 of 50
A web developer wants to create a 2D transformation that moves an element horizontally by 20px. Which function should they use?
Correct answer: A) translateX(20px)
Explanation: The translateX() function moves an element horizontally by a specified number of pixels.
Question 21 of 50
In HTML5, which attribute of the element is necessary to provide default controls like play, pause, and volume?
Correct answer: C) controls="controls"
Explanation: The controls="controls" attribute on the element adds default playback controls for user interaction.
Question 22 of 50
What is the main purpose of using the HTML5 element in a form?
Correct answer: C) To provide pre-defined options that autocomplete
Explanation: The element provides a list of predefined options for an field, offering autocomplete functionality.
Question 23 of 50
When using JavaScript, which event handler should be used to execute code when the page has fully loaded?
Correct answer: B) load
Explanation: The load event handler executes JavaScript code once the page has completely loaded, ensuring that all resources are available.
Question 24 of 50
Which CSS property would be best for ensuring that an element’s background image scales proportionally to cover the full container?
Correct answer: C) background-size: cover
Explanation: The cover value scales the background image proportionally, covering the entire container without stretching.
Question 25 of 50
In a web document, how does the element function?
Correct answer: C) It holds primary content related to the document's subject
Explanation: The element in HTML5 designates the core content directly associated with the page’s main topic.
Question 26 of 50
Which CSS property allows developers to control the color and style of a border around an element?
Correct answer: D) border
Explanation: The border property in CSS allows control over the color, width, and style of an element’s border.
Question 27 of 50
Which JavaScript method can be used to prompt the user with a yes or no confirmation box?
Correct answer: B) confirm()
Explanation: The confirm() method displays a dialog box with OK and Cancel buttons, returning true for OK and false for Cancel.
Question 28 of 50
In JavaScript, what would be the result of the following expression: 25 + "10"?
Correct answer: C) "2510"
Explanation: JavaScript interprets this as string concatenation since one operand is a string, resulting in "2510".
Question 29 of 50
Which HTML5 API would you use to track a user’s location?
Correct answer: C) Geolocation API
Explanation: The Geolocation API enables location tracking, allowing the browser to retrieve or monitor the user’s current position.
Question 30 of 50
Which HTML5 attribute is used within the tag to bypass form validation?
Correct answer: B) novalidate
Explanation: The novalidate attribute prevents the browser from performing validation on form data before submission.
Question 31 of 50
To add a shadow inside an element’s border, which CSS value should be used with box-shadow?
Correct answer: C) inset
Explanation: The inset value changes the default outward shadow to an inward shadow, creating a recessed effect within the element.
Question 32 of 50
In HTML5, which form element is used for multi-line text input?
Correct answer: C) <textarea>
Explanation: The <textarea> element is designed for multi-line input, unlike <input type="text">, which is for single-line text input.
Question 33 of 50
A developer needs to include a JavaScript library from a third-party source. Which type of service should they use?
Correct answer: A) Content Delivery Network (CDN)
Explanation: A CDN hosts third-party libraries, enabling faster loading times and reducing server load for the website.
Question 34 of 50
Which CSS3 property allows an element’s background to extend only up to its padding?
Correct answer: C) padding-box
Explanation: The padding-box property confines the background to extend up to the element’s padding area, without reaching the border.
Question 35 of 50
Which JavaScript object is used to manage onload, onunload, and onerror events for a web page?
Correct answer: B) Window Object
Explanation: The Window Object handles events related to the page lifecycle, including onload, onunload, and onerror.
Question 36 of 50
To validate an HTML5 form field for an email format, which attribute should be used?
Correct answer: B) type="email"
Explanation: The type="email" attribute ensures the input matches email format requirements, prompting validation if incorrect.
Question 37 of 50
What is the purpose of the CSS text-shadow property?
Correct answer: B) To adjust line height of text
Explanation: The text-shadow property adds shadowing to text, creating visual depth or contrast for the text characters.
Question 38 of 50
Which attribute in JavaScript objects is often used to bind a form label with an associated field?
Correct answer: B) form
Explanation: The for attribute in a tag links it to a specific form field, improving accessibility and usability.
Question 39 of 50
When designing responsive websites, which CSS technique enables the page to adapt to different screen widths?
Correct answer: B) Inline Styles
Explanation: Media Queries allow the application of styles based on screen width, height, and other device characteristics.
Question 40 of 50
Which HTML5 attribute specifies whether a form input field is required before submission?
Correct answer: B) novalidate
Explanation: The required attribute mandates input in the field, ensuring that data is entered before form submission.
Question 41 of 50
A web developer wants to rotate an HTML element in 3D space. Which CSS3 function is appropriate?
Correct answer: B) translate()
Explanation: The rotateX() function rotates elements around the x-axis, giving a 3D rotation effect.
Question 42 of 50
To control the playback rate of an HTML5 video, which attribute should be adjusted?
Correct answer: B) speed
Explanation: The playbackRate attribute adjusts video speed, allowing slower or faster playback in supported browsers.
Question 43 of 50
Which CSS3 property allows a developer to control text wrapping within an element?
Correct answer: B) word-wrap
Explanation: The word-wrap property enables text to break across lines if it exceeds the container’s width.
Question 44 of 50
What CSS property is used to specify where a 3D transformed element is viewed from, affecting the perspective?
Correct answer: B) backface-visibility
Explanation: The perspective property sets the viewpoint distance, determining how much depth the 3D transformation displays.
Question 45 of 50
Which HTML5 element is intended for self-contained content such as a blog post or news story?
Correct answer: B) <article>
Explanation: The <article> element represents self-contained content that could be distributed on its own, such as a post or story.
Question 46 of 50
Which CSS property controls the space between an element's border and its content?
Correct answer: C) padding
Explanation: Padding is the space inside the border, around the content. Margin is the space outside the border.
Question 47 of 50
Which CSS layout module arranges items in a single row or column and distributes space among them?
Correct answer: A) Flexbox
Explanation: Flexbox (display: flex) lays out items along one axis and handles alignment and spacing easily.
Question 48 of 50
Which JavaScript method selects the first element that matches a CSS selector?
Correct answer: D) document.querySelector()
Explanation: querySelector() returns the first element matching the selector. querySelectorAll() returns all matches.
Question 49 of 50
Which HTML attribute provides alternative text for an image, used by screen readers and when the image fails to load?
Correct answer: B) alt
Explanation: The alt attribute describes the image for accessibility and appears if the image cannot be displayed.
Question 50 of 50
What does the CSS media query @media (max-width: 600px) do?
Correct answer: A) Applies the enclosed styles only when the viewport is 600 pixels wide or less
Explanation: Media queries apply styles conditionally. This one targets small screens, which is a key technique in responsive design.
Set 1 complete
You scored 0%
0 correct out of 0 answered (50 questions in this set).