click below
click below
Normal Size Small Size show me how
Comp. Prog. ch5-8
Computer Programming chapters 5-8
| Question | Answer |
|---|---|
| More commonly, a section of code that's repeated is referred to as a ____ because after the last statement int he code is exedcuted, the program brances, or loops, back to the first statement and starts another repetition. | loop |
| Each repetition is also referred to to as an ______ or a _______. | iteration, pass through the loop |
| A ______ both defines the boundaries of the repeating section of code and controls whether the code will be executed. | repetition statement |
| A _____ condition is tested before any statements in the loop are executed. | pretest loop |
| A loop that evaluates a condition at end of the repeating section of code is referred to as ____ or ______. | posttest, exit-controlled loop |
| In a _____, the condition is used to keep track of how mny repetitions have occurred. | fixed-count loop |
| In a _____, the tested condition doesn' depend on a count being reached, but on a variable that can change interactively with each pass through the loop. | variable-condition |
| An _____ is a loop that never ends: the program just keeps displaying numbers until you realize it isn't working as you expected. | infinite loop |
| In a ______ the expression in parentheses is the condition tested to determine whether the statement following the parentheses is executed. | while loop Ex. while(expression) |
| In computer programming, data values used to signal the start or end of a data series are called ____. | sentinels |
| A _______, as its name impleies, forces an immediate break, or exit, from the switch, while, for, and do-while statements. | break statement |
| The ______ is similar to the break statement but applies only to loops created with while, do-while, and for statements. | continue statement |
| All statements must be terminated by a semicolon. A semicolon with nothing preceding it si also a valid statement, called the _______. | null statement |
| The _____ performs the same functions as the while statement but uses a different form. | for loop Ex. for(i=0; i<10; i++) |
| In many situations, using a loop within another loop, called _____, is convenient. | nested loop |
| The first loop of a nested loop, controlled by the value of i, is called _____. | outer loop |
| The second loop of a nested loop, controlled by the value of j, is called ______. | inner loop |
| The function findMax() is referred to as the _____ because its' called or summoned into action by its reference in main(). | called function |
| The function that does the calling, in this case main(), is referred to as the _____. | calling function. |
| The declaration statement for a function is referred to as a ______. | function prototype. |
| The items enclosed in parentheses are called _____ of the called function. | arguments Ex. void findMax(int x, int y) |
| The names in parentheses int eh header are called the ______ of the function. | formal parameters Ex. void findMax(int x, int y) |
| The primary use of _______ is to extend the parameter list of existing functions without requiring any change int eh calling parameter lists already used in a program. | default arguments |
| C++ provides the capability of using the same function name for more than one function, referred to as _____. | function overloading |
| The line, called _______, is used to inform the compiler that the function immediately following is a template using a data type named T. | template prefix Ex. template<class T>. |
| Using a method of pasing data to a function explained in the previous section,the called function receives only copies of the values contained in arguments at the time of the call, which is called ______. | passed by value |
| The _____ creates the convenience for a group repeating lines of code together under a common function name and have the compiler place this code in the program wherever the function is called. | inline functions Ex. Inline double tempvert(double inTemp). |
| In a typical function invocation, the called function receives values from its calling function, toes and manipulates the passed values , and directly returns at most one value, and this is called ______. | passed by value |
| Passing addresses is referred to as a function ________ because the called function can reference, or access, the variable whose address has been passed. | pass by reference |
| Exchanging values in two variables is accomplished by using the three-step exchange algorithm: | 1. save the first parameter's value in a temporary location. 2. store the second parameter's value in the first variable. 3. store the temporary value in the second parameter. |
| Because the variables created in a function are conventionally available only to the function, they are said to be local to the function, or _________. | local variables. |
| Local variable refers to _____ of an identifier; ______ is the section of the program where the identifier, such as a variable, is valid or "known". | scope, scope |
| A variable with ______, more commonly termed a ______, has storage created for it by a declaration statement located outside any function. | global scope, global variable |
| In addition to the space dimension represented by scope, variables have the time dimension taht refers to the length of time storage locations are reserved for a variable, and this is called ____. | lifetime |
| Where and how long a variable's storage locations are kept before they re released can be determined by the variable's ______. | storage category |
| A local variable delcared as _____ causes the program to keep the variable and its latest value even whent he function that declared it has finished executing. | static |
| Because local static variables retain their values, they aren't initialized in a declaration statement int he same way as automatic variables. This procedure is called _____. | runtime initialization |
| Most computers also have a few high-speed storage areas, called ______, located in the CPU that can also be used for variable storag. | registers |
| The four available storage categories are ____, _____, ____, and ______. | auto, static, extern, register |
| The variables called key , count, and grade are of different data types, each variable can store only one value of the declared type. These types of variables are called _______.(also referred to as __________). | atomic variables, scalar variables |
| A _______, also referred t as a ______, is a list of related values, all having the same data type, that's stored with a single group name. | one-dimensional array, single-dimensional array |
| In C++, as in other computer languages, the group name is referred to as the _______. | array name |
| Each in an array is called ______ or a ______- of the array. | element, component |
| Each element is referred to as an _______ or a ______ because both a variable name and an index or a subscript value must be sued to reference the element. | indexed variable, subscripted variable |
| One caution about storing data in a n array: C++ doesn't check the value of the index being used(called_______). | bounds check |
| The last character of an array, the escape sequence \0, is called the ______. | null character |
| A _______, sometimes referred to as a table, consists of both rows and columns of elements. | two-dimensional array |
| To meet need of providing tested and generic set of data structures that can be modified, expanded, and contracted, C++ includes a useful set of classes in its ______. | Standard Template Library(STL) |
| Each STL class is coded as a template that permits construcing a generic data structure, referred to as a ______. | container |
| The term ____ and ___ are synonyms for a container, and both these terms refer to a set of data items that form a natural unit or group. | list, collection |
| A _____ is similar to an array, in that it stores elements that can be accessed by using an integer index starting at 0. | vector |
| The STL provides additional items referred to as _____, used to specify which elements in a container are to be operated on when an algorithm is called. | iterators |
| The ______ header is required to create and use cout. | <iostream> |
| The ______ header is required for constructing strings. | <string> |
| The ______ header is required to create one or more vector objects. | <vector> |
| The ______ header is required for the sort algorithm that's applied after vector elements have been added and replaced. | <algorithm> |
| In a ______, also known as a ______, each item in the list is examined in the order in which it occurs until the desired item is found or the end of the list is reached. | linear search, sequential search. |
| In a ______, the list must be in sorted order. Starting with an ordreed list, the desired item is first compared to the leement in the middle of the list. | ______ are used when he data list isn't too large and the complete list can be stored in teh computer's memory. |
| _____ are used ofr much larger data sets that are stored in external disk or tape files and can't be accommodated in the computer's memory as a complete unit. | External sorts |
| One of the simplest sorting techniques is the ______, in which the smallest value is selected fromt eh complete list of data and exchanged with the first eleemnt in teh list. | selection sort. |
| In an _____, adjacent elements of the list are exchanged with one another so that the list becomes sorted. | Exchange Sort |
| One exaple of the exchange sort is the ____, in which successive values in the list are compared, beginning with the first two elements | bubble sort |
| A ____ is a collection of data stored together under a common name, usually on a disk, magnetic tape, USB drive, or CD/DVD. | file |
| A file is physically sotred on an external medium, such as a disk. Each file has a unique filename, referred to as the file's _____. | external name |
| Two basic types of files exist: _____, also known as _____, and _____. | text files, character-based files, binary-based files. |
| A _____ is a one-way transmission bath used to connect a file stored on a physical device such as a disk or CD, to a program. | file stream |
| A file stream that receives or reads data from a file to a program is an ______. | input file stream |
| A file stream that sends or writes data to a file is an ______. | output stream |
| These methods include connecting a stream object name to an external filename(called ______), determing whether a successful connection has been made, closing a connection(called ______), getting the next data item into the program from an input stream. | opening a file, closing a file |
| A file connected to an output file stream creates a new file, said to be in _____, and makes the file available for output. | output mode. |
| A file opened for input is said to be in ______ or _______. | read mode, input mode |
| An fstream file object opened in _____ means an existing file is available for data t be added to the end of the file. | append mode |
| For writing to a file, the cout object is replaced by the _____ object name delcared int he program. | ofstream |
| Reading data from a character-based file is almost identical to reading data from a standar keyboard, except the cin object is replaced by the ifstream object declared in the program. | ifstream |
| The _____ returns the next character extracted from the input stream as an int. | get() |
| The _____ overloaded version of get() that extracts the next character from teh input stream and assaigns it to the specified character variable, charVar. | get(charVar) |
| The _____ extracts character from the specified input stream, fileObject, until the terminating character termChar, is encountered. | getline(fileObject, strObj, termChar) |
| The _____ returns the next character in the input stream without extracting it from the stream. | peek() |
| The ____ skips over the next n characters. If n is omitted, the default is to skip over the next single character. | ignore(int n) |
| A ______ is a stream that connects a file of logically relatd data, such as a data file, to a program. | logical file object |
| The actual physical device assigned to your program for data entry is formally called the _____. | standard input file |
| A ____ is a stream th at conect to hardware device, such as a keyboard, screen, or printer. | physical file object |
| When a cou object method call is encountered, the outputis automatically displayed or "written to" a device that has been assigned as the ______. | standard output file. |
| The term _____ refers to the process of retrieving dat a from a file. | file access |
| he term _____ refers to the way data is stored in a file. | file organization |
| The files you have used, and will continue to use, have a ______, meaning characters in the file are stored in a sequential manner. | sequential organization |
| Each open file has been read in a sequential manner, meaning characters are accessed one after another, which is called ______. | sequential access |
| In ______, any character in the opened file can be read without having to sequentially read all characters stored ahead of it first. | random access |
| A character's position is referred to as its ______. | offset |
| By adding a ______ function to perform the open. | getOpen() |
| If the file exists, the _____ method indicates a successful open(that is, the open doens't fail), which indicates the file is available for input. | fail() |
| A _____ is a section of OS code that accesses a hardware device, such as a disk, and handles the data transfer between the device and the computer's memory. | device driver |
| A class named _____ is derived form the ios class. This class uses the ______ class, requires the ________ header file, and provides capabilities for writing and reading strings to and from in-memory defined streams. | strstream, strstreambuf, strstream |