With Correct Answers Already Passed
2025|2026!!!!
Data object CORRECT ANSWERS a box in memory that holds one value
Type CORRECT ANSWERS the range of values that a data object can hold (int, float,
double, boolean, char,string)
Variable CORRECT ANSWERS the name of a data object
Identifier CORRECT ANSWERS used to name something (variables, classes,
packages, interfaces) must start with a letter, underscore, or dollar sign. Can contain
numbers. May not contain spaces. Variables start with lower-case letters, classes start
with upper-case letters, literals are all upper-case.
Definition CORRECT ANSWERS creates a data object and assigns it a type
declaration CORRECT ANSWERS binds a variable to a data object
Initialization CORRECT ANSWERS giving a variable a value
Primative data types CORRECT ANSWERS atomic, values not divisible into smaller
parts (int, double, boolean, char, byte, short, long, and float)
Assignment Statement CORRECT ANSWERS used to change the value stored in a
data object
Expressions CORRECT ANSWERS combine operators, variables, literals, and method
invocations. They evaluate to a single value
Literals CORRECT ANSWERS a symbol that evaluates to itself
Constants CORRECT ANSWERS a named literal (ex PI = 3.1415926)
Relational operators CORRECT ANSWERS compare two values ( int, boolean, or
double) and return true or false depending on how they compare
Conditional Evaluation CORRECT ANSWERS ex. if-else statement
Compound statement CORRECT ANSWERS doing more than a single statement within
an if else statement, you create a block of statements or compound statement
, Multi-way statement CORRECT ANSWERS if{} else if {} statements
Switch Statement CORRECT ANSWERS implements multi-way branches based on the
value of an expression.
switch (class) {
case 1: System.out.println("COSC 150"); break;
case 2: System.out.println("COSC 160"); break;
}
Multi-way If vs Switch CORRECT ANSWERS The switch statement is more compact
than the multi-way if statement.
It should be used when the code to be done is based on the value of an int or char
expression.
However, the switch statement cannot be floating point expressions and so the multi-
way if statement must be used.
The switch statement may be used for strings in Java SE 7 and later.
Count controlled loops CORRECT ANSWERS when you know ahead of time how many
times to loop (for)
Sentinel controlled loops CORRECT ANSWERS when reading until a special value, the
sentinel (While)
general condition loops CORRECT ANSWERS arbitrary loops, loops while a condition
is true
iterations CORRECT ANSWERS number of times the loops is to be executed
break statement CORRECT ANSWERS can be used to jump out of a loop prematurely
continue statement CORRECT ANSWERS will cause the program to skip over any
remaining part of the loop body and begin the next iteration of the loop
return statement CORRECT ANSWERS will exit the method that the loop is in
arrays CORRECT ANSWERS a data object that can hold multiple objects all of the
same type that use static allocation of space
for each statement CORRECT ANSWERS enhanced for statement, designed to iterate
through collections and arrays int[] numbers;
for(int item : numbers)
Selection Sort CORRECT ANSWERS we select the smallest element and put it in the
right place. O(n) swaps; O(n^2) comparisons; Best for small values of N.