test2 Flashcards

1
Q

curly braces or the _____ _____ _____ can control the scope of a vriable

A

SCOPE INDEX OPERATORS

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

what is a variable?

A

a storage location in a computer’s ram memory

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

a variable has a ____ and a ____ ____ specified

A

name (identifier, reference, handle) and data type(int,String)

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

what do we do when we declare a variable

A

we specify its data type and name

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

what is the assignment operator

A

=

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

When we declare a variable, we’re ______ the name of the variable to a particular memory location address

A

binding

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

How must a Java variable identifier must start with

A

a letter, and underscore or a $ sign

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

True or false: You cannot start a variable name with a digit such as 3 or 7.

A

True it causes a compile error

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

is java case sensitive?

A

yes

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

can you use java reserved words or keywords such as public, class or else identifiers?

A

nope compile error

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

java names begin with a ____

A

lower case letter

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

how is the second word in a variable name written out

A

with a capital letter, camelBack

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

true or false. in java our programs statements are always contained inside a class file

A

true

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

class names always start with a

A

capital letter and each new word also starts with a capital letter

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q
variable names start with a \_\_\_\_ case letter
class names start with a \_\_\_\_ case letter
A

lower (camelBack)

upper (title case)

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

why do we specify the data type when we declare a variable?

A

tells os how many bytes of memory is needed for that variable and BC program uses data type to interpret the data that is stored

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

True or false: ASCII and Unicode: first 256 values are identical

A

true

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

do primitive data types have methods associated with them?

A

nope

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

how many primitive data types are there in java

A

8

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

what is mantissa and exponent

A

mantissa is the first part of an exponent the number that is going to be multiplied by 10 to the exponent. exponent is what it is

21
Q

is a string an object

22
Q

what is a method in java

A

a method is some lines of code that are put in their own code block (inside their own curly braces) and this block is given a method name

23
Q

T or F: Var keyword only be used when created local variables within a method

24
Q

how are constants declared

A

with the keyword final along with its data type that it will hold

25
constants can be declared on one line and initialized later on in another line
true
26
what is a data literal
a data literal is an actual data value that appears in a program. its the value that is declared
27
if you divide an integer by another integer does java give you an integer answer?
yes
28
when dividing an integer literal by another integer java will do what to the decimal portion
truncate
29
are primitive data types objects?
nope
30
integer primitive data types
byte(8)m short(16), int (32), long(64)
31
floating data types
float and double
32
char is a single word
nope letter
33
what are the binary operators
+ - * / %
34
the answer of a modulus division operation is the ______ of value from a regular division operation
REMAINDER
35
equals we use ___ and not equal is ____
== and !=
36
by default a numeric literal value is assumed to be ____
positive
37
increment operator | decrement operator
++ | --
38
True or false: An if structure is a single-selection type of structure because it either selects to carry out, or it ignores, a single action.
True
39
should you put curly braces around every if block statement, even if there is only 1 statement to execute
yes, good coding style
40
The logical AND indicates that both conditions must be truein order for the overall if expression to return a value of ____.
true
41
if either condition is false, or both are false, then the overall if expression evaluates to ____
false
42
true or false: the only way to get a true result from a logical and operation is for both conditions to be true
True
43
Why do we use the && and || symbols when & and | seem to do the same thing?
The single ‘&’ AND operator is the ‘bitwise’ operator. It compares the corresponding bits of each operand to determine the overall true or false result. So, it does both comparisons, no matter what the first comparison return but the && || will stop after reading a false value- saves a few cpu cycles
44
declaring a variable
defining its type
45
initializing a variable
specify the value to be stored in the variable
46
4 rules of naming variables
1 start with letter or underscore 2. can't use ? or %, spaces 3 variable names are case sensitive 4 you cannot use reserved words such as double or class as names
47
what are two downsides of using objects such as BigDecimal and BigInteger in calculations?
slow and you have to call in methods called add, subtract and multiply
48
what is a package and what does it contain
it is a collection of classes with a related purpose
49
how do you tell in java code that a character should be interpreted as a character literal?
single quotes ' '