Java Programming Chapter 3

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

What are the three types of programming errors?

- Syntax Errors - Runtime Errors - Logic Errors

What is the 'test' of a loop?

The Boolean expression inside a loop.

What is the break statement used for?

when a break statement is encountered inside a loop, the loop is immediately terminated and the test resumes at the next statement following the loops.

try-catch

A Java construct that supports handling of exceptions. Java makes it possible to 'catch' such errors and program a response different from simply letting the program crash.

What is a block in java?

A control structure that groups sequences of statements into a single statement.

what is the for loop designed to do?

A for loop is a control statement for specifying iteration, which allows code to be executed repeatedly. For loops are typically used when the number of iterations is known before entering the loop. The for loop makes a common type of while loop easier to write.

What is a for each loop?

A loop used to perform the same processing on each of the enum constants that are possible values of an enumerated type.

What is an algorithm?

A set of well-defined logical steps that must be taken to perform a task.

What is a local variable?

A variable that is declared within a function and cannot be accessed by statements that are outside of the function. In addition, a local variable cannot be accessed by code that appears inside the function at a point before the variable has been created.

What does a switch statement do?

Allows multi-way branching. In many cases, using a switch statement can simplify a complex combination of if-else statements. - switch statements are often used with menus. A menu is a list of options. The user selects one of the options. The computer has to respond to each possible choice in a different way.

What is a bug?

An error in a program.

What is a branching statement? Name the two branching statements.

Branching statements are used to change the normal flow of execution based on some condition. The two branching statements are if/else & switch.

What are the exceptions?

Exceptions are errors and other events that disrupt the execution of code.

What is a labeled break statement?

It allows you to specify which loop you want to break in a nested loop.

What does the while statement do?

It loops through a block of code if and as long as a specified condition is true. The while loop tests the condition before the code within the block is executed

What is an if statement?

The command that allows you to make a decision based on true or false conditions

What does a do while loop do?

The do..while loop is an exit condition loop. This means that the code must always be executed first and then the test condition is evaluated. If true, the code executes the body of the loop again.

What is an if/else statement?

The if/else statement executes a block of code if a specified condition is true. If the condition is false, another block of code can be executed.

What is the body of a loop?

The portion of a while statement loop that is repeated so long as the Boolean-expression is true

What is stepwise refinement?

The process of breaking a problem down into progressively smaller pieces.

How many control statements are there? List them.

There are 12 Control Structures: - if - if else - for - while - do-while - Exception - try-catch..finally - switch - break - continue - return - labels

What is a control structure?

a logical design that controls the order in which a set of statements execute

What is a nested loop?

a loop inside another loop

what is the while loop designed to do?

to run until a condition is FALSE; for (initial expression; condition; closing expression) {statement(s);}


Ensembles d'études connexes

Chapter 10: Customer Relationship Management

View Set

1.18 L'alfabeto e lo Spelling con i Nomi di Città Italiane

View Set

Unit B: Metabolism Practice Quiz

View Set

Chapter 9-Managing Linux Processes

View Set