100 Bootstrap MCQ (Multiple Choice Questions) with Answers

1) What is Bootstrap?
  1. A JavaScript framework for database management
  2. A front-end framework for building responsive, mobile-first websites
  3. A backend server-side framework
  4. A Python library for data analysis
Show Answer
Answer: b
Explanation
Bootstrap is a free, open-source front-end framework that provides pre-built HTML, CSS and JavaScript components for creating responsive, mobile-first websites and web apps.

2) Which HTML5 doctype is required for Bootstrap to work properly?
  1. <!DOCTYPE html5>
  2. <!DOCTYPE html>
  3. <!DOCTYPE xhtml>
  4. <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01//EN”>
Show Answer
Answer: b
Explanation
Bootstrap requires the standard HTML5 doctype, written as <!DOCTYPE html>, at the very top of the page. Without it, browsers fall into quirks mode and many Bootstrap styles break.

3) Which meta tag is necessary to ensure proper rendering and touch zooming on mobile devices?
  1. <meta charset=”utf-8″>
  2. <meta name=”viewport” content=”width=device-width, initial-scale=1″>
  3. <meta http-equiv=”X-UA-Compatible” content=”IE=edge”>
  4. <meta name=”mobile-web-app-capable” content=”yes”>
Show Answer
Answer: b
Explanation
The viewport meta tag tells the browser to match the page width to the device width and set the initial zoom level, which is essential for responsive, mobile-first rendering.

4) How many columns are in the default Bootstrap grid system?
  1. 6
  2. 8
  3. 12
  4. 16
Show Answer
Answer: c
Explanation
The Bootstrap grid is built on a 12-column layout, so column classes across a single row should add up to 12.

5) Which class provides a full-width container that spans the entire width of the viewport?
  1. .container
  2. .container-fixed
  3. .container-fluid
  4. .container-full
Show Answer
Answer: c
Explanation
.container-fluid is a full-width container that always spans 100% of the viewport width, whereas .container has a fixed max-width at each breakpoint.

6) Which grid breakpoint class prefix targets medium-sized screens (≥768px in standard Bootstrap)?
  1. .col-sm-
  2. .col-md-
  3. .col-lg-
  4. .col-xl-
Show Answer
Answer: b
Explanation
The .col-md-* classes apply from the medium breakpoint upward (≥768px). sm is ≥576px, lg is ≥992px and xl is ≥1200px.

7) Which class is used to create a flexbox layout row in the Bootstrap grid?
  1. .grid-row
  2. .row
  3. .flex-row
  4. .container-row
Show Answer
Answer: b
Explanation
.row is the flexbox-based wrapper for grid columns. It applies display: flex, negative gutters and flex-wrap so columns can wrap and align.

8) Which class creates a responsive, full-width button block in Bootstrap 5 using flexbox utilities?
  1. .btn-block
  2. .d-grid combined with .btn
  3. .btn-full
  4. .btn-expanded
Show Answer
Answer: b
Explanation
Bootstrap 5 dropped .btn-block. Instead you wrap the button in a grid container: <div class=”d-grid”><button class=”btn btn-primary”>…</button></div>. The .d-grid-gap utility can add spacing.

9) Which class is used to contextualize a button with a primary action color?
  1. .btn-main
  2. .btn-primary
  3. .btn-action
  4. .btn-blue
Show Answer
Answer: b
Explanation
.btn-primary applies the theme’s primary colour (blue by default) to a button, indicating the main or most important action.

10) How do you create an outlined button in Bootstrap?
  1. .btn-border-primary
  2. .btn-outline-primary
  3. .btn-line-primary
  4. .btn-transparent-primary
Show Answer
Answer: b
Explanation
.btn-outline-primary renders a button with a coloured border and text on a transparent background; the colours invert on hover.

11) Which class adds alternating grey background colors to table rows?
  1. .table-striped
  2. .table-zebra
  3. .table-hover
  4. .table-bordered
Show Answer
Answer: a
Explanation
.table-striped applies zebra striping to alternate rows (odd rows by default) for easier horizontal reading. .table-hover only highlights a row on hover.

12) Which wrapper class makes a table scroll horizontally on small screens?
  1. .table-scroll
  2. .table-responsive
  3. .table-mobile
  4. .table-overflow
Show Answer
Answer: b
Explanation
Wrapping a table in <div class=”table-responsive”> makes it scroll horizontally when it is too wide for the screen. Variants such as .table-responsive-md target specific breakpoints.

