Test 3 Flashcards

0
Q

What does it mean to decrement a variable?

A

Subtract 1 from it

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

What does it mean to increment a variable?

A

Add 1 to it

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

What is a unary operator?

A

An operator with a single operand

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

What does x++; mean?

A

Add 1 to x

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

What does x–; mean?

A

Subtract 1 from x

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

What is a binary operator?

A

An operator with 2 operands

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

What does x+=5; mean?

A

Add 5 to x

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

What’s does x-=5

A

Subtract 5 from x

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

What does x*=5; mean?

A

Multiply x by 5

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

What does x /=5 mean?

A

Divide x by 5

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

What’s shorthand for x=x+23

A

x+=23 (etc for other operations)

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

What data type is used to process individual characters?

A

char

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

What data type is used to process one or more characters

A

String

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

What kind of quotes used w/ String

A

Double “”

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

What kind of quotes used with characters

A

Single ‘’

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

What is accomplished by the statement c1=c2=c3=’Q’; what type of assignment is this called?

A

Every variable is assigned to the value of Q, chain assignment or chaining

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

Why is + an overloaded operator

A

It concatenates (with String variables) and adds (with int or double)

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

Who invented form of algebra based on logic statements that are either TRUE or FALSE

A

George Boole

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

What data type can only store either TRU or false

A

Boolean

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

What is datas formal language for the term simple data types

A

Primitive data types

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

Code for assigning 2.7 as a CONSTANT for the value of E?

A

final double E = 2.7

21
Q

What happens when you attempt to alter the value of a constant?

A

Compile error

22
Q

What is the 1st form of program documentation?

A

To use comments

23
Q

Why did older programs 1960/70s use single-letter variables?

A

Memory scarce and expensive, save every byte possible

24
Q

Self-commenting variable

A

A variable whose name describes what it’s used for (heightInches = 54)

25
Q

Instead of single-letter variables, nowadays variables should be…

A

Words or compound words

26
Q

In a well-documented programs, single line comments or multi line comments necessary?

A

Yaaa

27
Q

Does Java follow PEMDAS

A

Yupp

28
Q

How do u find square root?

A

Math.sqrt(x);

29
Q

How do u round?

A

Math.round(x)

30
Q

How do u round up?

A

Math.ceil(x);

31
Q

How round down?

A

Math.floor(x)

32
Q

How do u find max over min?

A

Math.max(x,y);

33
Q

How find absolute value?

A

Math.abs(x)

34
Q

How find power?

A

Math.pow(x,y)

35
Q

How times Pi?

A

Math.PI(x)

36
Q

Java source code file extension?

A

.java

37
Q

Float

A

decimals (7 places)

38
Q

Single line comments

A

Forward slashes // aka inline comments, provide brief summary comments for chunks of code

39
Q

Multi-line comments

A

Start with /* end with */

40
Q

Backslash \ + what makes a new line, backspace, horizontal tab, backslash, single and double quote?

A

\n, \b, \t, \, ', "

41
Q

Identifier

A

Name given to package, class, method, or variable (allows programmer to refer to item from other places in program)

42
Q

Variables can only have…

A

Letters, __, or $
Use lowercase first “appleBanana” unless it’s a final/constant
No reserved words

43
Q

Reserved/keywords are

A

Lowercase, NOT used as methods or variables

44
Q

A program with 1 or more compile errors?

A

Can compile, but will stop executing at point of compile error

45
Q

The “print” keyword…

A

Displays text output to monitor w/o carriage return (doesn’t go to next line but “ln” does)

46
Q

Compiled files have the extension…

A

.class

47
Q

When dividing ints as opposed to doubles…

A

It takes the integer, so 4/5 is 0.8 but if it was an int it would be 0

48
Q

Finding modulus (remainder)

A

If q%=25, and q=14, it’s 14%25 which is 14/25 and 14 is in the house

49
Q

Reserved words include

A

public void static double int if byte boolean package else class for return

50
Q

Powers of 2 wen converting??

A

2 to the 0, 2 to the 1, 2 to the 2….2

to the 7