LO1: Java Basics Flashcards

1
Q

Natural Language vs Binary Code (machine language): Vocabulary, Syntax, Ambiguity

A

NL: Large vocabulary, complex syntax, semantic ambiguity.
ML: Small vocabulary (0s, 1s), simple syntax, no semantic ambiguity.

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

What is the process of programming? (from human to machine)

A

Human writes in a programming language which is passed through a compiler + interpreter to translate into machine language.

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

Programming languages have: vocabulary, syntax, ambiguity

A

Restricted vocabulary, small and restricted syntax, almost no ambiguity

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

What is a compiler?

A

Coverts Java code into byte-code which is a machine language for the Java Virtual Machine.

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

What is an interpreter?

A

Executes JVM, translates byte-code into machine language and executes. Translating is easier than compiling.

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

Source code has which file extension? After compiling into byte-code what is the file extension?

A

MyProg.java, MyProg.class

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

What is an algorithm?

A

Process of solving a problem using NL

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

What is pseudocode?

A

Algorthm expressed in formal language, no specific syntax.

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

What is a Program? (related to algorithm)

A

An algorithm expressed in programming language (specific syntax).

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

What are the 4 Golden Rules of Programming?

A

1) Understanding the problem. 2) Design a solution (algorithm). 3) Implement the solution (program). 4) Test the program/fix any issues.

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

What does a Java Program consist of? A Java program must always have which method?

A

Classes, methods, statements. Java program must always have main method.

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

What are the 3 types of errors? (describe them)

A

Compile-time errors (syntax): Compiler will find syntax errors, the executable is not created until these are fixed.

Run-time errors: A problem that occurs during program execution. Causes unexpected termination of program. (ex. divide by 0, infinite loop).

Logical errors: Error in algorithm, compiler cannot catch them, incorrect results.

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

What is the hardest error to detect?

A

Logic error since the IDE usually gives hints about the other ones.

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

When are compilation, run-time, and logical errors detected?

A

Compilation error: compilation phase.

Run-time and logical errors: Program execution.

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