When you want flex items to stack vertically, you set flex-direction to ________.

  • Column
  • Column-reverse
  • Row
  • Row-reverse
To make flex items stack vertically in a Flexbox container, you set flex-direction to column. This means the items will be arranged one below the other, creating a vertical stack.

You're working on a navigation menu where each list item should be displayed side by side. How would you achieve this using CSS?

  • Using the display: block; property.
  • Using the display: flex; property.
  • Using the display: grid; property.
  • Using the display: inline; property.
To display list items side by side in a navigation menu, you should use the display: flex; property on the parent container of the list. This allows for a horizontal layout of the list items.

The ________ property in CSS specifies how overflows should be handled when the content overflows its block container.

  • overflow
  • overflow-type
  • overflow-x
  • overflow-y
The "overflow" property in CSS is used to specify how overflows should be handled when content overflows its block container. It can take values like "visible," "hidden," "scroll," and "auto" to control the display of content that overflows its container.

In a responsive design, the term ______ is used to describe a layout that adjusts and looks good on all screen sizes.

  • adaptive
  • dynamic
  • fixed
  • fluid
In responsive design, the term "adaptive" describes a layout that adjusts and looks good on all screen sizes and devices. An adaptive design ensures that the content and layout respond effectively to various screen sizes, providing a seamless user experience.

You're designing a button that, when clicked, shows a loading spinner. The spinner should rotate continuously. Which properties are crucial for this effect?

  • animation-duration
    animation-timing-function
    animation-iteration-count
    animation-direction
  • box-shadow
    margin
    border-radius
    display
  • font-size
    color
    line-height
    width
  • transform
    transition
    opacity
    position
To create a loading spinner that rotates continuously, you need to use CSS animations. Key properties for this effect include animation-duration (to control the duration of the animation), animation-timing-function (to specify the timing function for animation), animation-iteration-count (to set it to 'infinite' for continuous rotation), and animation-direction (to make it rotate continuously using 'alternate' or 'normal').

One of the benefits of CSS-in-JS solutions is that they can prevent unused styles, leading to ________.

  • Enhanced SEO
  • Improved performance
  • Increased memory usage
  • Reduced development time
CSS-in-JS solutions, such as styled-components or Emotion, can help prevent unused styles by generating scoped styles at runtime. This means only the styles required for a specific component are injected, leading to improved performance.

You're refactoring a website's CSS and want to separate styles that apply to layout from those that apply to modules. Which methodology would provide guidelines for this type of separation?

  • ITCSS (Inverted Triangle CSS)
  • ACSS (Atomic CSS)
  • RSCSS (Reasonable System for CSS Stylesheet Structure)
  • OOCSS (Object-Oriented CSS)
To separate styles that apply to layout from those that apply to modules, you should consider the ITCSS (Inverted Triangle CSS) methodology. ITCSS offers a scalable and logical structure for your stylesheets, with layers that guide you in distinguishing between core layout styles and module-specific styles, promoting maintainability and organization.

You need to perform different actions on each element of a heterogeneous list (i.e., containing different types of objects). How would you implement the loop to handle different types and perform type-specific actions?

  • Use a custom iterator with type-specific handlers.
  • Use a for-each loop with instanceof checks.
  • Use a series of if statements to check each element's type.
  • Use a switch statement inside a for loop.
To handle different types in a heterogeneous list, you can use a for-each loop and check each element's type using the instanceof operator. This approach allows you to perform type-specific actions. The other options may not be as flexible or efficient for this task.

Imagine you are developing a multi-threaded application for a bank. How would you ensure that when multiple threads are trying to update the same account, the account data remains consistent?

  • Employing optimistic locking techniques such as versioning, where each thread checks a version number before updating the account.
  • Implementing thread-safe data structures like ConcurrentHashMap to store account information.
  • Using synchronized methods or blocks to lock access to the account data when it's being updated.
  • Utilizing atomic operations provided by classes like AtomicInteger to ensure atomic updates of account data.
In a multi-threaded bank application, consistency can be achieved by using synchronized methods or blocks to ensure that only one thread can access and update the account data at a time. This prevents race conditions and data corruption. Other options, like using thread-safe data structures or atomic operations, can help with performance but may not guarantee consistency in complex scenarios. Optimistic locking with versioning can also be used to handle concurrent updates.

Which of the following classes is used to create a button in JavaFX?

  • Button
  • CheckBox
  • Label
  • TextField
In JavaFX, the Button class is used to create a button. Buttons are interactive elements in a graphical user interface, and you can use the Button class to create them and add event handlers. The other classes mentioned are used for different purposes.