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
Which HTML5 attribute in the <input> element helps guide users by displaying sample text inside the field without enforcing a specific format?
Correct answer: B) placeholder
Explanation: The placeholder attribute shows sample text inside the input field, hinting at the expected input without validating it.
Question 2 of 50
Which CSS property is responsible for defining the space between an element’s border and adjacent elements?
Correct answer: B) margin
Explanation: The margin property adds space outside an element's border, separating it from neighboring elements.
Question 3 of 50
To create rounded corners on a box in CSS3, which property should a developer use?
Correct answer: B) border-radius
Explanation: The border-radius property enables rounded corners for box elements in CSS.
Question 4 of 50
In JavaScript, which operator is used to combine conditions in a single expression, requiring all conditions to be true for the entire expression to evaluate as true?
Correct answer: B) &&
Explanation: The logical AND (&&) operator combines conditions, returning true only if all conditions are true.
Question 5 of 50
What is the purpose of the CSS text-align property?
Correct answer: D) To align text horizontally
Explanation: The text-align property aligns text within its container horizontally, such as left, center, or right.
Question 6 of 50
Which HTML5 element should be used to group content such as articles, blog posts, or other independent pieces within a document?
Correct answer: B) <article>
Explanation: The <article> element represents self-contained content like articles or blog posts, which can be distributed independently.
Question 7 of 50
In HTML5, which attribute specifies where to display a form’s response after submission?
Correct answer: B) formtarget
Explanation: The formtarget attribute specifies where the server response will be displayed, such as in a new tab or inline.
Question 8 of 50
Which JavaScript data type is used to store a sequence of characters, such as words or sentences?
Correct answer: D) String
Explanation: Strings in JavaScript store sequences of characters, typically used for words or text-based data.
Question 9 of 50
Which CSS property allows developers to set the width and height of an element, including padding and border, so it fits within the defined dimensions?
Correct answer: A) box-sizing
Explanation: box-sizing: border-box includes padding and borders within the element’s specified width and height, ensuring it fits within the layout.
Question 10 of 50
A web developer wants to create an unordered list where the list items do not have bullet points. Which CSS property should they use?
Correct answer: B) list-style-type: none
Explanation: list-style-type: none removes bullet points from unordered lists, creating a cleaner appearance.
Question 11 of 50
To validate an email address in an HTML5 form, which <input> type is recommended?
Correct answer: B) email
Explanation: Using type="email" prompts the browser to check for a valid email format in the input.
Question 12 of 50
In JavaScript, what would typeof null return?
Correct answer: C) "object"
Explanation: Due to a historical error in JavaScript, typeof null incorrectly returns "object" instead of "null."
Question 13 of 50
Which CSS property is used to add a configurable shadow effect behind text characters?
Correct answer: B) text-shadow
Explanation: text-shadow applies a shadow effect to text characters, enhancing text depth and visibility.
Question 14 of 50
Which attribute should be used within the <input> tag to specify the URL where form data will be sent when the form is submitted?
Correct answer: C) formaction
Explanation: The formaction attribute in <input> specifies the URL to which the form data will be sent.
Question 15 of 50
What is the main function of the transform property in CSS3?
Correct answer: B) To apply 2D and 3D transformations
Explanation: The transform property modifies an element's appearance by applying 2D or 3D transformations, such as rotate or scale.
Question 16 of 50
In JavaScript, which keyword is used to declare a block-scoped variable?
Correct answer: C) let
Explanation: let declares a variable with block scope, unlike var, which has function scope.
Question 17 of 50
Which CSS property controls the line spacing within a block of text?
Correct answer: C) line-height
Explanation: The line-height property adjusts the spacing between lines within a text block.
Question 18 of 50
Which <input> attribute should be used to ensure that form data is sent securely over HTTPS?
Correct answer: C) action="https://..."
Explanation: Using an HTTPS URL in the action attribute ensures data is transmitted securely.
Question 19 of 50
In CSS, what does the opacity property control?
Correct answer: C) Transparency level
Explanation: The opacity property controls an element’s transparency, with values ranging from 0 (fully transparent) to 1 (fully opaque).
Question 20 of 50
Which JavaScript method can display content directly within the HTML document while it is loading?
Correct answer: D) document.write()
Explanation: document.write() writes content directly into the HTML document during page load.
Question 21 of 50
What is the purpose of the CSS float property?
Correct answer: B) To position elements side by side
Explanation: The float property positions elements, like images or blocks, to allow text or other content to wrap around them.
Question 22 of 50
Which JavaScript event handler should be used to execute code when a user clicks a form's Reset button?
Correct answer: D) onreset
Explanation: The onreset event handler executes when the form’s Reset button is clicked, clearing the form fields.
Question 23 of 50
What is the role of the display: inline-block property in CSS?
Correct answer: C) To allow block elements to behave like inline elements with width and height
Explanation: display: inline-block gives block elements inline properties while allowing them to set width and height.
Question 24 of 50
In HTML5, which attribute should be used in <button> to specify that form data be submitted using the GET method?
Correct answer: C) formmethod="get"
Explanation: formmethod="get" instructs the browser to submit form data using the GET method.
Question 25 of 50
Which CSS property allows a developer to specify where the text should break within a line?
Correct answer: D) overflow-wrap
Explanation: overflow-wrap allows long words to break and wrap to the next line to prevent overflow.
Question 26 of 50
Which JavaScript object is used to manage the current state of a document and its child elements?
Correct answer: C) DOM
Explanation: The Document Object Model (DOM) manages the structure of a document, allowing access and manipulation of elements.
Question 27 of 50
What does the padding property define in the CSS box model?
Correct answer: D) Space outside the border
Explanation: Padding adds space between the content and the element’s border, inside the border box.
Question 28 of 50
In JavaScript, what type of loop should be used if the number of iterations is unknown and depends on a condition being met?
Correct answer: B) while
Explanation: The while loop continues to execute as long as the specified condition is true, useful for unknown iteration counts.
Question 29 of 50
In HTML5, which <input> type allows users to select from a predefined list of values that appears when typing?
Correct answer: C) datalist
Explanation: The <datalist> element provides an autocomplete dropdown for input fields with predefined options.
Question 30 of 50
Which CSS property should a developer use to apply a shadow to an element's box with customizable blur, spread, and color?
Correct answer: C) box-shadow
Explanation: box-shadow allows developers to add configurable shadows to element boxes, customizing properties like blur, spread, and color.
Question 31 of 50
Which HTML5 element is used to group related content within a form, such as input fields that share a similar purpose?
Correct answer: A) <fieldset>
Explanation: The <fieldset> element groups related form fields, making it easier to organize and read.
Question 32 of 50
In JavaScript, what keyword is used to define a function?
Correct answer: B) function
Explanation: The function keyword declares a function in JavaScript, allowing reusable code blocks.
Question 33 of 50
Which attribute in <input> fields requires the user to enter a value before form submission?
Correct answer: C) required
Explanation: The required attribute mandates user input in a form field, enforcing validation before submission.
Question 34 of 50
What does the :hover pseudo-class do in CSS?
Correct answer: B) Styles elements when a user hovers over them
Explanation: The :hover pseudo-class applies styles to elements when a user places their cursor over them, enhancing interactivity.
Question 35 of 50
In HTML5, which element represents a caption for the items in a <fieldset> group?
Correct answer: B) <legend>
Explanation: The <legend> element provides a caption for grouped items within a <fieldset>, enhancing accessibility.
Question 36 of 50
Which CSS property defines the spacing between individual letters in a word?
Correct answer: C) letter-spacing
Explanation: letter-spacing controls the space between characters in a word, affecting readability and style.
Question 37 of 50
What is the purpose of the readonly attribute in an HTML <input> field?
Correct answer: B) To prevent user modifications
Explanation: The readonly attribute prevents users from changing the input value, keeping it static in forms.
Question 38 of 50
In JavaScript, which loop always executes at least once, regardless of the initial condition?
Correct answer: B) do-while
Explanation: The do-while loop executes its code block at least once before checking the condition.
Question 39 of 50
What does the font-style property control in CSS?
Correct answer: D) Font style, such as italic
Explanation: font-style adjusts the appearance of text, typically allowing values like normal, italic, and oblique.
Question 40 of 50
In HTML5, which input type allows users to enter a time without specifying a time zone?
Correct answer: B) time
Explanation: The time input type enables users to input a specific time without including a time zone.
Question 41 of 50
In CSS3, which property allows an element to maintain a consistent position relative to the screen when scrolling?
Correct answer: C) position: fixed
Explanation: position: fixed keeps an element fixed in relation to the viewport, so it remains visible even when the page is scrolled.
Question 42 of 50
Which HTML5 element defines a section that contains introductory or navigational content at the top of the page or section?
Correct answer: B) <header>
Explanation: The <header> element is intended for introductory content or navigational elements at the start of a webpage or section.
Question 43 of 50
Which JavaScript method retrieves the name of a browser or user agent?
Correct answer: B) navigator.userAgent
Explanation: navigator.userAgent provides the name and details of the user’s browser or user agent.
Question 44 of 50
What is the purpose of the HTML5 <output> element?
Correct answer: C) To display calculation results
Explanation: The <output> element displays results from calculations or other processed data within a form.
Question 45 of 50
In CSS, which property is used to control whether a text element has a line running through it, under it, or over it?
Correct answer: A) text-decoration
Explanation: text-decoration controls styles like underline, line-through, and overline on text elements.
Question 46 of 50
In JavaScript, which function converts a string to a floating-point number?
Correct answer: C) parseFloat()
Explanation: parseFloat() converts strings to floating-point numbers, making it useful for numerical calculations.
Question 47 of 50
Which HTML5 element is used to represent a part of the document that is self-contained and potentially distributable, such as a blog post or news article?
Correct answer: C) <article>
Explanation: The <article> element is designed for independent, self-contained content like blog posts, news articles, and other distributable content.
Question 48 of 50
Which CSS3 property is used to add a shadow around the border of an element?
Correct answer: B) box-shadow
Explanation: box-shadow adds shadows around an element's border, allowing customization of color, offset, blur, and spread.
Question 49 of 50
What attribute of the <label> tag associates it with a specific form field, enhancing accessibility?
Correct answer: B) for
Explanation: The for attribute in <label> links it to a specific form field, making the label accessible and clickable.
Question 50 of 50
Which JavaScript method is used to repeatedly execute code at specified intervals until it is stopped?
Correct answer: C) setInterval()
Explanation: setInterval() runs code at set intervals until stopped, allowing for repeated execution, such as refreshing data periodically.
Set 3 complete
You scored 0%
0 correct out of 0 answered (50 questions in this set).