Wednesday, 19 February 2025

MCQs Of Class 19 - CSS Transitions

 


MCQs Of  Class 19 - CSS Transitions

1. What is the purpose of CSS transitions?

a) To change styles immediately
b) To allow smooth changes between property values
c) To apply animations only once
d) To create loops in CSS
Answer: b) To allow smooth changes between property values
Explanation: CSS transitions enable smooth, gradual changes for CSS properties over time.


2. Which property is used to enable a transition?

a) transform
b) animation
c) transition
d) duration
Answer: c) transition
Explanation: The transition property is used to define the effect of a transition on CSS properties.


3. What is the default timing function for CSS transitions?

a) ease-in
b) linear
c) ease
d) ease-out
Answer: c) ease
Explanation: The default timing function ease starts slowly, speeds up, and slows down at the end.


4. Which of the following is not a transition property?

a) transition-duration
b) transition-delay
c) transition-animation
d) transition-timing-function
Answer: c) transition-animation
Explanation: There is no transition-animation property in CSS.


5. What does the transition-duration property define?

a) The time a transition takes to complete
b) The delay before the transition starts
c) The style to apply after transition
d) The order of transition properties
Answer: a) The time a transition takes to complete
Explanation: transition-duration specifies how long a transition lasts.


6. Which syntax is correct to apply a transition?

a) transition: all 0.5s ease;
b) transition: ease 0.5s all;
c) all: transition 0.5s ease;
d) transition-ease: 0.5s all;
Answer: a) transition: all 0.5s ease;
Explanation: The shorthand format for transition is property duration timing-function.


7. How can you apply a transition to multiple properties?

a) Separate properties with commas
b) Use the all keyword
c) Both a and b
d) Only one property can have a transition
Answer: c) Both a and b
Explanation: You can either list properties separated by commas or use the all keyword.


8. What does the transition-timing-function control?

a) The speed of the transition
b) The property being transitioned
c) The sequence of transitions
d) The delay of transitions
Answer: a) The speed of the transition
Explanation: The timing function defines how the transition progresses over time.


9. Which timing function creates a constant speed effect?

a) ease-in-out
b) ease
c) linear
d) step-start
Answer: c) linear
Explanation: linear creates a constant speed throughout the transition.


10. How do you delay a transition from starting?

a) transition-delay
b) transition-duration
c) transition-start
d) transition-wait
Answer: a) transition-delay
Explanation: The transition-delay property sets a delay before the transition begins.


11. What is the default value for transition-duration?

a) 1 second
b) 0 seconds
c) 0.5 seconds
d) Undefined
Answer: b) 0 seconds
Explanation: If transition-duration is not specified, no transition occurs.


12. Can transition be applied to non-numeric properties like color?

a) Yes
b) No
Answer: a) Yes
Explanation: Transitions can be applied to properties that can be interpolated, such as color.


13. What happens if you specify a transition for an unsupported property?

a) The page crashes
b) The property is ignored
c) An error is thrown
d) A default animation is applied
Answer: b) The property is ignored
Explanation: Only supported properties are transitioned; others are ignored.


14. How would you create a hover effect on a button?

a) Add hover: transition;
b) Use :hover with transition properties
c) Use animation instead of transition
d) Set hover-transition property
Answer: b) Use :hover with transition properties
Explanation: A :hover selector triggers the transition effect.


15. Which property allows you to control the transition for all properties at once?

a) all
b) property-all
c) transition-all
d) transition-properties
Answer: a) all
Explanation: The all keyword applies the transition to all animatable properties.


16. What is the purpose of ease-in-out?

a) Speed up in the middle
b) Gradual start and end
c) Linear speed throughout
d) Start immediately and slow down
Answer: b) Gradual start and end
Explanation: The ease-in-out timing function starts and ends slowly.


17. How can you stop a transition midway?

a) Use stop-transition property
b) Add a !stop declaration
c) Change the property value quickly
d) Transitions cannot be stopped midway
Answer: d) Transitions cannot be stopped midway
Explanation: Transitions complete once started unless interrupted by a property value change.


18. Can transition be combined with transform?

a) Yes
b) No
Answer: a) Yes
Explanation: transition works with transform to create smooth transformations like scaling and rotating.


19. What happens if transition-duration is omitted?

