When compared to the compiled program, scripts run
-
Faster
-
Slower
-
The execution speed is similar
-
All of above
To solve this question, the user needs to know basic concepts of programming languages and how they are executed.
The answer is:
B. Slower
Scripts are interpreted line by line during runtime, whereas compiled programs are translated into machine language (binary code) before runtime. This means that compiled programs are faster than scripts because they do not require interpretation during runtime. On the other hand, scripts are easier to write, modify, and debug because they do not need to be compiled before execution.
Scripts (interpreted languages like Python, Perl, shell scripts) run slower than compiled programs because each line is parsed and translated into machine instructions at runtime, line-by-line or via a bytecode interpreter, incurring repeated overhead. Compiled programs are translated once, ahead of time, directly into optimized native machine code, so execution just runs those instructions with no translation overhead. 'Faster' and 'similar speed' contradict this well-established performance characteristic, and 'All of above' is nonsensical since the options are mutually exclusive.