13) Which Bootstrap class is used to make an image scale responsively with its parent element?
  1. .img-responsive
  2. .img-fluid
  3. .img-scale
  4. .img-auto
Show Answer
Answer: b
Explanation
.img-fluid applies max-width: 100% and height: auto so the image never overflows its parent. (.img-responsive was the Bootstrap 3 name.)

14) Which class rounds an image into a circle?
  1. .img-circle
  2. .rounded-circle
  3. .circle-img
  4. .border-circle
Show Answer
Answer: b
Explanation
.rounded-circle applies border-radius: 50%, turning a square image into a circle. It replaced the older .img-circle class from Bootstrap 3.

15) Which class adds a thin 1px border with rounded corners around an image thumbnail?
  1. .img-thumbnail
  2. .img-border
  3. .thumbnail
  4. .img-card
Show Answer
Answer: a
Explanation
.img-thumbnail gives an image a 1px border, rounded corners and a little padding, producing a classic thumbnail look.

16) Which element/class wrapper is used to group form controls together with labels?
  1. .form-group (Bootstrap 4) / .mb-3 spacing utility (Bootstrap 5)
  2. .form-box
  3. .input-container
  4. .form-row
Show Answer
Answer: a
Explanation
Bootstrap 4 used .form-group to wrap a label and control. Bootstrap 5 removed it and instead relies on spacing utilities such as .mb-3 for the same visual grouping.

17) Which class is applied to <input>, <textarea>, and <select> elements for default Bootstrap styling?
  1. .form-control
  2. .input-field
  3. .form-input
  4. .bootstrap-input
Show Answer
Answer: a
Explanation
.form-control gives text inputs, textareas and selects full width, consistent padding, border radius and focus styling.

18) Which class is used for checkboxes and radio buttons in Bootstrap 5?
  1. .form-check-input
  2. .input-check
  3. .checkbox-inline
  4. .form-option
Show Answer
Answer: a
Explanation
In Bootstrap 5 the input itself uses .form-check-input, wrapped in a .form-check container alongside a .form-check-label.

19) Which utility class sets top padding to 3 units in Bootstrap?
  1. .pt-3
  2. .pad-top-3
  3. .mt-3
  4. .padding-t-3
Show Answer
Answer: a
Explanation
.pt-3 means padding-top with size 3 (1rem by default). The “p” prefix is padding and the second letter gives the side: t, b, s, e, x, y or nothing for all sides.

20) Which utility class sets all-around margin to 4 units?
  1. .m-4
  2. .margin-4
  3. .ma-4
  4. .mg-4
Show Answer
Answer: a
Explanation
.m-4 applies margin: 1.5rem on all four sides. Margin utilities use the “m” prefix followed by an optional side letter and a size from 0 to 5 (plus auto).

21) Which utility class sets bottom margin to 0?
  1. .mb-0
  2. .margin-bottom-0
  3. .pb-0
  4. .no-margin-b
Show Answer
Answer: a
Explanation
.mb-0 sets margin-bottom: 0. Note that .pb-0 would remove bottom padding instead of bottom margin.

22) How do you horizontally center a block-level element with a specified width in Bootstrap?
  1. .text-center
  2. .mx-auto
  3. .align-center
  4. .center-block
Show Answer
Answer: b
Explanation
.mx-auto sets margin-left and margin-right to auto, centering a block element that has a defined width. .text-center only centers inline text.

23) Which class is used to display text in a lighter, muted color?
  1. .text-light
  2. .text-muted (or .text-secondary / .text-opacity-75)
  3. .text-fade
  4. .text-grey
Show Answer
Answer: b
Explanation
.text-muted de-emphasises text. In Bootstrap 5 it maps to a grey colour, and .text-secondary or opacity utilities such as .text-opacity-75 can achieve a similar effect.

24) Which class transforms text to uppercase?
  1. .text-uppercase
  2. .text-upper
  3. .font-uppercase
  4. .capitalize-all
Show Answer
Answer: a
Explanation
.text-uppercase applies text-transform: uppercase. Related utilities are .text-lowercase and .text-capitalize.

25) Which class makes text bold in Bootstrap 5?
  1. .font-weight-bold
  2. .fw-bold
  3. .text-bold
  4. .bold
