
































































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. Which component of the internet infrastructure primarily translates domain names into IP addresses? A) Web Browser B) DNS (Domain Name System) C) HTTP Protocol D) Web Server Answer: B Explanation: The DNS translates domain names into IP addresses, enabling browsers to locate servers on the internet using human-readable names. Question 2. Which protocol is most commonly used for secure communication over the web? A) FTP B) HTTP C) HTTPS D) TCP/IP Answer: C Explanation: HTTPS extends HTTP with SSL/TLS encryption, providing secure communication for data transmitted over the web. Question 3. Which element in an HTML document contains metadata such as character encoding, viewport settings, and page description? A) B) C) D) Answer: C Explanation: The element contains metadata, including charset, viewport, description, links to CSS, and scripts. Question 4. What is the purpose of the declaration at the beginning of an HTML document?
A) To specify the HTML version for the browser B) To link to external stylesheets C) To load JavaScript files D) To define the document's language Answer: A Explanation: The declaration informs the browser about the HTML version being used, ensuring proper rendering. Question 5. Which HTML tag is used to define a top-level heading? A) B) C) D) <header> Answer: A Explanation: The <h1> tag defines the most important heading on a page, with subsequent <h2>-<h6> tags for subheadings. Question 6. Which attribute of the <a> tag specifies where to open the linked document? A) href B) target C) rel D) src Answer: B Explanation: The target attribute determines where the link opens; for example, _blank opens in a new tab. Question 7. Which HTML element is used to embed an image? A) <img> B) <picture> C) <figure>
Question 11. Which attribute of the element specifies that the field must be filled out before submitting? A) pattern B) required C) placeholder D) autofocus Answer: B Explanation: The required attribute enforces that the user must fill out the input field before form submission. Question 12. Which semantic HTML5 element is appropriate for defining the main content of a webpage? A) B) C) D) Answer: C Explanation: The element is specifically designed to contain the primary content of the document, improving accessibility and SEO. Question 13. What is the purpose of CSS specificity? A) To determine the order of stylesheet loading B) To decide which CSS rule applies when multiple rules target the same element C) To specify the importance of a rule in @media queries D) To define inline styles only Answer: B Explanation: CSS specificity determines which rule takes precedence when multiple rules target the same element.
Question 14. Which CSS property is used to set the space between the content and the border of an element? A) margin B) padding C) border D) outline Answer: B Explanation: Padding creates space between the content and the element's border, affecting the element's size. Question 15. Which value of display makes an element behave as a block-level element? A) inline B) block C) inline-block D) none Answer: B Explanation: display: block causes the element to behave as a block, occupying full width and starting on a new line. Question 16. Which CSS property is used to control the order of flex items? A) align-items B) justify-content C) order D) flex-wrap Answer: C Explanation: The order property specifies the order in which flex items are laid out within a flex container. Question 17. Which CSS layout module allows for two-dimensional grid-based layout? A) Flexbox
Answer: C Explanation: @keyframes defines the keyframes for CSS animations, specifying the styles at various points during the animation. Question 21. Which JavaScript keyword declares a block-scoped, read-only variable? A) var B) let C) const D) static Answer: C Explanation: const declares a variable with block scope that cannot be reassigned, ensuring immutability for references. Question 22. Which operator in JavaScript compares two values for equality without type coercion? A) == B) === C) != D) !== Answer: B Explanation: === is the strict equality operator, comparing both value and type, avoiding type coercion. Question 23. Which JavaScript control statement executes a block of code based on a condition? A) switch B) if C) for D) function Answer: B Explanation: The if statement executes code when its condition evaluates to true.
Question 24. Which JavaScript method adds an element to the end of an array? A) push() B) pop() C) shift() D) unshift() Answer: A Explanation: push() adds one or more elements to the end of an array. Question 25. How do you select an element with the ID "header" using JavaScript? A) document.querySelector('header') B) document.getElementById('header') C) document.querySelectorAll('#header') D) document.getElementsByClassName('header') Answer: B Explanation: getElementById selects an element based on its ID attribute. Question 26. Which DOM method creates a new element? A) createElement() B) newElement() C) generateElement() D) buildElement() Answer: A Explanation: createElement() creates a new DOM element of specified type. Question 27. Which event type is fired when a user clicks on an element? A) load B) click C) mouseover D) submit
A) z-index B) position C) float D) display Answer: A Explanation: z-index specifies the stack order of positioned elements; higher values are in front. Question 32. Which CSS display value makes an element behave as an inline-level element but allows setting width and height? A) block B) inline C) inline-block D) none Answer: C Explanation: inline-block combines inline layout with block properties like width and height. Question 33. Which CSS pseudo-class applies styles when a user hovers over an element? A) :focus B) :active C) :hover D) :visited Answer: C Explanation: :hover applies styles when the mouse pointer is over an element. Question 34. Which CSS property is used to create a smooth transition effect for property changes? A) transition B) transform C) animation D) keyframes
Answer: A Explanation: transition creates smooth animated effects when CSS property values change. Question 35. Which CSS property is used to define the size of the font? A) font-family B) font-size C) font-weight D) font-style Answer: B Explanation: font-size specifies the size of the font used in text. Question 36. Which HTML element is used to define a section of related content, often with a thematic grouping? A) B) C) D) Answer: B Explanation: is used for thematic grouping of content, often with a heading. Question 37. Which semantic HTML element is ideal for navigation links? A) B) C) D) Answer: A Explanation: indicates a section of navigation links, improving accessibility. Question 38. What is the main benefit of using semantic HTML tags?
Answer: B Explanation: Flexbox is designed for flexible one-dimensional layouts and responsive design. Question 42. Which media query feature targets the width of the device's viewport? A) orientation B) min-width C) max-height D) aspect-ratio Answer: B Explanation: min-width targets viewports with a width equal to or greater than the specified value, useful for responsive design. Question 43. Which CSS property is used to specify the duration of a transition? A) transition-duration B) transition-timing-function C) transition-delay D) transition-property Answer: A Explanation: transition-duration sets how long a transition takes to complete. Question 44. Which JavaScript method is used to fetch data asynchronously? A) fetch() B) get() C) load() D) request() Answer: A Explanation: fetch() is used for making asynchronous HTTP requests to retrieve data from servers. Question 45. Which JavaScript operator is used for the ternary conditional expression?
Answer: A Explanation: The? : operator evaluates a condition and returns one of two values based on its truthiness. Question 46. Which JavaScript method converts a JavaScript object into a JSON string? A) parse() B) stringify() C) serialize() D) convert() Answer: B Explanation: JSON.stringify() converts a JavaScript object into a JSON string for data transmission or storage. Question 47. Which DOM method is used to select all elements matching a CSS selector? A) getElementById B) getElementsByClassName C) querySelectorAll D) getElementsByTagName Answer: C Explanation: querySelectorAll returns a static NodeList of all elements matching a CSS selector. Question 48. Which event is fired when the DOM content has been fully loaded and parsed? A) load B) DOMContentLoaded C) readyStateChange
Question 52. Which CSS property is used to horizontally center block elements with a fixed width? A) margin-left B) text-align C) margin: auto D) align-self Answer: C Explanation: setting margin: auto on left and right centers a block element horizontally within its container. Question 53. Which CSS property is used to control the stacking order of overlapping elements? A) z-index B) position C) float D) display Answer: A Explanation: z-index determines the stack order of positioned elements; higher values appear on top. Question 54. Which CSS pseudo-element is used to style the first letter of a block of text? A) ::first-line B) ::before C) ::first-letter D) ::after Answer: C Explanation: ::first-letter targets and styles the first letter of a block element's text content. Question 55. Which HTML semantic element is appropriate for containing site-wide footer information? A) B)
C) D) Answer: A Explanation: The element contains footer content like copyright, links, or contact info. Question 56. Which CSS property is used to set the background image of an element? A) background B) background-image C) background-src D) image-background Answer: B Explanation: background-image specifies one or more background images for an element. Question 57. Which CSS property is used to specify how content should be positioned in the grid container? A) grid-template-columns B) justify-content C) justify-items D) grid Copy Summarize Delete Question 57. Which CSS property is used to specify how content should be positioned in the grid container? A) grid-template-columns B) justify-content C) justify-items D) grid-area
Question 61. Which CSS property is used to make an element sticky relative to the viewport? A) static B) relative C) absolute D) sticky Answer: D Explanation: position: sticky makes an element stick to a specified position within its parent as the user scrolls. Question 62. Which HTML element is used for defining navigation links? A) B) C) D) Answer: A Explanation: semantically indicates navigation sections, improving accessibility and SEO. Question 63. Which HTML5 element is used to define self-contained content, such as a blog post or news article? A) B) C) D) Answer: B Explanation: represents a self-contained piece of content that can stand independently. Question 64. Which HTML semantic element is suitable for grouping related content, such as a sidebar? A) B)
C) D) Answer: A Explanation: is used for tangentially related content like sidebars or pull quotes. Question 65. Which HTML element is typically used to embed audio content? A) B) C) D) Answer: B Explanation: element embeds sound content with controls and source options. Question 66. Which attribute of the element specifies multiple sources for different formats? A) src B) sources C) tags inside D) media Answer: C Explanation: tags inside specify multiple formats for better browser compatibility. Question 67. Which HTML element is used to embed video content? A) B) C) D) Answer: B Explanation: The element embeds video content with controls and multiple source options.