Unit 1 - Practice Quiz

INT219 50 Questions
0 Correct 0 Wrong 50 Left
0/50

1 Which HTML5 element serves as the top-level container for all other elements in an HTML document (excluding the DOCTYPE)?

A. <head>
B. <body>
C. <html>
D. <main>

2 Which of the following lines correctly defines the document type for an HTML5 website?

A. <!DOCTYPE html>
B. <DOCTYPE html5>
C. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 5.0//EN">
D. <html type="html5">

3 What is the primary purpose of semantic HTML elements like <article>, <section>, and <aside>?

A. To automatically style the content with specific colors.
B. To provide meaning to the web page structure for browsers and screen readers.
C. To increase the loading speed of the web page significantly.
D. To replace the <div> tag entirely in all scenarios.

4 Which tag is used to define a set of navigation links?

A. <navigation>
B. <links>
C. <nav>
D. <ul>

5 In the context of the HTML document structure, where should the <meta charset="UTF-8"> tag be placed?

A. Inside the <body> tag.
B. Inside the <html> tag, before <head>.
C. Inside the <head> tag.
D. At the very end of the document.

6 Which attribute is used to associate a <label> with a specific <input> element for accessibility?

A. id
B. for
C. name
D. type

7 Which HTML5 input type automatically validates that the user entered a properly formatted email address?

A. <input type="text">
B. <input type="mail">
C. <input type="email">
D. <input type="submit">

8 To create a dropdown list in a form, which elements are used?

A. <input type="dropdown">
B. <select> and <option>
C. <list> and <item>
D. <form> and <drop>

9 What is the function of the placeholder attribute in an input field?

A. It sets the default value that is submitted with the form.
B. It displays a hint describing the expected value of the input field.
C. It validates the input data against a regular expression.
D. It hides the input characters as asterisks.

10 Which attribute is mandatory for the <img> tag to ensure web accessibility and compliance?

A. title
B. caption
C. alt
D. src (although required for display, this is not the specific accessibility answer)

11 Which HTML5 element is used to embed video content natively without third-party plugins?

A. <media>
B. <movie>
C. <video>
D. <embed>

12 Which file format is a Scalable Vector Graphic, often used for logos and icons because it does not lose quality when resized?

A. JPEG
B. PNG
C. SVG
D. GIF

13 In the <audio> element, what does the controls attribute do?

A. It automatically plays the audio on page load.
B. It displays the browser's default play, pause, and volume controls.
C. It loops the audio continuously.
D. It hides the audio player from view.

14 Which CSS syntax is correct for selecting all paragraph elements?

A. p { }
B. <p> { }
C. #p { }
D. .p { }

15 What is the correct way to link an external CSS file named style.css?

A. <style src="style.css">
B. <link rel="stylesheet" href="style.css">
C. <css file="style.css">
D. <script src="style.css">

16 Which of the following creates a comment in CSS?

A. // This is a comment
B. <!-- This is a comment -->
C. /* This is a comment */
D. # This is a comment

17 In the rule h1 { color: blue; }, what is color referred to as?

A. Selector
B. Property
C. Value
D. Declaration

18 Which selector targets an element with a specific ID attribute, like <div id="header">?

A. .header
B. #header
C. header
D. *header

19 Which selector has the highest specificity?

A. div p
B. .container
C. #main
D. p

20 What does the selector div > p select?

A. All <p> elements inside <div> elements.
B. All <p> elements that are direct children of a <div>.
C. All <div> elements immediately followed by a <p>.
D. All <div> and <p> elements.

21 Which pseudo-class allows you to style an element when a user places their mouse over it?

A. :active
B. :focus
C. :hover
D. :visited

22 Using the Universal Selector *, what happens to the page?

A. It selects only the root element.
B. It selects all elements on the page.
C. It creates a bold font for all text.
D. It is invalid CSS syntax.

23 In the CSS Box Model, what wraps immediately around the content area?

A. Border
B. Margin
C. Padding
D. Outline

24 If an element has width: 100px, padding: 10px, and border: 5px solid black, what is the total rendered width of the element if box-sizing: content-box (default) is used?

A. 100px
B. 115px
C. 130px
D. 110px

25 Which CSS property allows you to include the padding and border in an element's total width and height?

A. box-model: border-box;
B. box-sizing: border-box;
C. display: block-box;
D. width-sizing: include-all;

26 Which component of the Box Model is always transparent and creates space outside the border?