Show Answer
Answer: b
Explanation
Explanation
Bootstrap 5 renamed the font-weight utilities to the .fw-* form, so bold text uses .fw-bold (or .fw-semibold, .fw-normal, .fw-light).

26) Which class sets text alignment to right (end) in Bootstrap 5?
  1. .text-right
  2. .text-end
  3. .align-right
  4. .float-right
Show Answer
Answer: b
Explanation
Bootstrap 5 switched to logical direction names, so right alignment is .text-end (and left is .text-start). This works correctly in RTL languages too.

27) Which component displays contextual feedback messages for typical user actions?
  1. .alert
  2. .notice
  3. .message
  4. .toast-box
Show Answer
Answer: a
Explanation
The .alert component shows contextual feedback messages such as success, warning, danger or info, and comes in coloured variants like .alert-success.

28) Which class is added to an alert to allow users to close/dismiss it?
  1. .alert-dismissible
  2. .alert-close
  3. .alert-cancel
  4. .alert-removable
Show Answer
Answer: a
Explanation
.alert-dismissible adds extra padding to make room for a close button, which itself uses the classes .btn-close and data-bs-dismiss=”alert”.

29) Which class creates a flexible and extensible content container that includes options for headers, footers, and content?
  1. .panel
  2. .well
  3. .card
  4. .box
Show Answer
Answer: c
Explanation
.card is Bootstrap’s flexible content container. It replaced the old .panel (Bootstrap 3) and .well components and supports headers, bodies, footers and images.

30) Inside a .card component, where does the main text content reside?
  1. .card-content
  2. .card-body
  3. .card-main
  4. .card-section
Show Answer
Answer: b
Explanation
The .card-body holds the card’s main content and applies the standard internal padding. Other parts include .card-header, .card-footer and .card-img-top.

31) Which class creates a collapsible navigation bar header?
  1. .navbar
  2. .nav-header
  3. .navigation-bar
  4. .menu-bar
Show Answer
Answer: a
Explanation
.navbar is the wrapper class for Bootstrap’s responsive navigation header, usually combined with .navbar-expand-* and a colour scheme such as .navbar-dark .bg-dark.

32) Which class expands a navbar on large screens while collapsing it on smaller ones?
  1. .navbar-expand-lg
  2. .navbar-large
  3. .navbar-responsive-lg
  4. .navbar-desktop
Show Answer
Answer: a
Explanation
.navbar-expand-lg keeps the navbar horizontal from the large breakpoint (≥992px) upward and collapses it behind a toggler below that width.

33) What class is used for the brand/logo area inside a navbar?
  1. .navbar-logo
  2. .navbar-brand
  3. .navbar-title
  4. .navbar-header
Show Answer
Answer: b
Explanation
.navbar-brand styles the company, product or project name (or logo) at the start of the navbar and adjusts its size and spacing.

34) What class triggers the mobile menu toggle button for a navbar?
  1. .navbar-toggler
  2. .navbar-btn
  3. .menu-toggle
  4. .nav-hamburger
Show Answer
Answer: a
Explanation
.navbar-toggler is the hamburger button shown on small screens. It uses data-bs-toggle=”collapse” and data-bs-target to show or hide the menu.

35) Which component is used to highlight new or unread items via a small count indicator?
  1. .label
  2. .badge
  3. .tag
  4. .chip
Show Answer
Answer: b
Explanation
.badge renders a small count or status indicator, commonly placed inside buttons, links or list items. It replaced the Bootstrap 3 .label class.

36) Which class turns a list of links into a pagination menu?
  1. .page-nav
  2. .pagination
  3. .page-list
  4. .pager
Show Answer
Answer: b
Explanation
.pagination is applied to a <ul> (or <nav> containing one) to produce a paginated set of page links.

37) Which class is applied to individual <li> items inside a .pagination container?
  1. .page-item
  2. .page-link
  3. .page-node
  4. .pagination-item
Show Answer
Answer: a
Explanation
Each list item gets .page-item, and the anchor inside it gets .page-link. The .active and .disabled classes can be added to the .page-item to mark state.

38) Which component is used to show progress status for a process?
  1. .progress wrapper with .progress-bar child
  2. .meter
  3. .status-bar
  4. .loading-bar
Show Answer
Answer: a
Explanation
A .progress container holds one or more .progress-bar children. The bar’s width (set with an inline style) represents the completed percentage.

