Scripting Languages Flashcards

1
Q

What is a scripting language?

A

A programming language that supports scripts: programs written for a special run-time environment that automate the execution of tasks that could alternatively be executed one-by-one by a human operator.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Scripting languages are often ___ (rather than ____).

interpreted, compiled

A

Scripting languages are often interpreted, rather than compiled.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a compiled language?

A

One where the program, once compiled, is expressed in the instructions of the target machine; this machine code is undecipherable by humans.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is an interpreted language?

A

One where the instructions are not directly executed by the target machine, but instead read and executed by some other program (which normally is written in the language of the native machine).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How is code executed via compilation?

A

It is executed natively through the operating system after it is converted to machine code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How is code executed via interpolation?

A

It is evaluated line by line through a program which handles executing the code instead of the operating system itself.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Can you easily classify a programming language as either compiled or interpreted?

A

Not usually- most programming languages have both compiled implementations and interpreted implementations. Languages are often referred to as one or the other for the sake of simplicity and clarity.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the major advantage of compiled languages over interpreted languages?

A

their execution speed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Why are compiled languages usually faster than interpreted languages?

A

Because they are converted directly into machine code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Why do lower-level languages tend to be compiled?

A

Because efficiency is usually more of a concern than cross-platform support. Also, because compiled languages are converted directly into machine code, this gives the developer much more control over hardware aspects such as memory management and CPU usage.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are some examples of pure compiled languages?

A

C, C++, Erlang, Haskell, Rust, Go.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is a pitfall of a compiled language?

A

You need to manually compile a program in order to run it.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is a pitfall of a compiled language involving debugging?

A

While you debug the program, you need to recompile the program each time you want to test your new changes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Are compiled languages platform-independent?

A

No, the compiled machine code is specific to the language that is executing it.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is an example of a technology that is narrowing the execution time gap between interpreted and compiled languages?

A

just-in-time compilation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is just-in-time compilation?

A

Compilation done during execution of a program- at run time- rather than prior to execution.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What are some examples of interpreted languages?

A

PHP, Perl, Ruby and Python.

18
Q

What are some programming concepts that interpreted languages make easier?

A

Platform independence, reflection, dynamic typing, smaller executable program size and dynamic scoping.

19
Q

How does just-in-time compilation work?

A

it converts frequently-executed sequences of interpreted instruction into host machine code.

20
Q

What are bytecode languages?

A

a type of programming language that fall under the categories of both compiled and interpreted languages because they employ both compilation and interpretation to execute code.

21
Q

What are the most common examples of bytecode languages?

A

Java and the .Net framework.

22
Q

What is the first step in a bytecode language?

A

In a bytecode language, the first step is to compile the current program from its human-readable language into bytecode.

23
Q

What is bytecode?

A

Bytecode is a form of instruction set that is designed to be efficiently executed by an interpreter and is composed of compact numeric codes, constants, and memory references.

24
Q

Where is the bytecode passed after compilation?

A

the bytecode is passed to a virtual machine which acts as the interpreter, which then proceeds to interpret the code as a standard interpreter would.

25
Q

When is there a delay in bytecode languages?

A

there is a delay when the program is first run in order to compile the code into bytecode, but the execution speed is increased considerably compared to standard interpreted languages because the bytecode is optimized for the interpreter.

26
Q

What is the largest benefit of bytecode languages?

A

The largest benefit of bytecode languages is platform independence which is typically only available to interpreted languages, but the programs have a much faster execution speed than interpreted languages.

27
Q

Compiled languages in a nutshell.

A

Compiled languages are the most efficient type of programming language because they execute directly as machine code and can easily utilize more of the hardware specs of the running machine. In turn, this forces a significantly stricter coding style and a single program usually can’t be run on different operating systems.

28
Q

Interpreted languages in a nutshell.

A

Interpreted languages on the other hand offer much more diversity in coding style, are platform-independent, and easily allow for dynamic development techniques such as metaprogramming. However, interpreted languages execute much slower than compiled languages – though just-in-time compilation has been helping to speed this up.

29
Q

What is reflection (in computer science)?

A

Reflection is the ability of a computer program to examine, introspect, and modify its own structure and behavior at runtime.

30
Q

How is reflection generally used?

A

Reflection can be used for observing and modifying program execution at runtime. A reflection-oriented program component can monitor the execution of an enclosure of code and can modify itself according to a desired goal related to that enclosure. This is typically accomplished by dynamically assigning program code at runtime.

31
Q

How is reflection used in object-oriented programming?

A

In object-oriented programming languages such as Java, reflection allows inspection of classes, interfaces, fields and methods at runtime without knowing the names of the interfaces, fields, methods at compile time. It also allows instantiation of new objects and invocation of methods.

32
Q

How is reflection used in software testing?

A

It can be used for the runtime creation/instantiation of mock objects.

33
Q

What is a type system?

A

In programming languages, a type system is a set of rules that assign a property called type to various constructs a computer program consists of, such as variables, expressions, functions or modules.

34
Q

What is the main purpose of a type system?

A

To reduce possibilities for bugs in computer programs by defining interfaces between different parts of a computer program, and then checking that the parts have been connected in a consistent way.

35
Q

When does static typing occur?

A

At compile time.

36
Q

When does dynamic typing occur?

A

At run time.

37
Q

What is a domain-specific language (DSL)?

A

A domain-specific language (DSL) is a computer language specialized to a particular application domain. This is in contrast to a general-purpose language (GPL), which is broadly applicable across domains.

38
Q

What is a common DSL for web pages?

A

HTML

39
Q

What are some further DSL subdivisions?

A

domain-specific markup languages, domain-specific modeling languages, domain-specific programming languages.

40
Q

What has made the term DSL more popular?

A

the term “domain-specific language” has become more popular due to the rise of domain-specific modeling.

41
Q

What is the spectrum of scripting languages?

A

The spectrum of scripting languages ranges from very small and highly domain-specific languages to general-purpose programming languages used for scripting.