Test 3 Flashcards

(51 cards)

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
Self-commenting variable
A variable whose name describes what it's used for (heightInches = 54)
25
Instead of single-letter variables, nowadays variables should be...
Words or compound words
26
In a well-documented programs, single line comments or multi line comments necessary?
Yaaa
27
Does Java follow PEMDAS
Yupp
28
How do u find square root?
Math.sqrt(x);
29
How do u round?
Math.round(x)
30
How do u round up?
Math.ceil(x);
31
How round down?
Math.floor(x)
32
How do u find max over min?
Math.max(x,y);
33
How find absolute value?
Math.abs(x)
34
How find power?
Math.pow(x,y)
35
How times Pi?
Math.PI(x)
36
Java source code file extension?
.java
37
Float
decimals (7 places)
38
Single line comments
Forward slashes // aka inline comments, provide brief summary comments for chunks of code
39
Multi-line comments
Start with /* end with */
40
Backslash \ + what makes a new line, backspace, horizontal tab, backslash, single and double quote?
\n, \b, \t, \\, \', \"
41
Identifier
Name given to package, class, method, or variable (allows programmer to refer to item from other places in program)
42
Variables can only have...
Letters, __, or $ Use lowercase first "appleBanana" unless it's a final/constant No reserved words
43
Reserved/keywords are
Lowercase, NOT used as methods or variables
44
A program with 1 or more compile errors?
Can compile, but will stop executing at point of compile error
45
The "print" keyword...
Displays text output to monitor w/o carriage return (doesn't go to next line but "ln" does)
46
Compiled files have the extension...
.class
47
When dividing ints as opposed to doubles...
It takes the integer, so 4/5 is 0.8 but if it was an int it would be 0
48
Finding modulus (remainder)
If q%=25, and q=14, it's 14%25 which is 14/25 and 14 is in the house
49
Reserved words include
public void static double int if byte boolean package else class for return
50
Powers of 2 wen converting??
2 to the 0, 2 to the 1, 2 to the 2....2 | to the 7