A. Content
B. Padding
C. Margin
D. Border

27 Which shorthand property sets the margin to: Top 10px, Right 5px, Bottom 10px, Left 5px?

A. margin: 10px 5px;
B. margin: 10px 5px 10px;
C. margin: 5px 10px;
D. margin: 10px 10px 5px 5px;

28 What is the default position value for all HTML elements?

A. relative
B. fixed
C. static
D. absolute

29 An element with position: absolute; is positioned relative to:

A. The viewport.
B. The body element always.
C. Its nearest positioned ancestor (non-static).
D. Itself.

30 Which display property value allows an element to sit next to other elements (like text) but still accepts width, height, margin, and padding?

A. block
B. inline
C. inline-block
D. flex

31 Which CSS property controls the stacking order of positioned elements (which element appears on top of another)?

A. stack-order
B. z-index
C. position-index
D. layer

32 What is the difference between display: none and visibility: hidden?

A. There is no difference.
B. display: none reserves space, while visibility: hidden removes it.
C. display: none removes the element from the document flow, while visibility: hidden hides it but keeps its space.
D. visibility: hidden deletes the element from the DOM.

33 To enable Flexbox on a container, which property is used?

A. display: block;
B. display: flex;
C. position: flex;
D. flex-wrap: wrap;

34 In a Flexbox container, which property aligns items along the Main Axis (horizontally by default)?

A. align-items
B. justify-content
C. align-content
D. flex-direction

35 Which Flexbox property allows items to wrap onto multiple lines if they run out of space?

A. flex-wrap: wrap;
B. flex-line: multiple;
C. flex-flow: column;
D. wrap-content: true;

36 In Flexbox, align-items: center; will center items along which axis?

A. The Main Axis
B. The Cross Axis
C. The Z Axis
D. The Y Axis always

37 Which flex property is a shorthand for flex-grow, flex-shrink, and flex-basis?

A. flex-flow
B. flex-group
C. flex
D. flex-all

38 In CSS Grid, which unit represents a fraction of the available free space?

A. %
B. px
C. fr
D. vh

39 Which property is used to define the number and width of columns in a CSS Grid?

A. grid-columns
B. grid-template-columns
C. grid-column-gap
D. display-columns

40 What is the function of the gap property (formerly grid-gap) in CSS Grid?

A. It adds padding inside the grid items.
B. It defines the space between rows and columns.
C. It adds margin around the grid container.
D. It removes borders from grid items.

41 Which of the following is an example of a Media Query used for responsive design?

A. @media (min-width: 768px) { ... }
B. @responsive (width: 768px) { ... }
C. <media query="768">
D. @screen size(768) { ... }

42 What is the "Mobile-First" design approach?

A. Designing the desktop version first, then shrinking it down.
B. Using only px units for widths.
C. Designing styles for mobile devices first, then using min-width media queries for larger screens.
D. Creating a separate website like m.website.com.

43 Which meta tag is essential for responsive web design to ensure the page renders correctly on mobile devices?

A. <meta name="viewport" content="width=device-width, initial-scale=1.0">
B. <meta name="responsive" content="true">
C. <meta name="mobile" content="yes">
D. <meta name="scale" content="fit">

44 What is the difference between rem and em units?

A. em is relative to the root element, rem is relative to the parent.
B. rem is relative to the root element (<html>), em is relative to the current element's font size.
C. rem stands for 'Real Em', em stands for 'Element Em'.
D. They are exactly the same.

45 How do you make an image responsive so it scales with its container but never exceeds its original size?

A. width: 100%; height: auto;
B. max-width: 100%; height: auto;
C. width: auto; height: 100%;
D. object-fit: cover;

46 Which creates a valid CSS Variable (Custom Property)?

A. $main-color: blue;
B. var-main-color: blue;
C. --main-color: blue;
D. %main-color: blue;

47 How do you access the value of a CSS variable named --primary?

A. color: --primary;
B. color: $primary;
C. color: var(--primary);
D. color: get(--primary);

48 Which Git command initializes a new, empty repository in the current directory?

A. git start
B. git create
C. git new
D. git init

49 In Git, after adding files to the staging area, which command saves the changes to the local repository with a message?

A. git save "message"
B. git push "message"
C. git commit -m "message"
D. git add "message"

50 What is the purpose of .gitignore?

A. To list files that Git should track automatically.
B. To store passwords securely.
C. To specify intentionally untracked files that Git should ignore.
D. To ignore errors in the code during compilation.