1/35
Comprehensive review flashcards covering problem solving, algorithms, flowcharts, pseudocode, program development cycles, Java data types, identifiers, user input via Scanner, arithmetic, relational, and logical operators.
What is an algorithm?
An algorithm is a sequence of well-defined steps used to solve a problem or accomplish a task.
Why is it important for a programmer to create an algorithm before writing program code?
It acts as a roadmap for the program; without it, the programmer may fail to clearly visualize the instructions and develop a program that does not work as expected.
What are the five characteristics of a good algorithm?
Precision, Uniqueness, Finiteness, Input, and Output.
In algorithm design, what does the characteristic "Finiteness" mean?
It means the algorithm must always stop after a finite number of steps.
What is a flowchart?
A visual representation of an algorithm made up of boxes, diamonds, and other shapes connected by arrows that show the order or link among the steps.
What is the name and purpose of the oval or rounded rectangle shape in a flowchart?
It is called the Terminator symbol (or Start/End symbol) and indicates where the program flow begins and terminates.
In a flowchart, what function does a rectangle represent?
Also called the Action Symbol, it represents a process, an action, or a single calculation/step.
What flowchart shape is used to represent a decision or branching point?
A diamond shape, which poses a question (such as yes/no or true/false) and splits the path into two branches.
What is the parallelogram shape in a flowchart called, and what is its purpose?
It is called the Data symbol (or Input/Output symbol) and is used to input or output data.
What is pseudocode?
A non-formal language intended for human reading that describes computer instructions in a particular order and cannot be executed directly by the computer.
What are the three fundamental structures of flow control?
Sequence, Selection, and Repetition.
How is the "Selection" control structure defined?
It involves decision-making where conditions are evaluated to determine which path or branch of execution the program follows.
How does the "Repetition" control structure function in an algorithm?
It executes and repeats a set of steps continuously until a specified condition is met.
What is the technical definition of a computer?
An electronic device that accepts data as input, processes the data according to instructions, stores information when necessary, and produces output.
What is the primary difference between computer hardware and software?
Hardware refers to the physical components of a computer that can be seen and touched (such as the CPU, RAM, and keyboard), whereas software refers to programs and instructions that tell the hardware what to do.
What are the three core components of the IPO model?
Input (data provided to the program), Process (operations performed on the input), and Output (the information produced after processing).
What are the six sequential stages of the problem-solving process in programming?
What are the six phases of the program development cycle?
What is the difference between a syntax error, a logic error, and a runtime error?
A syntax error violates the language's grammar rules preventing compilation; a logic error allows the program to run but generates incorrect results; and a runtime error occurs during program execution, causing it to crash or fail to complete an operation.
In Java programming, what distinguishes direct variable declaration from indirect declaration?
Direct declaration declares and assigns a variable in a single statement (e.g., int age = 21;), while indirect declaration declares the variable first and assigns its value in a separate later statement (e.g., int sum; followed by sum = 80 + 90;).
What Java class and package are utilized to accept input from a user through the console keyboard?
The Scanner class from the java.util package (imported via import java.util.Scanner;).
Which Scanner method is used to read an entire line of text including spaces versus reading a single word?
nextLine() reads an entire line of text, while next() reads only a single word.
Which Scanner methods are used to read primitive integer, double-precision float, and boolean values?
nextInt() for int, nextDouble() for double, and nextBoolean() for boolean.
What is the purpose of relational operators in Java, and what data type do they evaluate to?
Relational operators are used to compare two values, and they evaluate to a boolean value (true or false).
What are the six relational operators in Java?
== (Equal to), != (Not equal to), > (Greater than), < (Less than), >= (Greater than or equal to), and <= (Less than or equal to).
What are the three logical operators in Java and their functions?
&& (AND, returns true only if both conditions are true), || (OR, returns true if at least one condition is true), and ! (NOT, reverses a boolean value).
What are the eight primitive data types supported in Java?
byte, short, int, long, float, double, boolean, and char.
What is the numeric storage range for the Java byte data type?
−128 to 127.
How do float and double data types differ in decimal precision?
float stores 6 to 7 decimal digits, whereas double stores 15 to 16 decimal digits.
What is the role of the var keyword in Java variable declarations?
It allows the compiler to automatically detect and assign the appropriate data type based on the initialization value.
What is an identifier in Java?
A name given to programming elements such as variables, classes, methods, packages, and interfaces to uniquely identify them in a program.
What are the naming rules and constraints for Java identifiers?
They can only contain alphanumeric characters ([A-Z], [a-z], [0-9]), $, and _; cannot begin with a digit; are case-sensitive; cannot be reserved words; and have an advisable optimum length of 4 to 15 letters.
Why are the identifiers "9color", "first-name", and "else" invalid in Java?
"9color" starts with a digit, "first-name" contains an illegal hyphen character (-), and "else" is a Java reserved keyword.
What is string concatenation in Java, and which operator performs it?
It is the process of joining two strings end-to-end to form a single string, performed using the addition operator (+).
What does the Java modulus operator (%) do?
It divides two numbers and returns the remainder of that division.

What will be printed to the console by the Java code shown in the image?
10, 10, 90, and 6 (each on a separate line).