Chapter 2 Flashcards

1
Q

Algorithm

A

lists the steps you can follow to solve a problem. They can help the programmer plan a program before writing it in a programming language.

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

Pseudocode

A

natural language mixed with some programming code

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

Main method

A

where program execution begins

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

Variable

A

A variable represents a value stored in the computer’s memory

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

Data types

A

the kind of data stored in a variable

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

Declaring variables

A

Defines a variable with a data type.

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

Primitive data types

A

or fundamental types. simple data types for representing integers, real numbers, characters, and Boolean types. (Byte, short,int, long,float,double,boolean,char).

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

Floating-point

A

How Real numbers (i.e., numbers with a decimal point) are represented.

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

Floating-point numbers

A

Real numbers.

you can use the keyword double to declare a floating-point variable.

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

Every Variable has..

A

Every variable has a name, a type, and a value

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

Tracing a program

A

reviewing how a program works. They are are helpful for understanding how programs work, and they are useful tools for finding errors in programs.

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

The value of a variable is..

A

not defined until you assign a value.

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

The plus sign (+) has two meanings:

A

for addition, and for concatenating (combining) strings

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

System.out to refers to

A

the standard output device

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

System.in refers to

A

the standard input device.

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

An output device is

A

is the display monitor

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

An input device is

A

is the keyboard.

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

To perform console output, you simply use

A

the println method to display a primitive value or a string to the console.

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

To perform console input, you need to use the

A

Scanner class to create an object to read input from System.in

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

Prompt

A

directs the user to enter an input

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

There are 2 types of import statements

A

specific import and wildcard import.

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

Specific import

A

specifies a single class in the import statement.

23
Q

Wildcard import

A

imports all the classes in a package by using the asterisk as the wildcard

24
Q

There is no performance difference between a specific import and a wildcard import declaration.

25
The information for the classes in an imported package is not read in at compile time or runtime unless the class is used in the program.
True
26
The import statement simply tells the compiler where to locate the classes.
True
27
Input is receiving input from the user; process is producing results using the input; and output is displaying the results.
True
28
Identifier
A name of a variable, method, class, interface, or package
29
An identifier is a sequence of characters that consists of letters, digits, underscores (_), and dollar signs ($)
True
30
An identifier must start with a letter, an underscore (_), or a dollar sign ($). It cannot start with a digit.
True
31
An identifier cannot be a reserved or Keyword.
True
32
An identifier can be of any length.
True
33
$2, ComputeArea, area, radius, and print are legal identifiers
True
34
Do not name identifiers with the $ character. By convention, the $ character should be used only in mechanically generated source code.
True
35
Every letter in a Java keyword is in lowercase
True
36
Variable values can be changed
True
37
The variable declaration tells
the compiler to allocate appropriate memory space for the variable based on its data type.
38
If variables are of the same type, they can be declared together
True
39
Scope of a variable
the part of the program where the variable can be referenced.
40
Variable must be declared and initialized before it can be used.
True
41
The equal sign (=) is
the assignment operator
42
An expression
is a computation involving values, variables, and operators that, evaluates to a value
43
A constant is
represents permanent data that never changes.
44
A constant must be declared and initialized in the same statement.
True
45
The word final is a Java keyword for declaring a constant.
True
46
Use lowercase for variables and methods
True
47
Capitalize the first letter of each word in a class name
True
48
Capitalize every letter in a constant, and use underscores between words
True
49
Double is known as
double precision
50
Float is known as
single precision
51
Operands
are the values operated by an operator
52
A unary operator has only
one operand
53
a binary operator has only
two operand
54
The Math.pow(a, b) method can be used to compute
ab.