COSC 1436 EXAM QUESTIONS AND ANSWERS
Something within a while loop must eventually cause the condition to become false, or a(n) ________ results. - Answer-infinite loop
True/False: A while loop is somewhat limited, because the counter can only count up, not down. - Answer-false
A file ___...
COSC 1436 EXAM QUESTIONS AND
ANSWERS
Something within a while loop must eventually cause the condition to become false, or
a(n) ________ results. - Answer-infinite loop
True/False: A while loop is somewhat limited, because the counter can only count up,
not down. - Answer-false
A file __________ is a small holding section of memory that file-bound information is
first written to - Answer-buffer
int number = 6
int x = 0:
x = -- number;
cout << x << endl; - Answer-5
True/False: the scope of a variable declared in a for loop's initialization expression
always extends beyond the body of the loop - Answer-false
The while loop has two important parts: an expression that is tested for a true or false
value, and: - Answer-a statement or block that is repeated as long as the expression is
true
True/False: In C++ you can pass a string object as argument to a file stream object's
open member function - Answer-True
The statement in the body of a while loop may never be executed, whereas the
statements in the body of a do-while loop will be executed: - Answer-at least one
True/false: string objects have a member function named c_str that returns the contents
of the object formatted as a null-terminated C-string - Answer-true
n = 1;
for ( ; n <=5; )
cout << n << ' ' ;
n++; - Answer-1 1 1 ..... and on forever
What will the following code display?
Int number = 6;
Cout << number++ << endl; - Answer-6
How many times will the following loop display "Hello"?
, for (int i = 20; i >0; i --)
cout << "Hello!" << endl; - Answer-20
This is a variable that is regularly incremented or decremented each time a loop
iterates. - Answer-counter
This is a special value that marks the end of a list of values. - Answer-sentinel
What will the following code display?
Int number = 6;
number++;
Cout << number << endl; - Answer-7
If you want a user to enter exactly 20 values, which loop would be the best to use? -
Answer-for
int number = 6
++number;
cout << number << endl; - Answer-7
True/False: the update expression of a for loop can contain more than one statement,
e.g. counter++ - Answer-true
This statement may be used to stop a loop's current iteration and begin the next one -
Answer-continue
True/False the increment and decrement operators can be used in mathematical
expressions; however, they cannot be used in relational expressions - Answer-False
This is a statement that causes a function to execute. - Answer-function call
The value in this type of local variable persists between function calls. - Answer-static
Which of the following statements about global variables is true? - Answer-A global
variable can have the same name as a variable that is declared locally within a function
Look at the following function prototype
int myFunction(double);
what is the data type of the function's parameter variable? - Answer-double
True/False: One reason for using functions is to break programs into manageable units,
or modules - Answer-true
Voordelen van het kopen van samenvattingen bij Stuvia op een rij:
Verzekerd van kwaliteit door reviews
Stuvia-klanten hebben meer dan 700.000 samenvattingen beoordeeld. Zo weet je zeker dat je de beste documenten koopt!
Snel en makkelijk kopen
Je betaalt supersnel en eenmalig met iDeal, creditcard of Stuvia-tegoed voor de samenvatting. Zonder lidmaatschap.
Focus op de essentie
Samenvattingen worden geschreven voor en door anderen. Daarom zijn de samenvattingen altijd betrouwbaar en actueel. Zo kom je snel tot de kern!
Veelgestelde vragen
Wat krijg ik als ik dit document koop?
Je krijgt een PDF, die direct beschikbaar is na je aankoop. Het gekochte document is altijd, overal en oneindig toegankelijk via je profiel.
Tevredenheidsgarantie: hoe werkt dat?
Onze tevredenheidsgarantie zorgt ervoor dat je altijd een studiedocument vindt dat goed bij je past. Je vult een formulier in en onze klantenservice regelt de rest.
Van wie koop ik deze samenvatting?
Stuvia is een marktplaats, je koop dit document dus niet van ons, maar van verkoper Scholarsstudyguide. Stuvia faciliteert de betaling aan de verkoper.
Zit ik meteen vast aan een abonnement?
Nee, je koopt alleen deze samenvatting voor $12.49. Je zit daarna nergens aan vast.