Module 2: Representing Infomation Flashcards

1
Q

What are the two types of variables?

A

Reference and Primitives’

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

What is a print statement?

A

A print statement is how we get a command to print to our console.

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

What is a variable

A

Something that represents a piece of data. The value may or may not be known at the time of declaration (creation) and can be changed.

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

What is a Primitive?

A

A primitive is for storing simple values… int, float, double, long, boolean, char, byte, and short.

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

What is a reference variable?

A

A reference variable stars, a memory address of an object. We say that the variable “refers” to the object.

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

System.out.println();

A

Java method that lets us print out a line of output, followed by a newline to the user.

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

System.out.print();

A

Prints output without a newline

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

What is a data type?

A

Indicates the type of data, a memory, location (variable or named constant) can store.

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

What are the different data types in Java?

A

int, float, double, short, byte, boolean, long, and char…
String in Java is actually a non-primitive data type

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

Boolean

A

A single value of either TRUE or FALSE

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

char data type

A

Used to hold any single character

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

int data type

A

A primitive data type that represents integer values. Ranges from -2147483648 to 2147483648

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

float data type

A

Holds a floating point value of up to six or seven significant digits ID accuracy

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

double data type

A

Can hold a floating point value of up to 14 or 15 significant digits of accuracy

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

short data type

A

holds small integers from -32,768 to 32,767

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

byte data type

A

holds very small integers from -128 to 127

17
Q

long data type

A

Holds very large integers from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807

18
Q

What data type uses single quotes?

A

char

19
Q

Anything with “” is considered?

A

A String

20
Q

What is a literal?

A

A literal is the sequence of characters used in a program to represent a constant value. For example, ‘A’ is a literal that represents the value A of type char and 17L is a literal that represents the number 17 as a value of type long. A literal is a way of writing a value and should not be confused with the value itself.

21
Q

What is an instance variable?

A

Instance variables are variables within a class but outside any method. These variables are instantiated when the class is loaded. i.e. The values are not present until an object is created.

22
Q

What is a local variable?

A

Variables are defined inside methods, constructors or blocks are called local variables. The variable will be declared and initialized within the method and it will be destroyed when the method has completed.

23
Q

What does it mean to initialize a variable?

A

Have a value assigned to the variable. In other words to give it the first value the variable will hold as this value can be changed later in the application.

24
Q

What does it mean to declare a variable?

A

To reserve the space in memory (ex: int x;). In other words to create a variable but do not assign it a value right away. You can initialize the variable later in the code.