Multiple choice technology web technology

difference between Servlet and CGI

  1. no difference

  2. servlet runs slowly than CGI

  3. CGI is a complex process , servlet is easier ie lieght weight component

  4. none of these

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

CGI creates a new process for each request, making it resource-intensive and slower. Servlets run in a single JVM instance and use threading, making them lightweight and more efficient. Option C correctly captures this key architectural difference.

AI explanation

CGI spawns a new operating system process for every request, which is comparatively heavyweight and slow, and each script must handle its own setup on every invocation. A Servlet, by contrast, runs within the web server's JVM as a lightweight thread and its class stays loaded in memory across requests, making it a simpler and more efficient model than the CGI process-per-request approach.