Data Types Flashcards

Types and their operators

1
Q

How many primitive types are there in Java?

A

Eight.

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

What are the different integer types?

A

int, byte, short, long

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

What are the arthimetic binary operators?

A
\+, addition
-, subtraction
*, multiplication
/, division
%, modulus
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a floating point number?

A

A number with a decimal/a fractional number.

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

What are the different floating point types?

A

float, double

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

How many relational operators are there?

A

Six

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

How many logical operators are there?

A

Six

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

What are the different relational operators?

A
==, equal to
!=, not equal to
>, greater than
=, greater than or equal to
<=, less than or equal to
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a relational operator?

A

How values can relate and compare with one another.

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

What is a logical operator?

A

Logical refers to the ways in which true and false values can be connected together.

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

What type represents binary state?

A

boolean

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

What type represents characters?

A

char

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

How do you specify a character type?

A

With single quotes around the character.

‘C’ represents C.

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

How do you declare a variable?

A

typeName variableName;

Ex. int totalCount;

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

What is the difference between declaring and initializing a variable?

A

Declaring a variable allocates the required amount of memory.
Initializing a variable assigns a newly declared variable a tangible value.

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

How do you initialize a variable?

A

variableName = value; if the variable was previously declared.
typeName variableName = value; if it was not.
Ex. totalCount = 123; or
int totalCount = 123;

17
Q

What is the escape character?

A

Backslash, \

18
Q

How would you display a backslash?

A

Use the escape character, \

Ex. \

19
Q

How would you display a double quotation mark in a string?

A

Escape the double quote.

Ex. System.out.println(“Hello, "world!"”);

20
Q

How would you assign a char variable as a single quote?

A

Escape a single quote.

Ex. char quotationMark = ‘'’;

21
Q

What are the arthimetic compound operators?

A
\+=
-=
*=
/=
%=