Quiz # 1 Flashcards

1
Q

JVM – Java Virtual Machine (java.exe) does?

A

converts bytecode into machine code in real time.

Is contained in the JRE (Java Runtime Environment) along with the Java API (our library of free code like System.out.println())

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

Java API is?

A

A library of java code that we can use while writing our programs

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

JRE (Java Runtime Environment) is?

A

The JRE contains the JVM and the Java API

The JRE ships with virtually every computer operating system out there

Can be found in Android phones, gas station pumps, toasters, TVs, etc.

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

JDK (Java Development Kit) is?

A

Only programmers need the JDK.

Contains the compiler and JRE.

The JDK contains the Compiler (javac.exe)

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

Three core principles of Programming languages?

A

Sequence
Decision
Iteration

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

______ translates source code to bytecode

A

Compiler translates source code to bytecode

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

What is javac.exe

A

the compiler

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

______ converts bytecode to machine code

A

JVM(Java virtual machine)

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

_____ is the type of java code that programmers type into an editor like VSCode.

A

java source code

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

____ exist on many operating systems, thus allowing java programs to be cross-platform.

A

JVM

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

The first time a class is accessed, the JVM loads the bytecode from the .class file into the _____ area of memory.

A

The first time a class is accessed, the JVM loads the bytecode from the .class file into the method area of memory.

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

Break down the code:

public class Test{
public static void main(String[] arg){
int a = 100;
System.out.println(a);
}
}

A

[public class] = Class header
[Test{] = Class name
[public static void main
(String[] arg) ]= Method name
{
[int a = 100;] = Declare primitive variable
[System.out.println(a);] = Print to screen
}
}

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

Variables whose type starts with a lower-case letter (int, double, boolean, etc) are ________ variables

A

Variables whose type starts with a lower-case letter (int, double, boolean, etc) are PRIMITIVE variables

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

_____ variables are any variables of any type that are declared inside of a method’s code block. (any method, not just the main method)

______ variables are always stored in the current stack frame of the stack, while the program is running

A

Local variables are any variables of any type that are declared inside of a method’s code block. (any method, not just the main method)

Local variables are always stored in the current stack frame of the stack, while the program is running

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

The Stack is an organized area in memory where _____ ________ are created and destroyed.

Every time a method is ____, a new ______ _____ frame is created.

A

The Stack is an organized area in memory where stack frames are created and destroyed.

Every time a method is entered, a new current stack frame is created.

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

Every time a method is exited, the current ____ ______ is destroyed

A

Every time a method is exited, the current stack frame is destroyed

17
Q

All local variables are stored in the current ______ _______.

A

All local variables are stored in the current stack frame.

18
Q

How do we know that a variable is local?

A

It is declared in a method

19
Q

Define these logical operators:
&&
||
!

A

&& and
|| or
! not
^ exclusive xor

20
Q

What are the 3 types of errors?

A

Compilation Error
Runtime Error
Logic Error

21
Q

int a = 19
double b = 204.34
String c = “Hello”
What are the outputs below
System.out.println(a+b+c)

System.out.println(c+a+b)

A

int a = 19
double b = 204.34
String c = “Hello”

a+b+c = 223.34Hello

c+a+b = Hello19204.34