Chapter 2: Elementary Programming Flashcards

1
Q

What is an algorithm?

A

A well-defined sequence of steps that goes over the outline of your program.

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

What is the “Main Method” in a Java program?

A

It is the entry point and spot where your program begins execution.

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

What is a variable?

A

A value stored inside the computer’s memory.

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

How do you connect a string that takes up multiple lines?

A

At the end of the first line, use “+” and then continue the string on the next line.

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

How do you create and read a new System.in input value?

A
Use the Scanner class to create an object.
import java.util.Scanner;
Scanner input = new Scanner(System.in);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Explain the difference between a wildcard import and a specific import.

A

A wildcard import will import ALL the classes in a package while a specific import will only import the single class that is specified from the package. There is no performance difference.

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

Explain an Identifier.

A

An Identifier is the name of anything that appears in your program (class, method, integer, etc.) It must start with a letter, _, or $, but can’t start with a digit.

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

Explain a variable.

A

A value in your program that can be changed. A variable must be declared and initialized before it can be used.

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

What is a named constant?

A

An identifier that represents a value that is permanent. It can’t be changed.

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

List the numeric operators of Java.

A

Addition (+), Subtraction (-), Multiplication (*), Division (/), and Remainder (%).

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

Name some uses of the Remainder operator.

A

It can be used to determine whether a number is even or odd. You can also use it as a way to find out what day of the week you will be on in a certain number of days using a remainder of 7.

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

How to compute exponents?

A

You can use the Math.pow method from the Math class of the Java API.
Value a is the base, value b is the exponent.
EG: Math.pow(a, b);

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

What is JShell?

A

JShell is a command line tool that allows you to quickly evaluate an expression or executing a statement without making an entire class.

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

What are increment and decrement operators?

A

They will add or subtract the value by 1. The increment operator is (++), and the decrement operator is (–).

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

Explain type casting.

A

Type casting is converting one value type to another within the program. Java will automatically widen types for you, but narrowing types must be done yourself.

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

What is the software development process?

A

A multistep process that includes system requirements, analysis, design, implementation, testing, deployment, and maintenence.