Professional Documents
Culture Documents
Instant Download PDF Starting Out With C++ From Control Structures To Objects 8th Edition Gaddis Test Bank Full Chapter
Instant Download PDF Starting Out With C++ From Control Structures To Objects 8th Edition Gaddis Test Bank Full Chapter
https://testbankfan.com/product/starting-out-with-c-from-control-
structures-to-objects-8th-edition-gaddis-solutions-manual/
https://testbankfan.com/product/starting-out-with-c-from-control-
structures-to-objects-9th-edition-gaddis-solutions-manual/
https://testbankfan.com/product/starting-out-with-c-from-control-
structures-to-objects-7th-edition-gaddis-solutions-manual/
https://testbankfan.com/product/starting-out-with-c-from-control-
structures-through-objects-brief-version-8th-edition-gaddis-test-
bank/
Starting Out With C++ From Control Structures Through
Objects 7th Edition Tony Gaddis Test Bank
https://testbankfan.com/product/starting-out-with-c-from-control-
structures-through-objects-7th-edition-tony-gaddis-test-bank/
https://testbankfan.com/product/starting-out-with-c-from-control-
structures-through-objects-brief-version-9th-edition-gaddis-test-
bank/
https://testbankfan.com/product/starting-out-with-c-from-control-
structures-through-objects-brief-version-9th-edition-gaddis-
solutions-manual/
https://testbankfan.com/product/starting-out-with-java-from-
control-structures-through-objects-6th-edition-gaddis-test-bank/
https://testbankfan.com/product/starting-out-with-java-from-
control-structures-through-objects-7th-edition-gaddis-test-bank/
Starting Out with C++ from Control Structures to Objects, 8e (Gaddis)
Chapter 6 Functions
3) A function can have zero to many parameters, and it can return this many values.
A) zero to many
B) no
C) only one
D) a maximum of ten
E) None of these
Answer: C
1
Copyright © 2015 Pearson Education, Inc.
6) Functions are ideal for use in menu-driven programs. When a user selects a menu item, the program
can ________ the appropriate function.
A) call
B) prototype
C) define
D) declare
E) None of these
Answer: A
7) This type of variable is defined inside a function and is not accessible outside the function.
A) global
B) reference
C) local
D) counter
E) None of these
Answer: C
8) The value in this type of local variable persists between function calls.
A) global
B) internal
C) static
D) dynamic
E) None of these
Answer: C
9) These types of arguments are passed to parameters automatically if no argument is provided in the
function call.
A) Local
B) Default
C) Global
D) Relational
E) None of these
Answer: B
10) When used as parameters, these types of variables allow a function to access the parameter's original
argument.
A) reference
B) floating-point
C) counter
D) undeclared
E) None of these
Answer: A
2
Copyright © 2015 Pearson Education, Inc.
11) This statement causes a function to end.
A) end
B) terminate
C) return
D) release
E) None of these
Answer: C
12) ________ functions may have the same name, as long as their parameter lists are different.
A) Only two
B) Two or more
C) Zero
D) Un-prototyped
E) None of these
Answer: B
13) This function causes a program to terminate, regardless of which function or control mechanism is
executing.
A) terminate()
B) return()
C) continue()
D) exit()
E) None of these
Answer: D
3
Copyright © 2015 Pearson Education, Inc.
14) Given the following function definition:
c = a + 2;
a = a * 3;
b = c + a;
}
What is the output of the following code fragment that invokes calc?
int x = 1;
int y = 2;
int z = 3;
calc(x, y);
cout << x << " " << y << " " << z << endl;
A) 1 2 3
B) 1 6 3
C) 3 6 3
D) 1 14 9
E) None of these
Answer: B
Answer: D
16) It is a good programming practice to ________ your functions by writing comments that describe
what they do.
A) execute
B) document
C) eliminate
D) prototype
E) None of these
Answer: B
4
Copyright © 2015 Pearson Education, Inc.
17) A(n) ________ is information that is passed to a function, and a(n) ________ is information that is
received by a function.
A) function call, function header
B) parameter, argument
C) argument, parameter
D) prototype, header
E) None of these
Answer: C
19) A function ________ eliminates the need to place a function definition before all calls to the function.
A) header
B) prototype
C) argument
D) parameter
E) None of these
Answer: B
21) If a function is called more than once in a program, the values stored in the function's local variables
do not ________ between function calls.
A) persist
B) execute
C) communicate
D) change
E) None of these
Answer: A
5
Copyright © 2015 Pearson Education, Inc.
22) A ________ argument is passed to a parameter when the actual argument is left out of the function
call.
A) false
B) true
C) null
D) default
E) None of these
Answer: D
23) If a function does not have a prototype, default arguments may be specified in the function ________.
A) call
B) header
C) execution
D) return type
E) None of these
Answer: B
24) EXIT_FAILURE and ________ are named constants that may be used to indicate success or failure
when the exit() function is called.
A) EXIT_TERMINATE
B) EXIT_SUCCESS
C) EXIT_OK
D) RETURN_OK
E) None of these
Answer: B
26) This is a dummy function that is called instead of the actual function it represents.
A) main function
B) stub
C) driver
D) overloaded function
Answer: B
6
Copyright © 2015 Pearson Education, Inc.
27) What is the output of the following program?
#include <iostream>
using namespace std;
void showDub(int);
int main()
{
int x = 2;
showDub(x);
cout << x << endl;
return 0;
}
A) 2
2
B) 4
2
C) 2
4
D) 4
4
Answer: B
7
Copyright © 2015 Pearson Education, Inc.
28) What is the output of the following program?
#include <iostream>
using namespace std;
void doSomething(int);
int main()
{
int x = 2;
A) 2
0
2
B) 2
2
2
C) 0
0
0
D) 2
0
0
Answer: A
8
Copyright © 2015 Pearson Education, Inc.
29) What is the output of the following program?
#include <iostream>
using namespace std;
void doSomething(int&);
int main()
{
int x = 2;
A) 2
0
2
B) 2
2
2
C) 0
0
0
D) 2
0
0
Answer: D
9
Copyright © 2015 Pearson Education, Inc.
30) Which line in the following program contains the prototype for the showDub function?
1 #include <iostream>
2 using namespace std;
3
4 void showDub(int);
5
6 int main()
7 {
8 int x = 2;
9
10 showDub(x);
11 cout << x << endl;
12 return 0;
13 }
14
15 void showDub(int num)
16 {
17 cout << (num * 2) << endl;
18 }
A) 4
B) 6
C) 10
D) 15
Answer: A
10
Copyright © 2015 Pearson Education, Inc.
31) Which line in the following program contains the header for the showDub function?
1 #include <iostream>
2 using namespace std;
3
4 void showDub(int);
5
6 int main()
7 {
8 int x = 2;
9
10 showDub(x);
11 cout << x << endl;
12 return 0;
13 }
14
15 void showDub(int num)
16 {
17 cout << (num * 2) << endl;
18 }
A) 4
B) 6
C) 10
D) 15
Answer: D
11
Copyright © 2015 Pearson Education, Inc.
32) Which line in the following program contains a call to the showDub function?
1 #include <iostream>
2 using namespace std;
3
4 void showDub(int);
5
6 int main()
7 {
8 int x = 2;
9
10 showDub(x);
11 cout << x << endl;
12 return 0;
13 }
14
15 void showDub(int num)
16 {
17 cout << (num * 2) << endl;
18 }
A) 4
B) 6
C) 10
D) 15
Answer: C
int myFunction(double);
int myFunction(double);
12
Copyright © 2015 Pearson Education, Inc.
35) Look at the following function prototype.
#include <iostream>
using namespace std;
int getValue(int);
int main()
{
int x = 2;
A) 5
B) 2
C) 7
D) "getValue(x)"
Answer: C
13
Copyright © 2015 Pearson Education, Inc.
6.2 True/False Questions
1) True/False: When a function is called, flow of control moves to the function's prototype.
Answer: FALSE
3) True/False: A local variable and a global variable may not have the same name within the same
program.
Answer: FALSE
4) True/False: A static variable that is defined within a function is initialized only once, the first time the
function is called.
Answer: TRUE
5) True/False: It is possible for a function to have some parameters with default arguments and some
without.
Answer: TRUE
6) True/False: A function's return data type must be the same as the function's parameter(s).
Answer: FALSE
7) True/False: One reason for using functions is to break programs into manageable units, or modules.
Answer: TRUE
11) True/False: It is not considered good programming practice to declare all of your variables globally.
Answer: TRUE
12) True/False: You may use the exit() function to terminate a program, regardless of which control
mechanism is executing.
Answer: TRUE
14
Copyright © 2015 Pearson Education, Inc.
Another random document with
no related content on Scribd:
presence in the Synagogue is of comparatively modern date. The
ner tamid of the Sanctuary, however, is explained to be a lamp
burning “from evening to morning” (Exod. xxvii. 21). A golden
candlestick standing in the Sanctuary against the south side, with its
seven branches arranged from east to west, served this purpose.
According to Tradition it was the second branch, counting from east
to west, which really burnt continually; but this was not considered as
implied in the term ner tamid, which only meant “a continual lamp” in
the sense of a lamp that burns regularly every night.
The ner tamid in the Synagogue, which burns continually day and
night, is not mentioned by any of the earlier Rabbinical authors. It
has been introduced as a symbol representing our conviction that
from the Synagogue shall continually come forth the light of
instruction, the light of comfort and blessing, and the light of love and
peace.
In the Synagogue women are separated from men. There was also
in the Temple an עזרת נשים“court of the women,” distinguished from
the עזרת אנשים“court of the men,” to which women had no access.
During the Feast of Tabernacles, when the great rejoicings in the
Temple attracted a large assembly, special care was taken (תקון גדול
היה שם) that the separation of the sexes should be maintained
(Mishnah, Succah v. 2; and [427]Talm. B., Succah 51b). This
precedent has been followed in the Synagogue, and has been
accepted as law up to this day.
Reservedness and modesty (צניעות) have always been the pride and
ornament of Jewish women, both in their homes and in the
Synagogue; hence also their taking a silent part in the public
devotion is an honour to them, and by no means derogatory.
The Ritual.
The reading of shema in the evening and in the morning, the three
sections constituting the shema, and the order of these sections, are
assumed in the Mishnah as fully established by law and usage. Only
a few regulations are discussed concerning the time and the mode of
the reading. There was this difference between the custom of the
Babylonian Jews and that of their brethren in Palestine, that the
latter omitted in the evening the passage referring to tsitsith. Later
on, however, the Palestine Jews conformed to the Babylonian
custom. Suggestions have been made [432]to substitute other Biblical
passages for shema, but they have been rejected. Several attempts
have been made to introduce, as an addition to the three sections of
shema, the reading of the Decalogue; the addition was disallowed,
lest people should be misled to think that the Ten Commandments
alone were to be observed, and that the other laws were not binding
(Babyl. T., Berachoth 12a). 122
The ritual which was adopted for the priests in the Temple was an
abridged form of the ritual then in general use. It was as follows:
They commenced with a benediction—the first of those which
precede the shema (יוצר אור); then they read the Decalogue, shema
(the three paragraphs), and three further benedictions, אמת ויציב,
עבודה(corresponding to רצהin our prayer), and the blessing of the
priests (Mishnah, Tamid v. 1).
At the conclusion of the Talmud (about 500 c.e.) the essential parts
of our present ritual were already in a settled state; the shema with
the benedictions preceding and following, the tefillah with its
variations for New-moon, Sabbath, and Holy-days, the reading from
the Law and the prophets, and Hallel. The Seder evening Service
was complete in its main parts. [434]Of the Benedictions (Berachoth)
on various occasions both form and contents were fixed, and the rule
was laid down by Rabbi Meir (Berachoth 40a) that he who uttered a
berachah in a form different from that fixed by our Sages has not
fulfilled his duty (or, according to Maimonides, Hilchoth Berachoth i.
5, is in error). Notwithstanding this rule, however, changes were
made; new benedictions were introduced and old ones
discontinued. 124—Kaddish and Kedushah seem to have formed part
of the Service; of the latter the Talmud mentions the name, of the
former the response: “May his great Name be praised” יהא שמו הגדול
מבורךor יהא שמיה רבא מ׳(Comp. Babyl. Talm., Berachoth 3a).
In the next period, that of the Geonim, we meet with the complete
Siddur, “Arrangement” or “Order” of Service for ordinary days, for
Sabbaths and Festivals, Benedictions for all occasions, and Piyyutim
as optional additions. Such a Siddur was arranged by the Gaon
Rabbenu Saadiah (892–942), and another by the Gaon Rabbenu
Amram (about 880). Henceforth the principal prayers underwent only
insignificant alterations. Of the next period the most important
Siddurim are those included in the Mishneh-torah, at the end of the
second book, and that contained in the Machzor Vitry. 125
The two most essential elements in these Services are: (1) the
Reading of Shema (קריאת שמע), in the Maaribh and the Shacharith;
(2) the Tefillah or Amidah, common to all the Services.
The reading of the shema is preceded by two berachoth: (1) יוצר אור
Praise of the Creator for the regular sequence of day and night, light
and darkness; (2) אהבה רבהor אהבת עולםPraise of His goodness in
giving us the Torah, and prayer for His assistance in the study of the
Torah. The shema is followed by a berachah on the Redemption of
Israel; it contains a reflection on the last words of shema, “I am the
Lord your God,” an expression of our faith in the truth of these
words, which strengthen our belief in the future Redemption of
Israel. 128 In the Evening Service a second berachah follows,
beginning השכיבנו, and containing a prayer for protection during the
night. 129
The next thirteen paragraphs are petitions for our individual and
national well-being. For our individual well-being (4–9), namely, for
reason and wisdom (4), assistance in our endeavour to return to God
(5), forgiveness of our sins (6), deliverance from trouble (7), from
illness (8), and from want (9).—For our national well-being (10–15),
namely, for the gathering of those who are scattered (10), under
good leaders (11), protected from the evil designs of our foes (12),
for the support of the faithful (13), the rebuilding of Jerusalem (14),
and the advent of Messiah (15). The sixteenth paragraph is a prayer
that our petition may be accepted.—The last three paragraphs
include a petition for the re-establishment of Divine Service in the
Temple of Jerusalem (17), thanksgiving (18), and prayer for peace
and prosperity (19). When the prayer is finished we express the wish
that our lips, from which prayer to God has come forth, may not be
defiled by unworthy language.
There are two shorter forms of the tefillah for urgent occasions: the
one is a substitute for the “Eighteen,” in which the middle thirteen
paragraphs are contracted into one; it is called הביננו(the first word
of this middle section), or מעין שמונה עשרה“abstract of the
‘Eighteen.’ ” The other is a contraction of the Friday evening tefillah,
and is called מעין שבע“abstract of the ‘Seven’ ” (scil., paragraphs
forming the tefillah), originally intended for those who were too late
for the full Service. 130
Each of the above Services ends with a prayer called after its initial
word alenu, “It is our duty.” In this prayer we thank God that we have
the privilege of proclaiming His Unity, and express our hope to see
the worship of the One God adopted by all mankind. It is omitted
between two Services following closely the one upon the other.
The following points mark off the Public Service from the various
forms of private prayer:—
(3.) קריאת התורה“the Reading of the Law,” and the “Lessons from the
Prophets” (הפטרה), with the benedictions preceding and following
(supra, p. 348).
There are various short forms of this ברכת המזון; the shortest is that
for children, “Blessed be the Merciful, the Giver of this bread.” 134—
When three grown-up male persons or more have their meal
together, [444]a special introductory form is used, called זמון
“summons to prayer,” one of the company acting as Reader, and the
rest forming the congregation.
Notes.
We bend the knee, incline our head, and bow down on certain
occasions during the Service, but we do not kneel during prayer.—It
has perhaps been avoided as an idolatrous practice, with reference
to Judges vii. 5.
When the Ark is opened and the Sefer is taken out or put back, we
stand and show our respect for the Word of God in various ways.
Some bow the head; others, considering this as worship, kiss the
Sefer, or otherwise express their reverence.
2. On Page 439.
There are various parts in our Service which originally seem to have
formed a substitute, under certain circumstances, for a section of the
Service or for the whole of it, but were subsequently, when the
circumstances altered, embodied as an integral part of the Service in
addition to the sections which they had replaced.
In the Maaribh the part beginning ברוך יי לעולםand ending על כל מעשיו
was originally a substitute for the Amidah, and the conclusion of the
Evening Service for those who considered the tefillah in the evening
optional. Similarly, on Friday evening the contracted tefillah was
originally a substitute for the tefillah for those who came late. In both
these and similar cases the substitute and its original have been
retained as integral parts of the Service.
In the public Service the tefillah is repeated by the Reader after the
silent prayer (בלתש) of the congregation. This minhag must have
been introduced very early. In the Talmud (end of Rosh ha-shanah) it
is spoken of as a regular institution, its purpose is discussed, and the
reason stated why we should not dispense with the Reader’s
repetition or with the silent tefillah. It seems that there was, on the
one hand, a desire on the part of the congregants to have an
uninterrupted silent tefillah in which they could give suitable
expression each one to his personal and peculiar wants and wishes.
On the other hand, there was also a desire felt by many to be guided
in their devotions by the Reader. Our minhag satisfies both
requirements. But it is a grave error to think, as unfortunately many
do, that, while the Reader repeats the tefillah, the congregants may
turn their heart and mind to other things, however holy these be. The
congregation and the Reader must be united in devotion during תפלה
בצבור, and where the continued concentration of thought during the
tefillah and its repetition seems unattainable, it would be better to
sacrifice the minhag of repeating the tefillah rather than to have the
repetition of the prayer without the participation of the congregants,
or even without decorum.
In the first kedushah (called קדושה דיוצר), while praising God [448]as
the Creator of light and of the heavenly luminaries, we introduce
these, as proclaiming, as it were, the holiness and glory of God in
the words of the Prophets. In the last kedushah (called קדושה דסידרא
or סידרא דקדושה) we merely read, among other passages from the
Prophets, those verses of Isaiah and Ezekiel which contain the chief
sentences of the kedushah. In the kedushah of the tefillah the
Reader summons the congregation to proclaim the sanctification of
God in the manner of the angels above; it has therefore its place
only in Public Worship, whilst as to the other two kedushoth there is
no difference whether a person prays by himself or in a congregation
of worshippers.