Things to check before assuming compatibility:
* Engine Code: The most crucial step. Look up the engine code (usually cast into the engine block itself) for both engines. If the codes are the same or very similar (indicating minor internal variations), compatibility is much higher. A significant difference suggests incompatibility.
* Engine Mounts: Even with the same engine code, the mounting points might be slightly different. Visually compare the engine mounts on both engines.
* Wiring Harness: The connectors for sensors, injectors, etc., should be the same, but minor variations might require some wiring adjustments.
* Exhaust Manifold: This could be a problem area.
* Accessory Drive: The placement and type of accessories (alternator, power steering pump) might differ.
In short: While the chances are good, don't assume it'll be a direct swap. Research the specific engine codes and visually compare the two engines before attempting the installation. A mechanic specializing in Cavaliers would be able to give you the most accurate assessment. A mismatch could lead to significant problems, making the swap far more complex and expensive than anticipated.