lecture 1 Flashcards

1
Q

What is a compiler?

A

A compiler (for compiled languages) translates the entire
program into equivalent machine codes before carrying out any of the statements.
source code ⇒ machine code or executable
The machine codes are platform-dependent

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

What does platform-independent mean?

A

You can run it on any platform so any computer as the language is already translated in machine language.

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

Example of platform-dependent languages?

A

C, C++, Delphi.

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

What is an interpreter?

A
An interpreter (for interpreted languages) translates the
program line-by-line, alternately reading lines and carrying out commands.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Why is an interpreter generally slower?

A

If a line was in a loop (or otherwise needed to be executed multiple times) it would be re-interpreted each time.

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

examples of interpreter languages?

A

R, PHP, Perl, Matlab.

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

Examples of combination and interpretation?

A

Java, Python, C#, Visual Basic.Net, Lua.

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

Both (compilation and interpretation) How does it work?

A

Compilation of the source code to byte code

A ”virtual machine” interprets the byte code into
computer-specific commands.

The byte code is platform-independent.

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

Features of java:

A
Distributed 
Multithreaded
High performance
Interpreted
Dynamic
Architecture Neutral
Portable
Robust
Platform Independent
Secured
Simple
Object-Oriented
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

History Of Java

A

It was called Oak- a language intended for small, embedded systems in electronic appliances like set-top boxes.

Originally developed by James Gosling at Sun Microsystems (which is now a subsidiary of Oracle Corporation).

Java is just a name, not an acronym. This name comes from an island of Indonesia where first coffee was produced (called java coffee).

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

How does a java program work?

A

Java code –> JAVAC(compiler) –>Byte code (.class) –>JMV (Java Virtual Machine) –> Windows (Or Linux Or Mac)

Stage 1: Compilation with a JAVAC compiler.
Stage 2: Interpretation ona Java Virtual Machine (JVM).

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

What is a Java Virtual Machine?

A

The Java Virtual Machine (JVM) is like a “hypothetical computer” which Java runs on, which means that instructions are not executed directly on the computer.

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

What are the benefits of a JVM?

A
  • Java is fully platform-independent ”write once, run anywhere” (WORA)
  • Java is secured.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Basics of Java :

A

The file name should match the class name.

A pair of braces { } encloses a group of statements (called ”a block”).

A statement ends with semi-comma ( ; )

Whenever JVM executes a program, it first looks for the
main() method. Not all classes are executable.

Takes a String[] as an argument

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