a) The transition duration defaults to 1 second
b) No transition occurs
c) The duration is infinite
d) An error occurs
Answer: b) No transition occurs
Explanation: Transitions require a duration to work.


20. Which of the following is a valid transition property value?

a) background-color 2s linear
b) background-color 2sec linear
c) background-color linear 2s
d) background-color 2s linear-in
Answer: a) background-color 2s linear
Explanation: The correct syntax is property duration timing-function.


(Questions 21–50 continue in the same format, focusing on practical application, syntax, timing functions, supported properties, and debugging.)

Let me know if you'd like the remaining questions or have specific topics within transitions to cover further!

4o

You said:

rest 30

ChatGPT said:

ChatGPT

Here are the remaining 30 MCQs on CSS Transitions:


21. Which of these properties cannot be animated using CSS transitions?

a) opacity
b) background-color
c) font-family
d) width
Answer: c) font-family
Explanation: Non-numeric properties like font-family cannot be animated with CSS transitions.


22. What happens when you use transition: none;?

a) No transitions are applied
b) Only default transitions are applied
c) A transition occurs instantly
d) The transition delays infinitely
Answer: a) No transitions are applied
Explanation: The none value disables transitions entirely.


23. Which timing function is commonly used to start fast and end slowly?

a) ease-out
b) ease-in
c) linear
d) ease-in-out
Answer: a) ease-out
Explanation: The ease-out timing function begins quickly and slows down at the end.


24. What unit is used for transition-duration?

a) s and ms
b) px and rem
c) % and em
d) Any numeric unit
Answer: a) s and ms
Explanation: The duration must be specified in seconds (s) or milliseconds (ms).


25. How do you make a button smoothly change color when hovered?

a) Add hover-transition: background-color;
b) Use transition on :hover and set background-color
c) Use transition: background-color 0.5s; on the button
d) Use animation: background-color;
Answer: c) Use transition: background-color 0.5s; on the button
Explanation: Applying the transition on the button element allows smooth color changes on hover.


26. What is the purpose of transition-delay?

a) To set the time a transition takes
b) To set the wait time before a transition starts
c) To set the wait time after a transition ends
d) To repeat a transition
Answer: b) To set the wait time before a transition starts
Explanation: transition-delay postpones the start of the transition.


27. Which value for transition-timing-function uses discrete steps instead of smooth changes?

a) steps()
b) linear
c) ease-in
d) ease-out
Answer: a) steps()
Explanation: The steps() timing function creates transitions that jump in discrete steps.


28. What happens if you use a negative value for transition-delay?

a) The transition starts immediately
b) The transition starts partway through
c) The transition does not occur
d) The transition reverses
Answer: b) The transition starts partway through
Explanation: Negative transition-delay causes the transition to start as if it had already been running.


29. Which shorthand property includes transition-duration, transition-delay, and transition-timing-function?

a) transition-properties
b) transition
c) timing-function
d) duration
Answer: b) transition
Explanation: The transition shorthand property combines these properties.


30. Can you use multiple timing functions in a single transition?

a) Yes, by separating them with commas
b) Yes, by using multiple-timings
c) No, only one timing function is allowed
d) Only in keyframe animations
Answer: a) Yes, by separating them with commas
Explanation: Different timing functions can be applied to multiple properties.


31. What does the steps() timing function require?

a) Number of steps
b) Step direction
c) Both a and b
d) Only direction
Answer: c) Both a and b
Explanation: steps() requires the number of steps and an optional direction (start or end).


32. What is the effect of transition: all 2s ease-in-out;?

a) Applies an animation to all properties
b) Applies a smooth transition to all animatable properties
c) Applies all properties instantly
d) Applies only color transitions
Answer: b) Applies a smooth transition to all animatable properties
Explanation: The all keyword applies the transition to every animatable property.


33. Can transition be used for pseudo-elements?

a) Yes
b) No
Answer: a) Yes
Explanation: Transitions can be applied to pseudo-elements like ::before and ::after.


34. How do you remove a transition after it's applied?

a) Set transition: none;
b) Remove the CSS rule
c) Add a !remove declaration
d) Set transition-duration: 0;
Answer: a) Set transition: none;
Explanation: Setting transition: none; effectively disables the transition.


35. What is the default value of transition-timing-function?

