Cosc Final

False
Values passed to function are parameters
True
A function must have a body to compile correctly.
We will write a custom essay sample on
Cosc Final
or any similar topic only for you
Order now
True
A parameter’s scope is the function which uses it.
False
The lifetime of a local variable exists until the program ends.
True
A stub is a dummy function is used in place of an actual function.
True
A driver tests a function by calling it using various arguments and checking return values.
True
For a reference parameter, any changes to the parameter variable inside the function also changes the matching argument.
False
A function can return by name many parameters
True
A local variable is defined inside a function and is not accessible outside the function.
False
A function can only have one return statement.
True
Functions can have the same name if the parameter lists have a different amount of parameters.
True
A global variable can have the same name as a local variable that is declared within a function.
True
A function prototype eliminates the need to place a function definition before all calls to the function.
False
A local variable is declared outside all functions that need it.
True
The value in a static variable inside a function persists between function calls.
True
A static variable will automatically initialize to 0.
False
A static argument is an argument that is passed automatically to a parameter if the argument is missing in the function call.
2 0 2
What does the following program display?

#include

using namespace std;

void doSomething(int);

int main() {

int x = 2;
cout << x << " "; doSomething(x); cout << x <<" "; return 0; } void doSomething(int num) { num = 0; cout << num << " "; }

2 0 0
What does the following program display?

#include

using namespace std;

void doSomething(int&);

int main() {

int x = 2;
cout << x << " "; doSomething(x); cout << x << " "; return 0; void doSomething(int& num) { num = 0; cout << num << " "; }

funcD int funcD float
#include “stdafx.h”
#include
#include

using namespace std;

int funcD(int i) {
cout << "funcD int" << " "; return(i); } int funcD(float i) { cout << "funcD float" << " "l; return(i); } int main() { funcD(1); funcD((float) 1.0); return 0; }

fstream
To allow file access in a program, you must #include this header file.
buffer
A file ________ is a small holding section of memory that file-bound information is first written to.
stream insertion operator
This may be used to write information to a file
ofstream
To write data to a file, you define an object of this data type.
ifstream
To read data from a file, you define an object of this data type.
outFile << number;
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?
closes a file
Assuming dataFile is a file stream object, the statement:

dataFile.close();

open
A file must be ________ before data can be written to or read from it.
True
In C++ 11 you can pass a string object as argument to a file stream object’s open member function.
True
String objects have a member function named c_str that returns the contents of the object formatted as a null-terminated C-string.
False
The following statement is a valid C++ array definition.

double money[25.00];

true
The individual values contained in array are known as elements.
true
An array can store a group of values, but the values must be the same data type
false
The last correct subscript that can be used with the following array is 5.

int values[5];

int array[10];
Which of the following is a valid C++ array definition?
implicit array sizing
The statement:

int grades[ ] = { 100, 90, 99, 80};

is an example of:

true
By using the same subscript you can build relationships between data stored in two or more parallel arrays.
false
If you attempt to store data past an array’s boundaries, the executable code will issue an error.
false
C++ limits the number of array dimensions to two.
true
A vector object is an array object that automatically expands in size to accommodate the items being stored in it.
false
The asterisk * , also known as the address operator, returns the memory address of a variable
true
With pointer variables, you can manipulate data stored in other variables that are pointed at by the pointer variable.
true
When you work with a de-referenced pointer, as in:

int *i;

*i=2;

you are actually setting the actual value (contents) of the variable whose address is stored in the pointer variable.

true
Array names are constant pointers, which are called references..
true
The following 2 code states produces the same result:

int *p, i;

*(p + i) = 2;

p[ i ] = 2;;

true
‘/0’ is the special escape sequence character representing the null terminator character.
true
In C++, a C-string is a sequence of characters stored in contiguous memory area that is terminated by a null termination character.
false
To manipulate objects of the string class, the str() functions are used.
true
The C string array

char companyName[12];

can hold eleven characters and the null terminator character.

tab
newline
space

All of these !

White space – encompasses which of the following?
false
Using the <, >, <=, >=, == and != relational operators on string objects will produce a syntax error.
false
In the development of the C++ language, the string class was defined first, then the str() functions were developed to allow better manipulation of C strings.
true
C++ 11 introduces a function named to_string() that converts a numeric value to a string object.
true
Literal Strings, such as “This String”, are constant pointers to a string that contains the string – This String.
true
“A String Example”[2] equals the character S.
false
A primitive type is an object.
true
A semicolon is required after the closing brace of a structure or union declaration.
false
A struct is an example of a C++ primitive data type.
false
A struct members must all be of the same type.
true
When a structure is passed as an argument to a function reference parameter, the structures members are not copied.
true
A union is like a structure, except all members occupy the same memory area.
true
The structure pointer operator (->) is used to dereference a pointer to a structure to access a member.
true
If a function is legally prototyped to return an integer value, it can return a structure member that is an integer data type
true
You can define any number of union variables, but a union variable can only store the value of one member at a time.
false
It is possible to output the contents of all members of a structure variable using a cout << statement followed by the name of the structure variable
×

Hi there, would you like to get such a paper? How about receiving a customized one? Check it out