Starting Out with Java From Control Structures through Data Structures Test #2 - Chapter 4

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

for loop

A type of loop is ideal in situations where the exact number of iterations is unknown

Post-test loop

A type of loop will always be executed at least once

Sentinel

A value that signals when the end of a list values has been reached

Open a file names MyFile.txt and allows you to append data to its existing contents

FileWriter fwriter = new FileWriter("MyFile.txt", true); PrintWriter outFile = new PrintWriter(fwriter);

PrintWriter outputFile = new PrintWriter("StudentData.txt);

StudentData.txt is the file name

PrintWriter class

a class allows you to open a file for writing

user controlled loop

a loop asks the user whether he or she wants to repeat the process

An infinite loop

a loop does not contain within itself a way to terminate

infinite loop

a loop does not have a way of stopping

nested loop

a loop that is inside another loop

count-controlled loop

a loop that repeats a specific number of times

exception

a signal indicating that the program cannot continue until the unexpected event has been dealt with

continue

a statement causes a loop to stop its current iteration and begin the next one

break

a statement causes a loop to terminate early

counter variable

a variable keeps a count of the number of iterations

while, for

are pre-test loops

text file

contains data that has been encoded as text, using a scheme such as Unicode

number-- and --number

decrements the variable number

conditional loop

executes as long as a particular condition exists

import java.io.*;

file input and output

while loop

has two parts. (1) a boolean expression that is tested for a true or false value, and (2) a statement or block of statements that is repeated as long as the expression is true.

number++ and ++number

increments the variable number

loop

is a control structure that causes a statement or group of statements to repeat

input file

is a file that a program reads data from

output file

is a file that a program writes data to

do-while loop

is a posttest loop, which it does not test its boolean expression until it has completed an iteration

buffer

is a small "holding section" of memory

Sentinel Value

is a special value that cannot be mistaken as a member of the list and signals that there are no more values t be entered

running total

is a sum of numbers that accumulates with each iteration of a loop

delimiter

is an item that separates others items

input validation

is the process of inspecting data given clear instructions about kind of input that is acceptable, and not assume the user has followed those instructions

print method

is used to write an item of data to file without writing the newline character

number--

number minus minus

number++

number plus plus

number

the control variable in this loop

initialization expression

the first expression

loop header

the first line of the for loop

postfit mode

the operator is placed after the variable

prefit mode

the operator is placed before the variable

priming read

the read operation that takes place just before the loop

test expression

the second expression

update expression

the third expression

accumulator

the variable used to accumulate the total of the numbers

pretest loop

the while loop, which means it tests it's expressions before each iteration

FileWriter fwriter = new FileWriter("MyFriends.txt", true)

this statement causes a FileWriter object and opens the file MyFriends.txt for writing,

Assume that inputFile references a Scanner abject that was used to open a file.

while (inputFile.hasNext()); {.....}


संबंधित स्टडी सेट्स

ISBB Chapter 4 - Data and Databases

View Set

olecranon bursitis , repetitive strain injury ,Epicondylitis, De Quervain’s tenosynovitis i

View Set

Chapter 8 Chemical Equations and Reactions

View Set

Principles on Investigation Revel Chapter 1, 2, 3, 4, 5, 19, 6, 7, 8, 9

View Set