procedural programming with Java Flashcards

1
Q

Objects within a class:(2)

A

-have the same methods
-can have different data associated with them

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

syntax

A

describes allowed arrangements of words and
punctuation in a program (how you write a program)

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

semantics

A

describes what happens when you run the
program

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

There are three commonly recognized types of errors:

A

syntax error– grammatical mistake in the program
run-time error– error that is not detected until program is run
logic error– mistake in the underlying algorithm for the
program(the outcome is wrong)

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

Variable

A

a data container that stores the data values during
program execution.

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

identifier, rules for constructing identifiers:

A

The name of a variable or other item in a program,

must not start with a digit
all the characters must be letters, digits, the symbols _ or $

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

The size range of the integer type

A

−2^(31) to 2^(31) − 1

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

Memory used for boolean

A

1 byte

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

Memory used for char

A

2 bytes

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

Memory used for short

A

2 bytes

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

Memory used for int

A

4 bytes

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

Memory used for long

A

8 bytes

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

Memory used for float

A

4 bytes

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

Memory used for double

A

8 byte

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

scientific notation or floating-point notation

A

The literals with an e or E (for exponent) 3.67e5

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

You can assign a value of any type in the following list to a variable of any type that appears further down in the list:

A

byte -> short -> int -> long -> float -> double

17
Q

Operators are classified based on how many operands they take.
The classes are:

A

unary (one operand),
e.g.-12, a++, !flag
binary (two operands),
e.g. a * b, c&raquo_space; 1, f || g
ternary (three operands),
e.g. flag ? “YES” : “NO”

18
Q

Java allows to form expressions using variables, constants, and the arithmetic operators:

A

+ (addition), − (subtraction), ∗ (multiplication),
/ (division), % (modulo, remainder)

19
Q

Java Precedence Rules

A

expr++, -expr∼ !, * / %, + -, shift, < > <= >= instanceof, == !=, &, ^, |, &&, ||, ? :, = +=

20
Q

associativity rules

A

Unary operators have right to left associativity,
Binary operators have left to right associativity,
Assignment operators (unlike the other binary operators) have
right to left associativity,
The ternary operator has right to left associativity

21
Q

postfix

A

increment and decrement expressions evaluate to the
existing value of the variable and only afterwards update it

22
Q

prefix

A

increment and decrement expressions first update the value of the variable and then evaluate to this value

23
Q

raional operators

A

==, >, <

24
Q

logical operators

A

! NOT, negation
|| Logical OR, disjunction
&& Logical AND, conjunction

25
Q

short-circuited logical operators

A

&& ||
stop the evaluation as soon as the result is determined

26
Q

long-circuited logical operators

A

& |
always evaluateboth operands, regardless of the result of the first operand

27
Q

type casting

A

(Type)Expression

28
Q
A