39) Which class adds animated stripes to a progress bar?
  1. .progress-bar-animated
  2. .progress-bar-active
  3. .progress-animated
  4. .progress-stripes-move
Show Answer
Answer: a
Explanation
.progress-bar-animated makes the stripes created by .progress-bar-striped scroll from right to left using a CSS animation.

40) Which Bootstrap component renders a dialog box/popup window overlay?
  1. .popup
  2. .modal
  3. .dialog
  4. .overlay-box
Show Answer
Answer: b
Explanation
The .modal component displays a dialog overlay on top of the page. It is built with .modal, .modal-dialog and .modal-content elements and driven by the modal JavaScript plugin.

41) What data attribute is used to open a modal dialog on a button click in Bootstrap 5?
  1. data-toggle=”modal”
  2. data-bs-toggle=”modal”
  3. data-open=”modal”
  4. data-bs-target=”modal”
Show Answer
Answer: b
Explanation
Bootstrap 5 namespaces all data attributes with “bs”, so data-bs-toggle=”modal” replaces the old data-toggle=”modal” from Bootstrap 4.

42) What attribute points to the specific ID of the modal to open in Bootstrap 5?
  1. data-bs-target=”#myModal”
  2. data-target=”#myModal”
  3. href=”#myModal”
  4. data-modal-id=”#myModal”
Show Answer
Answer: a
Explanation
data-bs-target=”#myModal” tells the trigger which modal element to open. In Bootstrap 4 the same attribute was simply data-target.

43) Which component creates a slideshow for cycling through elements like images?
  1. .slideshow
  2. .carousel
  3. .slider
  4. .rotator
Show Answer
Answer: b
Explanation
The .carousel component cycles through slides (images, text or custom markup) with optional controls and indicators, powered by the carousel JavaScript plugin.

44) Which class marks an item as the starting visible slide in a carousel?
  1. .visible
  2. .current
  3. .active
  4. .show
Show Answer
Answer: c
Explanation
Exactly one .carousel-item should carry the .active class so it is displayed first; the plugin then moves .active between items as it cycles.

45) Which component creates accordion-style expanding/collapsing sections?
  1. .accordion
  2. .collapse-group
  3. .expander
  4. .toggle-panel
Show Answer
Answer: a
Explanation
The .accordion component groups collapsible items so only one panel is shown at a time. It uses .accordion-item, .accordion-header, .accordion-button and .accordion-collapse.

46) Which utility class sets display to flex?
  1. .d-flex
  2. .display-flex
  3. .flex
  4. .flexbox
Show Answer
Answer: a
Explanation
.d-flex applies display: flex. Responsive variants such as .d-md-flex change the display value only from a given breakpoint upward.

47) Which utility hides an element on all screen sizes?
  1. .hidden
  2. .d-none
  3. .display-none
  4. .hide
Show Answer
Answer: b
Explanation
.d-none sets display: none at every breakpoint. Bootstrap 5 no longer uses the old .hidden or .hidden-* helper classes.

48) How do you show an element only on medium screens and larger in Bootstrap 5?
  1. .d-none .d-md-block
  2. .show-md
  3. .visible-md
  4. .d-md-only
Show Answer
Answer: a
Explanation
Combine .d-none (hidden by default) with .d-md-block (displayed as a block from the md breakpoint up). This is the standard Bootstrap 5 responsive visibility pattern.

49) Which class adds a subtle drop shadow to an element in Bootstrap?
  1. .shadow-sm
  2. .drop-shadow
  3. .box-shadow
  4. .shadow-light
Show Answer
Answer: a
Explanation
.shadow-sm applies a small, subtle box-shadow. The other options in the set are .shadow (default), .shadow-lg and .shadow-none.

50) Which utility class sets background color to warning (yellow)?
  1. .bg-yellow
  2. .bg-warning
  3. .bg-alert
  4. .background-warning
Show Answer
Answer: b
Explanation
.bg-warning applies the theme’s warning colour (yellow by default). Bootstrap background utilities follow the pattern .bg-{contextual-name}.

51) Which class sets text color to white?
  1. .text-white
  2. .color-white
  3. .text-light-white
  4. .font-white
Show Answer
Answer: a
Explanation
.text-white sets color: #fff. It is often paired with .bg-dark or .bg-primary to keep contrast high.

52) Which utility adds rounded corners to all sides of an element?
  1. .corner-rounded
  2. .rounded
  3. .border-radius
  4. .curve
