



















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




















HTML Fundamentals
(1) Which HTML tag is used to define the root element of an HTML document? a) b) c) d)
✅ Correct Answer: b) is the container that wraps all content on the page and serves as the root element. holds metadata, contains visible content, and represents the dominant content of a document.
(2) What is the correct doctype declaration for HTML5? a) b) c) d)
✅ Correct Answer: b) This case-insensitive declaration is the standard for HTML5 and triggers browsers’ standards mode.
(3) Which tag creates an ordered (numbered) list? a) b) c) d)
✅ Correct Answer: b) produces a numbered list. gives an unordered (bulleted) list, defines a list item, and is a description list.
(4) How do you make an field mandatory before submission? a) required="true" b) required c) mandatory d) validate
✅ Correct Answer: b) required The required boolean attribute (introduced in HTML5) prevents form submission if the field is left empty.
(5) Which symbol is used for a single-line comment in JavaScript? a) d) # comment
✅ Correct Answer: c) HTML comments use the syntax. Comments are not displayed in the browser but can help document your HTML code. The other syntaxes are used for JavaScript or CSS comments.
(8) Which tag defines the title that appears in the browser tab? a) b) c) <h1> d) <caption>
c) d)
✅ Correct Answer: b) HTML5 introduced the color input type, which provides a native color selection interface in supporting browsers. This allows users to choose a color using a color picker widget.
(13) Which element is used to embed video content in HTML5? a) b) c) d)
✅ Correct Answer: c) The element is used to embed video content in HTML5 documents. It supports various video formats and includes attributes like controls, autoplay, and loop for controlling playback.
(14) What is the purpose of the element in HTML forms? a) To style form elements b) To validate form inputs c) To associate text with form controls d) To submit form data
✅ Correct Answer: c) To associate text with form controls The element associates descriptive text with form controls, improving accessibility. When a label is clicked, it focuses the associated form control. The association can be made using the for attribute or by nesting the form control inside the tag.
(15) Which HTML attribute is used to specify the URL of a linked resource? a) src b) href c) link d) url
✅ Correct Answer: b) href The href (hypertext reference) attribute specifies the destination URL for hyperlinks created with the tag. The src attribute is used for embedded resources like images (), scripts ( b) Page header information c) Sidebar or tangentially related content d) Footer information
✅ Correct Answer: c) Sidebar or tangentially related content is a semantic HTML5 element that contains content indirectly related to the main content, such as sidebars, pull quotes, or advertising blocks. It should not contain content that is essential to understanding the main content.
(17) Which input type is used for selecting multiple files in HTML5? a) b) c) d)
✅ Correct Answer: b) The multiple boolean attribute allows users to select multiple files when using the file input type. This attribute can be used with to enable multiple file selection from the file picker.
(18) What is the correct syntax for a self-closing tag in HTML5? a) b) c) d) Both b and c are correct
✅ Correct Answer: d) Both b and c are correct In HTML5, void elements (like , , ) can be written either with or without the closing slash. Both and are valid in HTML5, though the slash is more common in XML and XHTML documents.
(19) Which HTML tag is used to create a numbered list? a) b) c) d)
✅ Correct Answer: b) stands for ordered list and creates a numbered list. Each list item is defined with . creates an unordered (bulleted) list, and creates a description list.
(24) What is the function of the tag? a) It contains the main visible content b) It contains metadata, links to stylesheets, and the document title c) It defines the main heading d) It creates a navigation menu
✅ Correct Answer: b) It contains metadata, links to stylesheets, and the document title The element is a container for metadata that is not displayed on the page. It can include the document title, character set declarations, links to external resources (like CSS), and other information that helps browsers render the page correctly.
(25) Which tag is used to create a line break in HTML? a) b) c) d)
✅ Correct Answer: c) The tag creates a line break without starting a new paragraph. It is a void element, meaning it has no closing tag. Multiple tags can be used to create extra spacing between lines of text.
(26) Which HTML tag is used to display preformatted text? a) b) c) d)
✅ Correct Answer: b) The tag displays preformatted text exactly as it appears in the HTML source, preserving spaces and line breaks. It is commonly used to show code snippets or other text where whitespace formatting is important.
(27) What is the difference between block-level and inline elements? a) Block-level elements start on a new line; inline elements do not b) Inline elements start on a new line; block-level elements do not c) Block-level elements cannot contain other elements d) Inline elements can contain block-level elements
✅ Correct Answer: a) Block-level elements start on a new line; inline elements do not Block-level elements always start on a new line and take up the full width available, while inline elements flow within the same line and only take up as much width as necessary. Examples of
block-level elements include ,, and
. Examples of inline elements include , , and .(28) Which HTML element is used to define a paragraph? a) b)
c) d)
✅ Correct Answer: b)
The
tag defines a paragraph. Browsers automatically add some margin before and after each
element to separate paragraphs. It is one of the most commonly used elements in HTML.
(29) Which element is used to define the most important heading (largest)? a) b) c) d)
✅ Correct Answer: c) defines the most important heading, typically the main title of a page. Heading levels range from (most important, largest) to (least important, smallest). Only one should be used per page for semantic and accessibility reasons.
(30) Which tag is used to insert an image in HTML? a) b) c) d)
✅ Correct Answer: a) The tag embeds an image in an HTML page. It requires the src attribute (specifying the image URL) and the alt attribute (providing alternative text for accessibility). The tag is a void element, meaning it has no closing tag.
(31) What does the element do in HTML5? a) Build interactive forms b) Create interactive multimedia c) Draw graphics, on the fly, via JavaScript d) Insert a map on a page
(35) Which CSS selector targets an element with id="main"? a) .main b) #main c) main d) *main✅ Correct Answer: b) #main In CSS, # selects an element by its id attribute. The. is used for class selection, while the element name (like main) selects all elements of that type. IDs must be unique on a page.
(36) Which CSS property is used to control the spacing between lines of text? a) letter-spacing b) word-spacing c) line-height d) text-spacing
✅ Correct Answer: c) line-height line-height specifies the height of a line box, effectively controlling the vertical space between lines of text. letter-spacing adjusts space between characters, and word-spacing adjusts space between words.
(37) What does the CSS property display: none do? a) Makes element transparent b) Hides element but keeps its space c) Completely removes element from layout d) Makes element invisible but interactive
✅ Correct Answer: c) Completely removes element from layout display: none removes the element from the document layout entirely, as if it were not in the HTML. The element is not rendered and does not occupy any space. This differs from visibility: hidden, which hides the element but preserves its space in the layout.
(38) Which CSS property would you use to change the background color of an element? a) color b) bgcolor c) background-color d) background
✅ Correct Answer: c) background-color background-color sets the background color of an element. The background shorthand property can also set the background color along with other background properties. bgcolor is an obsolete HTML attribute, not a CSS property.
(39) What is the purpose of CSS? a) Data storage b) Simplifies the definition of styles in web pages c) Allows commerce on the Web d) Replacement for HTML
✅ Correct Answer: b) Simplifies the definition of styles in web pages CSS (Cascading Style Sheets) is a style sheet language that describes the presentation of a document written in HTML. It controls layout, colors, fonts, and other visual aspects. CSS separates content from presentation, making it easier to maintain and update web pages.
(40) Which CSS property creates rounded corners? a) corner-radius b) border-radius c) round-corners d) border-rounded
✅ Correct Answer: b) border-radius border-radius is a CSS property that rounds the corners of an element's outer border edge. It can take one to four values to create elliptical or circular corners. This property is widely supported in modern browsers and is often used to create buttons, cards, and containers with rounded corners.
(41) Which CSS selector selects all elements with the class "container"? a) #container b) .container c) container d) *container
✅ Correct Answer: b) .container The dot (.) prefix selects elements by class name. Classes can be applied to multiple elements on a page, making them reusable for styling. The ID selector (#) is used for unique identifiers.
(42) What does the float property do in CSS? a) Makes an element fly across the screen b) Positions an element to the left or right of its container c) Animates an element d) Centers an element
✅ Correct Answer: b) Positions an element to the left or right of its container The float property places an element on the left or right side of its container, allowing text and inline elements to wrap around it. It was commonly used for layouts before modern techniques like Flexbox and Grid became widespread.
✅ Correct Answer: b) The concept that every element is wrapped in a box containing content, padding, border, and margin The CSS box model is a fundamental concept describing how elements are structured. Every element has a content area, optional padding, an optional border, and an optional margin. Understanding the box model is essential for controlling layout and spacing in web pages.
(47) Which CSS property is used to center text horizontally? a) align: center b) text-align: center c) center: text d) align-text: center
✅ Correct Answer: b) text-align: center text-align: center centers inline content horizontally within its parent container. It applies to text, images, and other inline elements. To center block-level elements, you typically use margin: auto together with a defined width.
(48) How do you apply CSS directly to a specific HTML element in the HTML code? a) External stylesheet b) Internal stylesheet using b) Margin is inside the border; padding is outside the border c) Margin and padding are the same d) Margin is only for block elements; padding is for inline elements
✅ Correct Answer: a) Margin is outside the border; padding is inside the border Margin creates space outside the element's border, pushing other elements away. Padding creates space inside the border, pushing the content away from the border. Both can be set on all four sides of an element.
(51) Which CSS property is used to add a shadow to text? a) shadow b) text-shadow c) box-shadow d) text-effect
✅ Correct Answer: b) text-shadow text-shadow adds shadow effects to text. It accepts values for horizontal offset, vertical offset, blur radius, and color. box-shadow adds shadow effects to the element's box (container).
(52) What is the z-index property used for? a) Sorting elements alphabetically b) Specifying the stack order of positioned elements c) Setting the zoom level of an element d) Defining the depth of 3D elements
✅ Correct Answer: b) Specifying the stack order of positioned elements The z-index property determines the stacking order of positioned (non-static) elements. Elements with a higher z-index appear above those with a lower one. This property is essential for controlling overlapping elements like modals, dropdown menus, and tooltips.
(53) Which CSS property is used to change the font family of text? a) font b) font-family c) typeface d) text-font
✅ Correct Answer: b) font-family font-family specifies a prioritized list of font family names for an element. The browser uses the first available font in the list. Common values include Arial, Times New Roman, and generic families like sans- serif and serif.
applications, allowing developers to respond to user events, manipulate the DOM, communicate with servers, and create dynamic content without reloading the page.
(58) In JavaScript, which symbol is used for a single-line comment? a) ✅ Correct Answer: a) function myFunction() Functions in JavaScript can be created using the function keyword, followed by the function name, parentheses for parameters, and curly braces for the function body. JavaScript also supports function expressions and arrow functions (e.g., const myFunction = () => {}).
(62) What does the document.getElementById() method do? a) Retrieves all elements with the specified class name b) Returns the element with the specified id attribute c) Changes the document's title d) Deletes an element from the page
✅ Correct Answer: b) Returns the element with the specified id attribute document.getElementById() is a DOM method that returns a reference to the element whose id matches the provided string. If no matching element is found, it returns null. It is one of the most commonly used methods for accessing specific elements in the DOM.
(63) Which JavaScript method is used to write output to the web page? a) console.log() b) document.write() c) alert() d) window.print()
✅ Correct Answer: b) document.write() document.write() writes HTML expressions or JavaScript code directly to the document. However, it is generally discouraged in modern development because it can overwrite the document if called after the page has loaded. console.log() is used for debugging, alert() displays a dialog box, and window.print() opens the print dialog.
(64) Which event occurs when a user clicks on an HTML element? a) onmouseover b) onclick c) onchange d) onfocus
✅ Correct Answer: b) onclick The onclick event triggers when the user clicks on an element. It is one of the most commonly used mouse events in JavaScript. Other mouse events include onmouseover (hover) and onmouseout (move away).
(65) How do you declare a JavaScript variable? a) var x = 5;
(69) What method is used to add an element at the end of an array? a) push() b) pop() c) shift() d) unshift()
✅ Correct Answer: a) push() push() adds one or more elements to the end of an array and returns the new length of the array. pop() removes the last element, shift() removes the first element, and unshift() adds one or more elements to the beginning.
(70) How do you round the number 5.7 to the nearest integer in JavaScript? a) Math.rnd(5.7) b) Math.round(5.7) c) round(5.7) d) Math.floor(5.7)
✅ Correct Answer: b) Math.round(5.7) Math.round() returns the value of a number rounded to the nearest integer. Math.floor() rounds down (5), Math.ceil() rounds up (6), and Math.rnd() is not a valid method. JavaScript provides a variety of Math object methods for mathematical operations.
Web Development Concepts & Accessible Design
(71) What does HTML stand for? a) Hyper Text Markup Language b) High Tech Modern Language c) Home Tool Markup Language d) Hyper Transfer Markup Language
✅ Correct Answer: a) Hyper Text Markup Language HTML (Hypertext Markup Language) is the standard markup language for creating web pages and web applications. It describes the structure of a web page semantically and originally included cues for the appearance of the document.
(72) What is the function of a markup language? a) To execute complex mathematical functions b) To annotate text and embed tags in accurately styled electronic documents c) To connect to databases d) To store large amounts of data
✅ Correct Answer: b) To annotate text and embed tags in accurately styled electronic documents Markup languages are systems for annotating text so that the annotations are syntactically distinguishable from the text. They define how text should be structured, formatted, or displayed. HTML is the most well-known markup language for web pages.
(73) What is the W3C? a) World Wide Web Consortium b) Web Widget Control c) Western Governance Council d) Worldwide Communications Center
✅ Correct Answer: a) World Wide Web Consortium The W3C is the main international standards organization for the World Wide Web. It develops open standards to ensure the long-term growth of the Web, including protocols, guidelines, and formats like HTML, CSS, and XML.
(74) What is the latest version of HTML? a) HTML 4. b) HTML 5 c) HTML X d) HTML 6
✅ Correct Answer: b) HTML 5 HTML5 is the latest major version of HTML, finalized in 2014. It introduced many new features including semantic elements (, , , ), multimedia support ( and ), canvas for graphics, and new form input types.
(75) What does CSS stand for? a) Creative Style Sheets b) Cascading Style Sheets c) Computer Styling System d) Colorful Style Sheets
✅ Correct Answer: b) Cascading Style Sheets CSS is a style sheet language used to describe the presentation of a document written in HTML or XML. The term "cascading" refers to the hierarchy of rules that determine which style takes precedence when multiple rules apply to the same element.
(76) What is the purpose of the W3C Markup Validation Service? a) To compile HTML code b) To check the validity of web documents