Q
Which jQuery method is used to change the source of an image dynamically?

Answer & Solution

Answer: Option A
Solution:
The .attr() method in jQuery is used to change the attributes of an element, such as the source of an image.
Related Questions on Average

Which CSS unit is commonly used in fluid grid layouts?

A). Pixels

B). Points

C). Percentages

D). Inches

What is the purpose of using $(window).resize() in jQuery?

A). To detect when the window is resized and execute a function

B). To detect mouse clicks

C). To load new content

D). To change the CSS of an element

How can jQuery be used to toggle a navigation menu on small screens?

A). By using .hide() and .show() methods

B). By using .toggleClass() method

C). By using .slideToggle() method

D). By using .fadeIn() method

What does the @media (max-width: 768px) CSS rule indicate?

A). Styles will be applied when the device width is exactly 768px

B). Styles will be applied when the device width is less than or equal to 768px

C). Styles will be applied when the device width is greater than 768px

D). Styles will be applied when the device height is 768px or more

What is the benefit of using smooth scrolling in responsive design?

A). Enhances user experience by providing smoother transitions

B). Increases website load times

C). Prevents users from scrolling

D). Limits the amount of content visible at one time

How can you ensure that text resizes appropriately on different devices?

A). By using fixed font sizes

B). By using relative units like em or rem

C). By using larger font sizes for all elements

D). By limiting text to a certain width

What is the primary purpose of responsive web design?

A). To make websites load faster

B). To make websites compatible with older browsers

C). To ensure websites render well on various devices and screen sizes

D). To reduce the amount of CSS required

What does the $('.menu-toggle').click(function() { $('.menu').slideToggle(); }); code do?

A). Hides the menu permanently

B). Toggles the visibility of the menu with a sliding effect

C). Fixes the menu position

D). Changes the menu color

How does display: none; help in responsive design?

A). It hides elements from the page completely

B). It makes elements visible only on small screens

C). It resizes elements

D). It changes the background color of elements

How does the img { max-width: 100%; } CSS rule help in responsive design?

A). Forces images to a fixed size

B). Ensures images are never larger than their container

C). Prevents images from being displayed

D). Sets a minimum width for all images