CMSC131

30 flashcardsby tdmillington
Study these flashcardsFree · spaced repetition · iPhone, Android, Mac & web

All cards

1
compiler
Programs for translating programs ("source code") into assembler/machine code
2
interpreter
Way to execute a program, taking the source code as input and executing the source directly
3
Java
An object-oriented programming language developed in the early 1990s
4
What makes Java different from C++?
Java programs are portable between machines as they are compiled into Java bytecode, which can read and executed by a JVM interpreter
5
rules for names in Java
must begin with a letter, dollar sign, or underscore; followed by zero or more letters, dollar signs, underscores, or digits
6
What is the difference between int, float, and double?
int ranges from -2 billion to 2 billion, only integers
float does real numbers with 7 digits of precision
double does real numbers with 15 digits of precision
7
boolean
A one-byte data meaning true or false
8
remainder of x divided by y
x % y
9
How do you find if string s equals string t?
s.equals(t)
10
How do you find the length of string s?
s.length()
11
How do you compare string s to string t lexicographically?
s.compareTo(t)
12
How do you create a scanner that reads until the next whitespace?
next()
13
writing an if statement
if (condition) {
statements;
}
14
writing an if-else statement
if (condition) {
statements1 if true
} else {
statements2 if false
}
15
What is the logical operator for and? or? not?
and is &&, or is ||, and not is !
16
How do you increase/decrease a variable by one? by more than one?
Increase by one: variable++
Decrease by one: variable--
Increase by more than one: variable+=
Decrease by more than one: variable-=
17
while loops
While loops contain a statement (body) and a boolean condition
The body is executed as long as the condition is true, and is tested before each execution
18
do-while loops
Do-while loops contain a statement (body) and a boolean condition
The body is executed as long as the condition is true, and is tested after each execution
19
indefinite iteration loop
tests something that is coming from outside of the loop structure; needs to eventually change from true to false
20
counted iteration loop
tests something that is controlled inside the loop; starts at some value and counts up and down until some set ending point
21
trace tables
mechanisms to keep track of values in a program; allows you to understand program behavior
22
for-loops
a counter is set, the condition is tested before each body execution, and the update is performed at the end of each iteration
written as for (initialization; condition; update) {
23
types of methods
static (can be called without creating an object) and non-static (need an object to call them)
24
general format for methods
public static (RETURN TYPE) name (PARAMETER LIST) {
25
difference between public and private methods
public --> anyone can call/execute the method; private --> only other methods of the class can call the method
26
void methods
do not return a value
27
parameters
parameters are variables decalred in () following a method name
when a method is called, and before the first statement in the method is executed, the parameters are initialized with any values present in the method being called
28
prototype
the first line of a method; provides the return type, name, and parameters
29
precedence
which operators take their operands first; higher-precedence rules answer this question (ex. PEMDAS)
30
associativity
determines which operators take operators first when operators have the same precedence
two kinds: left-associativity (operators take operands from left to right) and right-associativity (operators take operands from right to left)
Study all 30 cards for free