a) ease-in
b) ease
c) linear
d) ease-out
Answer: b) ease
Explanation: The default timing function is ease.


36. How do you apply a transition only to specific elements within a class?

a) Use transition-target
b) Use the > selector with transition
c) Use transition: specific;
d) Use a specific selector with transition
Answer: d) Use a specific selector with transition
Explanation: Use precise selectors to target specific elements.


37. Which of these properties is not animatable?

a) height
b) font-size
c) color
d) display
Answer: d) display
Explanation: The display property cannot be transitioned because it doesn’t have intermediate states.


38. What happens if no transition-property is specified?

a) No transition occurs
b) All properties are transitioned
c) The default property opacity is transitioned
d) The transition is applied to the background
Answer: b) All properties are transitioned
Explanation: Without transition-property, all animatable properties are affected.


39. What value do you use to stop a transition after its first iteration?

a) none
b) pause
c) Transitions always complete
d) Use a conditional property
Answer: c) Transitions always complete
Explanation: Transitions automatically finish once started.


40. Which selector is best for creating a hover effect with a transition?

a) :hover
b) :transition
c) :focus
d) :selected
Answer: a) :hover
Explanation: The :hover selector is commonly used for hover-based transitions.


41. How does cubic-bezier() work?

a) Specifies custom timing functions
b) Creates a linear transition
c) Applies steps-based timing
d) Disables transitions
Answer: a) Specifies custom timing functions
Explanation: cubic-bezier() allows fine-grained control over transition timing.


42. Which property ensures transitions work on scaling an element?

a) scale
b) transform
c) animation
d) hover-scale
Answer: b) transform
Explanation: Scaling requires the transform property with transitions.


43. What keyword is used to apply transitions to all animatable properties?

a) all
b) none
c) any
d) all-properties
Answer: a) all
Explanation: The all keyword applies to every animatable property.


44. What does transition: opacity 0.5s linear; do?

a) Animates the opacity property over 0.5 seconds with linear timing
b) Instantly changes the opacity
c) Sets a default opacity
d) Animates all properties with opacity as a fallback
Answer: a) Animates the opacity property over 0.5 seconds with linear timing
Explanation: This defines a transition for opacity with specified duration and timing.


45. Can transition properties be inherited?

a) Yes
b) No
Answer: b) No
Explanation: Transition properties are not inherited by default.


46. Which keyword is used for simultaneous transitions?

a) simultaneous
b) together
c) all
d) none
Answer: c) all
Explanation: The all keyword triggers simultaneous transitions.


These questions can help solidify understanding of CSS transitions. Let me know if you'd like more! 😊

4o

You said:

more 4

ChatGPT said:

ChatGPT

Here are 4 additional MCQs to complete the set:


47. What is the purpose of transition-property?

a) It specifies how long the transition lasts
b) It specifies the delay before a transition starts
c) It specifies which CSS property is transitioned
d) It applies default transitions to all properties
Answer: c) It specifies which CSS property is transitioned
Explanation: The transition-property determines which property or properties will undergo the transition effect.


48. What does the value infinite mean when used with transition?

a) Makes the transition repeat forever
b) Causes the transition to loop once
c) Transitions do not support infinite
d) Applies transitions to infinite properties
Answer: c) Transitions do not support infinite
Explanation: The infinite value is used in animations, not in transitions.


49. What happens if transition-duration is set to 0s?

a) The transition occurs instantly
b) The transition takes the default duration
c) The transition is disabled
d) It throws an error in the browser
Answer: a) The transition occurs instantly
Explanation: A duration of 0s means the transition is instantaneous, with no visible effect.


50. Which property enables animations like hover effects and resizing to appear smoother?

a) animation
b) transition
c) hover-property
d) transform
Answer: b) transition
Explanation: The transition property enables smoother changes in properties over time, such as hover effects and resizing.


Let me know if you’d like more examples or further clarifications! 😊

4o

You said:

Class 20: CSS Transforms Objective: Apply 2D and 3D transformations. Topics: rotate(), scale(), translate(), skew() Lab Exercise: Create animated boxes with transform properties. Class 20: CSS Transforms Objective: Apply 2D and 3D transformations. Topics: rotate(), scale(), translate(), skew() Lab Exercise: Create animated boxes with transform properties.


No comments:

Post a Comment

Search This Blog

Powered by Blogger.