Question: MULTIPLE CHOICE QUISTIONS (a) When using cin and cout, forgetting to put #include in your file causes a __________ error. Select one: a. compilation b.

MULTIPLE CHOICE QUISTIONS

(a) When using cin and cout, forgetting to put #include in your file causes a __________ error.

Select one:

a. compilation

b. edit

c. typing

d. logic

e. runtime

(b) A function heading declares the name and type of the function as well as the name and type of its __________ arguments.

Select one:

a. varialbe

b. constant

c. type

d. actual

e. formal

(c) If a void function returns a value through its parameter, then the type of the parameter is __________

Select one:

a. actual

b. value

c. reference

d. formal

e. returned

(d) A __________ argument is a constant, variable, or expression found inside the parentheses of a function call.

Select one:

a. output

b. actual

c. input

d. type

e. formal

(e) After the last statement of a function executes, control passes to the __________.

Select one:

a. end of the program

b. beginning of this function

c. main function

d. function whose code immediately follows this function's code

e. calling function

(f) Assuming that x is 15 and y is 25, the value of the expression

x = = (y + x - y)

is __________.

Select one:

a. 15

b. the expression is invalid

c. 25

d. false

e. true

(g) What does this program segment do?

s = 0; i = n;

do

{

s += i;

i--;

} while (i != 0);

Select one:

a. Adds all the integers from 1 to n-1.

b. Adds all the integers from n down to 1.

c. Adds the odd integers from 1 to n.

d. Adds the even integers from 1 to n.

(h) What does this program segment do?

s = 0;

for (i=n; i>=1; i--)

{

if (( i % 2) == 0)

s += 1;

}

Select one:

a. Adds the odd integers from n down to 1.

b. Adds all the integers from 1 to n-1.

c. None of these.

d. Adds all the integers from 1 to n.

e. Adds the even integers from n down to 1.

(i) Consider the following code snippet:

string name; int scores; ifstream in_file;

in_file.open("Results.txt");

Assume that the file Results.txt contains the last names and scores of students, for example,

Smith 94

Jones 81

...

(j) What is the legal way of reading a students name and the students scores in the Results.txt file?

Select one:

a. get_line(in_file, name); get_line(in_file, scores);

b. in_file >> name >> scores;

c. get_line(in_file, name); in_file >> scores;

d. in_file << name << scores;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!