Show Answer
Answer: b
Explanation
.rounded applies a medium border radius to every corner. Size variants include .rounded-0 through .rounded-5, plus .rounded-circle and .rounded-pill.

53) How do you completely remove rounded corners from an element?
  1. .rounded-0
  2. .no-rounded
  3. .border-square
  4. .rounded-none
Show Answer
Answer: a
Explanation
.rounded-0 sets border-radius: 0 on all corners. Side-specific versions exist too, such as .rounded-top-0 or .rounded-end-0.

54) Which class positions an element as fixed at the top of the viewport?
  1. .sticky-top
  2. .fixed-top
  3. .pin-top
  4. .top-fixed
Show Answer
Answer: b
Explanation
.fixed-top uses position: fixed to pin an element to the top of the viewport, where it stays while the page scrolls. Content underneath may need extra padding.

55) What is the difference between .fixed-top and .sticky-top?
  1. .fixed-top stays fixed at the top always; .sticky-top scrolls with the page until it hits the top edge
  2. They are identical in function
  3. .sticky-top only works on mobile devices
  4. .fixed-top relies on absolute positioning
Show Answer
Answer: a
Explanation
.fixed-top removes the element from the document flow and pins it to the viewport permanently. .sticky-top uses position: sticky, so the element scrolls normally until it reaches the top, then sticks.

56) Which class floats an element to the start (left in LTR) in Bootstrap 5?
  1. .float-left
  2. .float-start
  3. .pull-left
  4. .align-left
Show Answer
Answer: b
Explanation
Bootstrap 5 renamed float utilities to logical directions: .float-start (left in LTR) and .float-end (right in LTR). The old .pull-left was a Bootstrap 3 class.

57) Which class floats an element to the end (right in LTR) in Bootstrap 5?
  1. .float-right
  2. .float-end
  3. .pull-right
  4. .align-right
Show Answer
Answer: b
Explanation
.float-end replaces .float-right from Bootstrap 4 and floats the element to the right in left-to-right layouts.

58) Which class creates a pill-shaped badge?
  1. .badge-pill (Bootstrap 4) / .rounded-pill (Bootstrap 5)
  2. .badge-round
  3. .chip-pill
  4. .pill-badge
Show Answer
Answer: a
Explanation
In Bootstrap 4 a pill badge used .badge-pill. Bootstrap 5 removed that class in favour of the general utility .rounded-pill.

59) Which component creates collapsible sidebar drawers (sliding off-canvas navigation) in Bootstrap 5?
  1. .offcanvas
  2. .drawer
  3. .sidebar-modal
  4. .flyout
Show Answer
Answer: a
Explanation
The .offcanvas component builds a hidden sidebar that slides in from the start, end, top or bottom of the viewport. It is a native Bootstrap 5 component.

60) Which class renders spinning loading indicators?
  1. .spinner-border or .spinner-grow
  2. .loader
  3. .loading-icon
  4. .icon-spin
Show Answer
Answer: a
Explanation
.spinner-border creates a rotating ring, while .spinner-grow creates a pulsing, growing dot. Both are CSS-only and come in colour and size variants.

61) Which JavaScript framework dependency was completely removed in Bootstrap 5?
  1. React
  2. Popper.js
  3. jQuery
  4. Vue
Show Answer
Answer: c
Explanation
Bootstrap 5 dropped the jQuery dependency entirely and rewrote all plugins in vanilla JavaScript. Popper.js is still required for dropdowns, tooltips and popovers.

62) Which third-party positioning engine does Bootstrap rely on for dropdowns, popovers, and tooltips?
  1. Lodash
  2. Popper.js
  3. Axios
  4. Chart.js
Show Answer
Answer: b
Explanation
Popper.js handles the smart positioning of dropdown menus, tooltips and popovers. Bootstrap 5 bundles @popperjs/core with its own JS file.

63) How do you initialize tooltips or popovers in Bootstrap 5?
  1. Automatically by adding HTML attributes
  2. Using custom JavaScript initialization code
  3. CSS-only selectors
  4. By adding the .tooltip-active class
Show Answer
Answer: b
Explanation
For performance and accessibility reasons, tooltips and popovers must be explicitly initialised in JavaScript, for example with new bootstrap.Tooltip(element).

64) Which class creates breadcrumb navigation?
  1. .breadcrumb
  2. .nav-breadcrumb
  3. .page-path
  4. .trail
