For Loops and Control Structures

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Break Statement

Terminates the loop and transfers execution to the statement immediately following the loop.

Conditional Statement

A conditional statement allows a choice from a selection of statements.

Continue

Causes the loop to skip the remainder of its body and immediately retest its condition prior to reiterating.

If conditional - terms

Checks an expression for a boolean value before running a bit of code if true.

While loop - terms

Executes a bit of code over and over while an expression or variable is true.

A conditional statement uses the keywords start and end to mark the beginning of the conditional statement and to separate the two sub-statements.

False

It is not possible for a conditional statement not to have an else-clause.

False

For loop - term

Loops a segment of code based on the value of a determined variable.

if (x == 0) System.out.println("zero"); if (x != 0) System.out.println("non-zero");

Prints "zero" if x has the value 0, prints "non-zero" otherwise.

switch (x) { case 0: System.out.println ("zero"); break; default: System.out.println ("non-zero"); break;

Prints "zero" if x has the value 0, prints "non-zero" otherwise.

if (x == 0) System.out.println("zero");

Prints "zero" if x has the value 0.

The first substatement is to be executed if the expression in the condition evaluates to true.

True

The words "if" and "else" are reserved words in Java.

True

When formatting computer programs we will normally use ______-space indentation to convey hints to the reader about statement structure.

blank

For loop - syntax

for(i = 0, i < 10, i++);

If conditional - syntax

if(i == 10);

These two sub-statements are referred to as the ____-statement and the ____-statement respectively.

then, else

While loop - syntax

while(i != 10);


Set pelajaran terkait

Sadlier-Oxford Vocabulary Workshop Level E all words

View Set

CEH Chapter 6 Practice Questions

View Set

University of North Dakota Psychology 111 Final

View Set

AP Euro History: Chapter 12.3-12.4 Quiz

View Set

Series 6: Retirement Plans (Retirement Plan Overview)

View Set

CompTIA Security+ (SY0-601) Bootcamp - Your preparation for the world's best cybersecurity certification!

View Set

PATHO Chapter 12 HIV disease and AIDS

View Set

Intro. Health Information Management: Chapter 10

View Set