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
Q

operators in java

A

arithmetic operators​
relational operators​
logical operators​
assignment operators​
string operator​

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

used in mathematical expressions in the same way that they are used in algebra

A

arithmetic operators

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

used to concatenate any number of strings, on either side of the string​

A

+ operator

28
Q

link (things) together in a chain or series​

A

concatenate

29
Q

create a code that will have an output:
I am Michelle Eunice

A

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
Q

used to decrement/increment variable value by 1 after assigning the value to the variable​

A

post decrement/increment operator

31
Q

used to decrement/increment variable value by 1 before assigning the value to the variable

A

pre decrement/increment operator

32
Q

a character preceded by a backslash () and has a special meaning to the compiler

A

escape sequence

33
Q

insert a tab

A

\t

34
Q

insert a backspace

A

\b

35
Q

insert a newline

A

\n

36
Q

insert a carriage return

A

\r

37
Q

insert a form feed

A

\f

38
Q

insert a single quote character

A

'

39
Q

insert a double quote character

A

"

40
Q

insert a backslash character

A

\

41
Q

errors in java

A

syntax error​
run time error​
semantic error​

42
Q

also called compile time error​

A

syntax error

43
Q

these are errors where the compiler finds something wrong with your program, and you can’t even try to execute it

A

syntax error

44
Q

detected during the execution of the program

A

run time error

45
Q

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

A

run time error

46
Q

also called logic error

A

semantic error

47
Q

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

A

semantic error

48
Q

caused by an incorrect idea or concept used by a programmer while coding​

A

semantic error

49
Q

you must put this to help you figure out what the program is actually doing

A

print statements

50
Q

you must use this to step through your program and watch what it does

A

debugger

51
Q

it is similar to decision-making in real life

A

decision-making in programming

52
Q

uses control statements to control the flow of execution of program based on certain conditions

A

programming language

53
Q

java’s selection statements

A

if​
if-else​
if-else-if​
nested-if​
switch-case​
jump – break, continue, return​

54
Q

the most simple decision making statement. It is used to decide whether a certain statement or block of statements will be executed or not

A

if statement

55
Q

an optional companion to the if statement that can extend its usefulness

A

else statement

56
Q

a user can decide among multiple options

A

if-else-if ladder statement

57
Q

the statement executed as a result of an if statement or else clause could be another if statement

A

nested if statements​

58
Q

it does not determine which if and else matches with, it is determined by the curly brackets

A

indentation

59
Q

provides another way to decide which statement to execute next

A

switch statement​

60
Q

used as the last statement in each case’s statement list

A

break statement​

61
Q

it is a reserved word in Java

A

break

62
Q

causes control to transfer to the end of the switch statement​

A

break statement

63
Q

a switch statement can have an optional ____?

A

default case​

64
Q

it has no associated value and simply uses the reserved word default​

A

default case

65
Q

though it can be positioned anywhere in the switch statement, it is usually placed at the end​

A

default case