Show Answer
Answer: a
Explanation
.breadcrumb is applied to an ordered or unordered list to render a breadcrumb trail showing the current page’s position in the site hierarchy.

65) What is the class for a container item within a breadcrumb?
  1. .breadcrumb-item
  2. .breadcrumb-link
  3. .crumb
  4. .breadcrumb-node
Show Answer
Answer: a
Explanation
Each <li> inside a .breadcrumb uses .breadcrumb-item, which automatically inserts the separator between items. Add .active to the current page item.

66) Which class adds a drop-down menu overlay when triggered?
  1. .dropdown-menu
  2. .menu-down
  3. .drop-list
  4. .select-menu
Show Answer
Answer: a
Explanation
.dropdown-menu marks the hidden overlay list of .dropdown-item links that is revealed when the toggle is activated.

67) Which class is placed on the parent wrapper of a dropdown button and menu?
  1. .dropdown
  2. .dropdown-container
  3. .dropdown-wrapper
  4. .select-group
Show Answer
Answer: a
Explanation
The .dropdown wrapper (or .dropup, .dropstart, .dropend) positions the menu relative to the toggle button and is required for the plugin to work correctly.

68) Which class creates a divider line inside a dropdown menu?
  1. .dropdown-divider
  2. .dropdown-line
  3. .dropdown-hr
  4. .menu-separator
Show Answer
Answer: a
Explanation
.dropdown-divider draws a thin horizontal separator between groups of dropdown items.

69) Which class groups a series of buttons together on a single line?
  1. .btn-group
  2. .btn-toolbar
  3. .btn-row
  4. .button-set
Show Answer
Answer: a
Explanation
.btn-group places related buttons side by side, merging adjacent borders and rounding only the outer corners. Add .btn-group-vertical to stack them.

70) Which class combines multiple button groups into a toolbar layout?
  1. .btn-toolbar
  2. .btn-bar
  3. .toolbar-group
  4. .btn-collection
Show Answer
Answer: a
Explanation
.btn-toolbar wraps several .btn-group elements and adds flexbox spacing so the groups sit in a row like an application toolbar.

71) Which component displays floating temporary push notifications?
  1. .toast
  2. .snack-bar
  3. .floating-alert
  4. .push-box
Show Answer
Answer: a
Explanation
The .toast component shows lightweight, temporary notifications. Toasts are opt-in and must be initialised and shown with JavaScript, often inside a toast container.

72) What class is used to make a modal fill the full screen size?
  1. .modal-fullscreen
  2. .modal-full
  3. .modal-max
  4. .modal-screen
Show Answer
Answer: a
Explanation
Add .modal-fullscreen to .modal-dialog for an edge-to-edge modal. Responsive variants such as .modal-fullscreen-md-down target specific breakpoints.

73) Which class centers a modal vertically in the viewport?
  1. .modal-dialog-centered
  2. .modal-center
  3. .modal-middle
  4. .modal-vertical-center
Show Answer
Answer: a
Explanation
Adding .modal-dialog-centered to the .modal-dialog element vertically centres the dialog in the viewport using flexbox alignment.

74) Which class enables smooth scrolling transitions for accordion items?
  1. .accordion-flush (removes borders) / .collapse
  2. .accordion-smooth
  3. .accordion-slide
  4. .accordion-transition
Show Answer
Answer: a
Explanation
The smooth open/close animation comes from the .collapse class and the collapse JavaScript plugin, which animates height. .accordion-flush is a separate modifier that removes the outer borders.

75) Which helper class ratio container creates responsive aspect ratio embeds (e.g., video embeds)?
  1. .ratio (e.g., .ratio-16×9)
  2. .embed-responsive
  3. .aspect-ratio
  4. .video-responsive
Show Answer
Answer: a
Explanation
Wrap the embed in <div class=”ratio ratio-16×9″>. Bootstrap 5 uses the .ratio helper with variants such as .ratio-1×1, .ratio-4×3 and .ratio-21×9, replacing Bootstrap 4’s .embed-responsive.

76) Which utility class sets element opacity?
  1. .opacity-75
  2. .text-opacity
  3. .alpha-75
  4. .translucent-75
Show Answer
Answer: a
Explanation
.opacity-75 applies opacity: 0.75. Bootstrap 5 offers .opacity-0, .opacity-25, .opacity-50, .opacity-75 and .opacity-100. (.text-opacity-* affects only text colour opacity.)

