









































































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!










































































Question 1. What is the primary purpose of the declaration in an HTML5 document? A) To specify the language B) To define the character encoding C) To ensure proper rendering and standards mode D) To include external stylesheets Answer: C Explanation: The declaration tells the browser to render the page in standards mode, ensuring correct HTML5 interpretation. Question 2. Which element is used to define metadata about an HTML document? A) B) C) D) Answer: A Explanation: The element provides metadata such as character encoding, viewport settings, and page description. Question 3. What does the charset attribute in a tag specify? A) The page title B) The character encoding scheme C) The document’s language D) The stylesheet Answer: B Explanation: charset defines the character encoding (e.g., UTF-8) so that text displays correctly.
Question 4. Which element should be used for grouping navigation links in HTML5? A) B) C) D) Answer: A Explanation: semantically represents navigation links within a web page. Question 5. Which element is best for wrapping the main introductory content of a page? A) B) C) D) Answer: A Explanation: contains introductory content, such as logos and headings. Question 6. How does the element differ from in HTML5? A) is for self-contained content, is for navigation B) is for generic grouping, is for independent, distributable content C) is for footers, is for headers D) They are identical Answer: B Explanation: holds self-contained, distributable content; is for thematic grouping. Question 7. Which HTML element is used to mark up contact information for the author of a document?
A) B) C) D) Answer: A Explanation: highlights text for reference. Question 11. What is the function of the element in HTML5? A) To display a clock B) To encode dates and times in a machine-readable format C) To style text D) To group content Answer: B Explanation: marks up dates and times that can be parsed by search engines. Question 12. Which element is used to group images and their captions in HTML5? A) B) C) D) Answer: A Explanation: groups media and associated captions, typically using . Question 13. What is the role of the element? A) To link to another page
B) To provide a caption for content C) To style images D) To define metadata Answer: B Explanation: provides a description or caption for the content inside . Question 14. Which input type allows users to select a date from a calendar? A) date B) text C) time D) range Answer: A Explanation: The "date" input provides a calendar picker in supported browsers. Question 15. What does the "required" attribute do in an HTML5 form input? A) Restricts input to numbers B) Makes the field mandatory for submission C) Provides autocomplete suggestions D) Validates email format Answer: B Explanation: "required" ensures the user fills out the field before submitting the form. Question 16. Which input type is best for entering a website URL? A) url B) text
D) pattern Answer: A Explanation: "autocomplete" instructs browsers to suggest and autofill input values. Question 20. What is the main difference between GET and POST form submission methods? A) GET is secure, POST is not B) GET appends data to the URL, POST sends data in the request body C) GET is for file uploads, POST is not D) They are identical Answer: B Explanation: GET submits form data as URL parameters, while POST sends data within the request body. Question 21. Which input type is used for slider controls? A) range B) number C) date D) text Answer: A Explanation: The "range" input provides a slider UI for selecting a value within a range. Question 22. What does the element represent in a form? A) Input field B) Calculated result C) Dropdown list D) Submit button
Answer: B Explanation: displays the result of a calculation or script. Question 23. How do you provide multiple sources for a video in HTML5? A) Using multiple elements inside B) Using the srcset attribute C) Using D) Using Answer: A Explanation: Multiple elements within allow for fallback formats. Question 24. Which attribute specifies alternative text for and elements? A) alt B) fallback C) controls D) None Answer: D Explanation: and do not use "alt"; fallback content is placed between the tags. Question 25. The element is used for: A) Subtitles and captions in media B) Playing audio C) Providing metadata D) Embedding images Answer: A
Question 29. Which HTML5 element is used to embed a video file? A) B) C) D) Answer: A Explanation: is specifically designed for embedding video content. Question 30. In HTML5, what is the correct way to specify a fallback message for unsupported video formats? A) Place text or alternative content between and B) Use the alt attribute C) Use D) Use the type attribute Answer: A Explanation: Fallback content is placed between opening and closing tags. Question 31. Which CSS selector matches all elements with a specific class? A) .classname B) #classname C) *classname D) classname Answer: A Explanation: The dot (.) prefix targets elements with the desired class.
Question 32. What does the "descendant selector" in CSS look like? A) parent child B) parent > child C) parent.child D) parent, child Answer: A Explanation: The descendant selector uses a space to select all descendants. Question 33. How does CSS specificity prioritize selectors? A) Inline styles > IDs > Classes > Elements B) Classes > IDs > Elements > Inline styles C) Elements > Classes > IDs > Inline styles D) Inline styles < IDs < Classes < Elements Answer: A Explanation: Specificity is: Inline styles, then IDs, then classes, then elements. Question 34. Which selector targets all elements with a "type" attribute equal to "email"? A) input[type="email"] B) input.email C) #email D) input > email Answer: A Explanation: Attribute selectors target elements by attribute values.
A) Styles are applied only to the last selector B) Styles are applied in order of specificity and source C) CSS is ignored D) Styles are overwritten randomly Answer: B Explanation: Cascade determines which styles apply based on location and specificity. Question 39. Which unit is relative to the viewport width? A) vw B) px C) em D) % Answer: A Explanation: 1vw equals 1% of the viewport width. Question 40. What is the purpose of the viewport meta tag in responsive design? A) To define the HTML version B) To control page scaling and width on mobile devices C) To set the character encoding D) To include external scripts Answer: B Explanation: The viewport meta tag ensures layout scales correctly on various devices. Question 41. How do you write a media query for screens wider than 600px? A) @media (min-width: 600px)
B) @media screen {width:600px;} C) screen-width: 600px D) media: min-width(600px) Answer: A Explanation: This is the correct syntax for a media query targeting widths over 600px. Question 42. Which CSS property makes an image scale to fit its container in responsive design? A) max-width: 100% B) float: left C) position: absolute D) display: block Answer: A Explanation: max-width: 100% ensures images do not overflow their container width. Question 43. What is the main advantage of using CSS Flexbox? A) One-dimensional layout control for alignment and spacing B) Two-dimensional grid creation C) Adding shadows D) Animating elements Answer: A Explanation: Flexbox is designed for aligning and distributing items in one dimension. Question 44. Which property defines the direction of flex items in a flex container? A) flex-direction B) justify-content
D) For simple one-dimensional alignment Answer: A Explanation: Grid is best for complex, two-dimensional layouts. Question 48. Which property in Flexbox aligns items along the main axis? A) justify-content B) align-items C) align-content D) flex-wrap Answer: A Explanation: justify-content distributes space along the main axis. Question 49. What does the CSS "transform: rotate(45deg);" do? A) Rotates an element 45 degrees clockwise B) Scales the element by 45% C) Skews the element D) Moves the element horizontally Answer: A Explanation: rotate(45deg) spins the element 45 degrees. Question 50. Which property enables smooth transitions between CSS states? A) transition B) animation C) transform D) filter
Answer: A Explanation: transition allows property changes to happen gradually. Question 51. What is a keyframe animation in CSS? A) A single transition effect B) A multi-step defined animation sequence C) A background image D) An event handler Answer: B Explanation: Keyframes define stages of an animation’s progress. Question 52. Which pseudo-element styles the first line of a paragraph? A) ::first-line B) :first-child C) ::first-letter D) :hover Answer: A Explanation: ::first-line targets only the first line of text. Question 53. What does the "opacity" property control? A) Element width B) Element transparency C) Element position D) Element color Answer: B
Question 57. Which CSS property sets the space between lines of text? A) line-height B) margin C) padding D) letter-spacing Answer: A Explanation: line-height controls vertical spacing between lines of text. Question 58. What does the "overflow: auto;" property do? A) Hides overflow B) Shows scrollbars if content overflows C) Stretches the content D) Disables scrolling Answer: B Explanation: overflow: auto adds scrollbars when needed. Question 59. Which property is used to make elements float to the left or right? A) float B) position C) clear D) align Answer: A Explanation: float positions elements to the left or right within their container.
Question 60. Which property controls the stacking order of positioned elements? A) z-index B) position C) display D) order Answer: A Explanation: z-index sets the layer order for overlapping elements. Question 61. In JavaScript, which keyword declares a block-scoped variable? A) let B) var C) function D) this Answer: A Explanation: let provides block-level scoping. Question 62. What is the difference between "const" and "let" in JavaScript? A) const variables cannot be reassigned; let variables can B) Both are function-scoped C) let variables cannot be updated D) const variables are global Answer: A Explanation: const is for immutable bindings; let allows reassignment. Question 63. Which data type represents a list of values in JavaScript?