Inline styles accept an object, and ternary operators are commonly used within the object values for conditional styling.
Incorrect! Try again.
39Which feature allows you to pass data from a parent to a child component?
A.State
B.Ref
C.Props
D.Context
Correct Answer: Props
Explanation:
Props are the standard mechanism for passing data down the component tree from parent to child.
Incorrect! Try again.
40Which file contains the directives @tailwind base;, @tailwind components;, and @tailwind utilities;?
A.App.js
B.index.html
C.The main CSS entry file (e.g., index.css)
D.package.json
Correct Answer: The main CSS entry file (e.g., index.css)
Explanation:
These directives inject Tailwind's styles and are placed in the project's global CSS file.
Incorrect! Try again.
41How does React handle boolean values in JSX interpolation {true}?
A.It renders a checkbox
B.It renders 'true'
C.It renders nothing
D.It throws an error
Correct Answer: It renders nothing
Explanation:
Booleans, null, and undefined are valid children in React but they do not render anything to the DOM.
Incorrect! Try again.
42What is the correct way to export a component as the default export?
A.export default ComponentName;
B.return ComponentName;
C.export ComponentName;
D.module.export = ComponentName;
Correct Answer: export default ComponentName;
Explanation:
The ES6 syntax for a default export is export default VariableName;.
Incorrect! Try again.
43When using inline styles, which unit is assumed for unitless numbers on properties like width?
A.px (pixels)
B.%
C.em
D.rem
Correct Answer: px (pixels)
Explanation:
React automatically appends 'px' to unitless numbers for specific properties like width, height, margin, etc.
Incorrect! Try again.
44Can props contain functions?
A.No, only strings and numbers
B.Only in Class components
C.Yes, to handle events or callbacks
D.Only if the function is static
Correct Answer: Yes, to handle events or callbacks
Explanation:
Props can hold any JavaScript value, including functions, which allows child components to communicate back to parents.
Incorrect! Try again.
45What is the purpose of the super(props) call in a Class component constructor?
A.To initialize the state
B.To render the component
C.To import CSS
D.To call the parent class constructor and bind this.props
Correct Answer: To call the parent class constructor and bind this.props
Explanation:
In JavaScript classes, super calls the parent constructor. In React, passing props ensures this.props is set in the constructor.
Incorrect! Try again.
46Which of the following is a benefit of Functional Components over Class Components?
A.They are generally easier to read and test, and require less boilerplate
B.They have more lifecycle methods
C.They support inheritance
D.They are more verbose
Correct Answer: They are generally easier to read and test, and require less boilerplate
Explanation:
Functional components reduce the boilerplate code (like constructors and this binding) associated with classes.
Incorrect! Try again.
47In the context of Virtual DOM, what is 'Batch Update'?
A.Updating all components at once every second
B.Grouping multiple state updates into a single re-render for performance
C.Updating the database in batches
D.Downloading multiple files
Correct Answer: Grouping multiple state updates into a single re-render for performance
Explanation:
React groups multiple state updates that occur in event handlers to trigger a single re-render/reconciliation cycle.
Incorrect! Try again.
48If a prop is passed to a component but not defined in the component's logic, what happens?
A.The app crashes
B.It appears in the DOM as an attribute automatically
C.React throws a warning
D.The prop is ignored
Correct Answer: The prop is ignored
Explanation:
If the component logic doesn't use the prop, it is simply ignored. It doesn't break the app or appear in the DOM unless explicitly rendered.
Incorrect! Try again.
49Can you use standard CSS and TailwindCSS in the same project?
A.Yes, they can coexist
B.Only if you use inline styles
C.Only in separate pages
D.No, they conflict
Correct Answer: Yes, they can coexist
Explanation:
TailwindCSS generates standard CSS classes. You can use them alongside your own custom CSS files without issue.
Incorrect! Try again.
50Which syntax is used to destructure props in a functional component parameter?
A.function Comp(name, age) { ... }
B.function Comp([name, age]) { ... }
C.function Comp({ name, age }) { ... }
D.function Comp(props) { const name = props.name }
Correct Answer: function Comp({ name, age }) { ... }
Explanation:
Object destructuring inside the function parameter list ({ name, age }) is the standard cleaner way to access specific props.
Incorrect! Try again.
Did this save you a night before the exam?
LPU Notes is free, and it stays free. Ads cover part of the server bill.
The rest comes out of a student's own pocket: the domain, the storage,
and keeping the site up through the weeks everyone needs it at once.
The payment button didn't load. An ad blocker or a filtered network is the usual reason.
to try again.
Nothing here is ever locked, and nothing unlocks. Chip in only if it was worth it.
What it pays for →