77) How do you set a full 100% height on an element relative to its parent in Bootstrap?
  1. .h-100
  2. .height-100
  3. .h-full
  4. .vh-100
Show Answer
Answer: a
Explanation
.h-100 sets height: 100%, which is relative to the parent’s height. For percentage heights to work, ancestor elements usually need a defined height as well.

78) Which class sets height equal to 100% of the view height (viewport)?
  1. .vh-100
  2. .h-viewport
  3. .h-100vh
  4. .v-height-100
Show Answer
Answer: a
Explanation
.vh-100 sets height: 100vh, sizing the element relative to the viewport height rather than its parent. Bootstrap 5 also provides .min-vh-100 and .vw-100.

79) Which utility class sets width to 100%?
  1. .w-100
  2. .width-100
  3. .w-full
  4. .vw-100
Show Answer
Answer: a
Explanation
.w-100 applies width: 100%. Width utilities follow the .w-{25|50|75|100|auto} pattern, while .vw-100 refers to viewport width instead.

80) Which Flexbox utility aligns flex items along the main axis to the center?
  1. .justify-content-center
  2. .align-items-center
  3. .align-content-center
  4. .flex-center
Show Answer
Answer: a
Explanation
.justify-content-center maps to justify-content: center, which centres items along the main axis (horizontally in a default row).

81) Which Flexbox utility aligns flex items along the cross axis to the center?
  1. .align-items-center
  2. .justify-content-center
  3. .align-self-center
  4. .flex-align-center
Show Answer
Answer: a
Explanation
.align-items-center applies align-items: center on the flex container, centring all children along the cross axis (vertically in a default row).

82) Which class distributes space evenly between flex items along the main axis?
  1. .justify-content-between
  2. .justify-content-around
  3. .justify-content-evenly
  4. .flex-space-between
Show Answer
Answer: a
Explanation
.justify-content-between places the first item at the start and the last at the end, distributing the remaining space equally between the items. .justify-content-around and .justify-content-evenly also add space before and after the outer items.

83) Which utility class orders flex items to appear first?
  1. .order-first
  2. .order-0
  3. .flex-order-1
  4. .order-start
Show Answer
Answer: a
Explanation
Explanation
.order-first sets order: -1, pushing the item to the front of the flex container. It is the counterpart of .order-last (order: 6).

84) What is the smallest default grid breakpoint size defined in Bootstrap 5?
  1. xs (Extra Small, <576px)
  2. sm
  3. xxs
  4. min
Show Answer
Answer: a
Explanation
Bootstrap 5 defines six breakpoints: xs (<576px, no infix), sm (≥576px), md (≥768px), lg (≥992px), xl (≥1200px) and xxl (≥1400px).

85) What is the breakpoint pixel threshold for .col-lg- in Bootstrap 5?
  1. ≥992px
  2. ≥768px
  3. ≥1200px
  4. ≥576px
Show Answer
Answer: a
Explanation
The lg breakpoint starts at 992px. For reference: sm is 576px, md is 768px, xl is 1200px and xxl is 1400px.

86) What new breakpoint was introduced in Bootstrap 5 for extra-extra-large displays?
  1. xxl (≥1400px)
  2. uhd
  3. xlg
  4. super
Show Answer
Answer: a
Explanation
Bootstrap 5 added the xxl breakpoint at 1400px, giving columns such as .col-xxl-6 for very wide screens.

87) What CSS extension preprocessor language is Bootstrap natively built with?
  1. Sass / SCSS
  2. Less
  3. Stylus
  4. PostCSS
Show Answer
Answer: a
Explanation
Bootstrap’s source is written in Sass (.scss files) and compiled to CSS. Bootstrap 4 dropped the earlier Less support in favour of Sass.

88) Which Bootstrap 5 component adds floating label animations to inputs?
  1. .form-floating
  2. .input-floating
  3. .label-animated
  4. .form-animated
Show Answer
Answer: a
Explanation
.form-floating wraps a .form-control and a label so the label starts inside the field and floats up when the field is focused or filled. The input must come before the label in the markup.

89) Which class makes a heading look large and styled as a display title?
  1. .display-1
  2. .heading-1
  3. .title-large
  4. .hero-text
Show Answer
Answer: a
Explanation
The .display-1 through .display-6 classes create large, lighter-weight heading styles ideal for hero sections and landing pages.

