Unknown Vocab Lessons #1-14 Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

indices

A

plural form of index, referring to the numbers that begin to be counted up from zero, like those used with substring

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

what are the two methods that will turn everything lower/upper case?

A

toUpperCase() and toLowerCase()

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

in increment, what is the difference between x++ and ++X

A

x++ increments x AFTER the whole statement has been read whereas ++x increments it immediately. The same applies for decrement (x–, –x)

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

truncation

A

when the program throws away the fractional part of an integer division, so 7/2 is not 3.5, it is 3. It always rounds down.

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

what does Math.ceil(double x); do?

A

rounds up to the nearest whole number (so if x = 57.2, then Math.ceil(x) = 58.0

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

what does Math.floor(double x) do?

A

rounds down to the nearest whole number so if

x = 57.2 then Math.ceil(x) = 57.0

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

what does Math.pow(double b, double e); do?

A

does b to the power of e

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

what does Math.random() do for doubles?

A

returns a random value in the range of 0

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

what does Math.round(double x) do?

A

rounds to the NEAREST whole number (does not simply round down).

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

how else can you assign a value to a boolean besides saying boolean x = true/false; ?

A

You can set the boolean equal to a operation that will either be true or false
ex: boolean dave = true; //OR
boolean dave = 3>2; //true

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

how can you compare two Strings without caring about upper or lower case??

A

String y = “fUnKyTOWN”;
if(y.equalsIgnoreCase(“funkytown”){
…………………………….
}

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

what does continue; do?

A

all code after the continue statement is skipped for that particular iteration in the loop, though the increments still continue as normal

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

is it legal to convert a String to a char?

A

Not without using a method besides pure assignment (‘A’ is illegal but “A” is legal)

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

what kinds of quotes do chars use?

A

‘single quotes’ not “double”

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

Is it legal to store type char in an int? If so, why?

Is it legal to store type int in char?

A

Yes, because the char letters will be read as ASCII hexadecimal letters. It is illegal to store ints in chars (but you can cast to char)

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

how to convert from char to String

A

concatenate empty “” quotes with the char variable
ex:
char amy = ‘D’;
String jake = ““+amy;

17
Q

how to convert from String to char

A

String sam = “T”;

char bob = sam.charAt(0); //bob now equals T

18
Q

list the commands used to identify the properties of char values (there are 6)

A
Character.isLetter(char)
Character.isDigit(char)
Character.isLowerCase(char)
Character.isUpperCase(char)
Character.isWhitespace(char) //WHITESPACE IS ONE WORD
Character.isLetterOrDigit(char)
19
Q

what are the two commands used to convert chars to upper and lowercase?

A

Character.toUpperCase(char)

Character.toLowerCase(char)

20
Q

what leading characters indicates that a number is in hex format?

A

0x

21
Q

what leading characters indicates that a number is in binary form?

A

0b

22
Q

what leading character indicates an octal number?

A

0

23
Q

how to convert integers into binary, hexadecimal, and octal?

A

Integer.toHexString(int x)
Integer.toBinaryString(int x)
Integer.toOctalString(int x)

24
Q

what is the alternate method of converting numbers to hex, octal, etc. ?

A

Integer.toString(int x, base #);

ex: Integer.toString(675, 16);

25
Q

how to use parseInt to convert from a strange base back to decimal??

A

Integer.parseInt(“123kn23”, 35);

^ converts “123kn23” in base 35 back to decimal