CS Chapter 2 Flashcards

(9 cards)

1
Q

Whitespace guidelines

A

Sub-statements are indented 3 spaces from parent statement;

Most items separated by no more than and no less than 1 space (no space before ;)

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

Braces
guidelines

A

For branches, loops, methods, or classes, opening brace appears at the end of the item’s line. Closing brace appears under item’s start

Braces always used even if only sub-statement

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

Naming guidelines for variables

A

always start with lowercase (camelCase); be descriptive and use at least two words; avoid abbreviations

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

Naming guidelines for constants

A

upper case and underscores (MAXIMUM_WEIGHT)

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

Naming guidelines for methods

A

camelCase with lowercase first

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

How long should a line of code be MAX

A

<100 characters

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

identifier

A

name created by a programmer for an item like a variable or method

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

reserved word/keyword

A

word that is part of the language, like int, short, double.

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

integer literal

A

numeric value without decimal point or exponent or anything

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