90) Which tag/class combination styles block quotes elegantly in Bootstrap?
  1. <blockquote class=”blockquote”>
  2. <quote class=”bootstrap-quote”>
  3. <div class=”quote-box”>
  4. <p class=”quote”>
Show Answer
Answer: a
Explanation
Bootstrap styles block quotes with <blockquote class=”blockquote”>, usually paired with a <footer class=”blockquote-footer”> to credit the source.

91) Which class creates a lead paragraph with slightly larger, lighter text?
  1. .lead
  2. .paragraph-lead
  3. .intro-text
  4. .main-para
Show Answer
Answer: a
Explanation
.lead makes a paragraph stand out with a larger font size and lighter weight — commonly used for an introductory summary under a heading.

92) How do you disable an HTML input button using Bootstrap styling classes and attributes?
  1. Add the disabled attribute along with .disabled class for link anchors
  2. Use .btn-inactive
  3. Use .btn-off
  4. Use .readonly
Show Answer
Answer: a
Explanation
For <button> and <input> elements use the native disabled attribute. For <a> elements, which cannot be disabled natively, add the .disabled class and remove the href or set aria-disabled=”true”.

93) Which utility sets a 1px border around an element?
  1. .border
  2. .border-1
  3. .add-border
  4. .outline-1
Show Answer
Answer: a
Explanation
Explanation
.border adds a 1px solid border on all sides in the current border colour. Combine it with .border-primary and similar classes to set the colour, or .border-2 to change the width.

94) Which utility class removes the top border of an element?
  1. .border-top-0
  2. .no-border-top
  3. .border-t-none
  4. .border-top-none
Show Answer
Answer: a
Explanation
.border-top-0 sets border-top: 0. Side-specific removal utilities exist for every side: .border-end-0, .border-bottom-0 and .border-start-0.

95) Which class sets the border color to contextual success (green)?
  1. .border-success
  2. .border-green
  3. .border-color-success
  4. .success-border
Show Answer
Answer: a
Explanation
.border-success applies the theme’s success colour to an existing border. It must be used together with a border width utility such as .border.

96) Which class makes a table striping dark-themed?
  1. .table-dark
  2. .table-inverse
  3. .table-black
  4. .table-night
Show Answer
Answer: a
Explanation
.table-dark gives a table dark backgrounds with light text; combined with .table-striped it produces dark zebra striping. The old .table-inverse name from Bootstrap 4 alpha was renamed.

97) Which HTML element is typically used to hold accordion content items?
  1. <div class=”accordion-item”>
  2. <section class=”accordion-box”>
  3. <li class=”accordion-node”>
  4. <article class=”accordion-cell”>
Show Answer
Answer: a
Explanation
Each panel in a Bootstrap 5 accordion is a <div class=”accordion-item”>, containing an .accordion-header with an .accordion-button and a collapsible .accordion-collapse body.

98) How do you create an inline form where items sit side-by-side in flex layouts?
  1. Use grid column utilities (.col-auto) or .row-cols-* inside a .row
  2. .form-inline (deprecated in v5 in favor of flex utilities)
  3. .form-horizontal
  4. .input-inline
Show Answer
Answer: a
Explanation
Bootstrap 5 removed .form-inline. Instead, place .col-auto columns inside a .row (optionally with .g-3 for gutters) or apply flex utilities such as .d-flex and .align-items-center directly.

99) Which utility class stops text wrapping and adds an ellipsis on overflow?
  1. .text-truncate
  2. .text-ellipsis
  3. .no-wrap-ellipsis
  4. .overflow-truncate
Show Answer
Answer: a
Explanation
.text-truncate applies overflow: hidden, white-space: nowrap and text-overflow: ellipsis. It works on block or inline-block elements, and on table cells it requires .table with table-layout: fixed.

100) Which utility class forces text wrapping across lines?
  1. .text-wrap
  2. .text-break
  3. .wrap-always
  4. .word-wrap
Show Answer
Answer: a
Explanation
.text-wrap applies white-space: normal, allowing text to wrap naturally. Its counterpart .text-nowrap prevents wrapping, while .text-break wraps long words and breaks URLs.
100 Artificial Intelligence MCQ (Multiple Choice Questions) with Answers
100 JavaScript MCQ (Multiple Choice Questions) with Answers
Studyopedia Editorial Staff
contact@studyopedia.com

We work to create programming tutorials for all.

No Comments

Post A Comment