Comprog2 Flashcards

1
Q

java history

A
  • created by James Gosling
  • green team
  • green project
  • in 1991 (Sun Microsystems)
  • initially called “oak” (in honor for the tree outside Gosling’s window)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

java characteristics

A

simple
object-oriented
distributed
architecture neutral
portable
high-performance
interpreted
robust
secure
multi-threaded
dynamic

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

program’s source file?

A

compile-time environment

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

program’s class file?

A

run-time environment

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

parts of Java’s simple code

A

multi-line comment
package name
class header
main method
program body

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

simple code interpretation

A

/*
*
*/
package unes;
public class Unes {
public static void main (String [ ] args) {
System.out.println(“Hi”);
}
}

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

what is a variable?

A

an item of data used to store state of objects

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

a variable has?

A

a data type and a name

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

these are case-sensitive

A

variable names

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

it may be letters, digits, dollar signs, or underscore characters

A

subsequent characters

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

if the name you choose consists of only one word, spell that word in?

A

all lowercase letters

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

java primitive data types

A

logical - Boolean
textual - char
integral - byte, short, int, and long
floating point - float and double

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

they represent simple values that have built-in functionality in the language​

A

primitive data types

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

they represent simple values such as numbers, Booleans, and characters

A

primitive data types

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

name of place in memory that can contain data​

A

variable

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

kind of data variable can contain

A

data type

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

identifier that refers to the variable

A

name

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

the default or specified value​

A

value

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

also called the literal of the statement

A

value

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

all Java statements end with a?

A

semicolon ;

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

how to declare a variable?

A

data type name;

int grade;​
double ave1, ave2;​
boolean isVerified;​

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

= is called?

A

an assignment operator

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

== is called?

A

a comparative equals

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

if variable is not initialized, most will default to ____. All variables should be initialized

A

null

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
operators in java
arithmetic operators​ relational operators​ logical operators​ assignment operators​ string operator​
26
used in mathematical expressions in the same way that they are used in algebra
arithmetic operators
27
used to concatenate any number of strings, on either side of the string​
+ operator
28
link (things) together in a chain or series​
concatenate
29
create a code that will have an output: I am Michelle Eunice
1 public class concatStr {​ 2 public static void main(String[] args) {​ 3 String n1 = “Michelle”;​ 4 String n2 = “Eunice”;​ 5 String name = n1 + “ ” + n2;​ 6 System.out.println(“I am ” + name);​ 7 }​ 8 }​
30
used to decrement/increment variable value by 1 after assigning the value to the variable​
post decrement/increment operator
31
used to decrement/increment variable value by 1 before assigning the value to the variable
pre decrement/increment operator
32
a character preceded by a backslash (\) and has a special meaning to the compiler
escape sequence
33
insert a tab
\t
34
insert a backspace
\b
35
insert a newline
\n
36
insert a carriage return
\r
37
insert a form feed
\f
38
insert a single quote character
\'
39
insert a double quote character
\"
40
insert a backslash character
\\
41
errors in java
syntax error​ run time error​ semantic error​
42
also called compile time error​
syntax error
43
these are errors where the compiler finds something wrong with your program, and you can't even try to execute it
syntax error
44
detected during the execution of the program
run time error
45
occur when a program does not contain any syntax errors but asks the computer to do something that the computer is unable to reliably do
run time error
46
also called logic error
semantic error
47
happens when your program compiles and executes, but does the wrong thing or returns an incorrect result or no output when it should be returning an output
semantic error
48
caused by an incorrect idea or concept used by a programmer while coding​
semantic error
49
you must put this to help you figure out what the program is actually doing
print statements
50
you must use this to step through your program and watch what it does
debugger
51
it is similar to decision-making in real life
decision-making in programming
52
uses control statements to control the flow of execution of program based on certain conditions
programming language
53
java's selection statements
if​ if-else​ if-else-if​ nested-if​ switch-case​ jump – break, continue, return​
54
the most simple decision making statement. It is used to decide whether a certain statement or block of statements will be executed or not
if statement
55
an optional companion to the if statement that can extend its usefulness
else statement
56
a user can decide among multiple options
if-else-if ladder statement
57
the statement executed as a result of an if statement or else clause could be another if statement
nested if statements​
58
it does not determine which if and else matches with, it is determined by the curly brackets
indentation
59
provides another way to decide which statement to execute next
switch statement​
60
used as the last statement in each case's statement list
break statement​
61
it is a reserved word in Java
break
62
causes control to transfer to the end of the switch statement​
break statement
63
a switch statement can have an optional ____?
default case​
64
it has no associated value and simply uses the reserved word default​
default case
65
though it can be positioned anywhere in the switch statement, it is usually placed at the end​
default case