COSC 1436 Final Exam with Complete Solution Graded A+ New Update
5 views 0 purchase
Course
COSC 1436
Institution
COSC 1436
COSC 1436 Final Exam with Complete Solution Graded A+ New Update
What will the following code display?
int x = 0;
for (int count = 0; count < 3; count++)
x += count;
cout << x << endl; - Answer-3
What does the following code display?
for (int r = 0, e = 4; r < ...
COSC 1436 Final Exam with Complete
Solution Graded A+ New Update
What will the following code display?
int x = 0;
for (int count = 0; count < 3; count++)
x += count;
cout << x << endl; - Answer-3
What does the following code display?
for (int r = 0, e = 4; r < e; r++) {
for (int c = 0; c < r; c++)
cout << "$";
cout << endl;
} - Answer-$
$$
$$$
How many times will the following loop display "Hello"?
for (int i = 20; i > 0; i--)
cout << "Hello!" << endl; - Answer-20
What value is displayed by the following code:
int i = 0;
i = i / i++;
cout << i; - Answer-depends on the compiler
To allow file access in a program, you must #include this header file. - Answer-fstream
A file ________ is a small holding section of memory that file-bound information is first
written to. - Answer-buffer
,This may be used to write information to a file. - Answer-stream insertion operator
To write data to a file, you define an object of this data type. - Answer-ofstream
To read data from a file, you define an object of this data type. - Answer-ifstream
Assuming outFile is a file stream object and number is a variable, which statement
writes the contents of number to the file associated with outFile? - Answer-outFile <<
number;
Assuming dataFile is a file stream object, the statement:
dataFile.close(); - Answer-closes a file
A file must be ________ before data can be written to or read from it. - Answer-open
In C++ 11 and later versions you can pass a string object as argument to a file stream
object's open member function. - Answer-True in C++ 11
String objects have a member function named c_str that returns the contents of the
object formatted as a classic null-terminated C-string. - Answer-True the c_str formats
as a classic c-string
Values passed to functions are what - Answer-Parameters
A function must have what to compile correctly - Answer-a function must have a body to
compile correctly
A parameter's scope is what? - Answer-its function in which it is in the functions
parameter definition
The lifetime of a local variable exists until the program ends. - Answer-False it does not
end only when the program ends
What is a stub? - Answer-A dummy function with an empty body that is used in place of
an actual function with a body with code
What is a driver? - Answer-Tests a function by calling it using various arguments and
checking return values
What is a reference parameters? - Answer-any changes to the reference parameter
variable inside the function also changes the matching argument
A function can not do what? - Answer-return multiple functions by name
, What is a local variable? - Answer-A variable that is declared in the body of a method
and is not accessible outside of its method
A function can only have what? - Answer-One return statement
Functions can have what? - Answer-the same name if the parameter lists have a
different amount of parameters
Can a global variable and a local variable have the same name? - Answer-yes because
one is local to the variable and the other is not
a function prototype eliminates the need for what? - Answer-a function definition before
all calls to the function
a local variable is declared and functional only in what? - Answer-the method that it is
declared inside
Does the value in a static variable persist between function calls - Answer-the value in a
static variable does not change until the program is stopped
What will a static variable initialize to? - Answer-0
Will a static argument pass automatically to a parameter if the argument is missing in
the function call? - Answer-no the static argument will not pass if the argument is
missing in a function call
The CPU has 2 main parts: - Answer-The control unit and the arithmetic unit
A byte has how many bits? - Answer-8 bits
Programming Syntax - Answer-The rules of grammar used by a language
Algorithm - Answer-A set of well defined steps for performing a task or solving a
problem
System Software - Answer-The programs that manage the computer hardware and the
programs that run on them
In a C++ program two slash marks (//) indicate - Answer-the beginning of a comment
Literal data signs - Answer-Values that do not change while the program is running
Variable definitions - Answer-Every variable needs a definition
Numeric data points in C++ can be classified into two general categories - Answer-
integer and floating point
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller Scholarsstudyguide. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $11.99. You're not tied to anything after your purchase.