True false exam 3 PDF

Title True false exam 3
Author Frankisa Surani
Course Technical Writing
Institution Arkansas State University
Pages 4
File Size 113 KB
File Type PDF
Total Downloads 9
Total Views 137

Summary

True false exam 3...


Description

Functions should be given names that reflect their purpose. True Function headers are terminated with a semicolon. False Function prototypes are terminated with a semicolon.

True

If other functions are defined before main, the program still starts executing at function main. True When a function terminates, it always branches back to main, regardless of where it was called from. False Arguments are passed to the function parameters in the order they appear in the function call. True The scope of a parameter is limited to the function which uses it. True Changes to a function parameter always affect the original argument as well. False In a function prototype, the names of the parameter variables may be left out. True Many functions may have local variables with the same name. True Overuse of global variables can lead to problems. True Static local variables are not destroyed when a function returns. True All static local variables are initialized to −1 by default. False Initialization of static local variables only happens once, regardless of how many times the function in which they are defined is called. True When a function with default arguments is called and an argument is left out, all arguments that come after it must be left out as well. True It is not possible for a function to have some parameters with default arguments and some without. False

The exit function can only be called from main. False A stub is a dummy function that is called instead of the actual function it represents. True

An array’s size declarator can be either a literal, a named constant, or a variable. True To calculate the amount of memory used by an array, multiply the number of elements by the number of bytes each element uses. True The individual elements of an array are accessed and indexed by unique numbers. True

The first element in an array is accessed by the subscript 1. False The subscript of the last element in a single-dimensional array is one less than the total number of elements in the array. True The contents of an array element cannot be displayed with cout. False Subscript numbers may be stored in variables. True

You can write programs that use invalid subscripts for an array. True Arrays cannot be initialized when they are defined A loop or other means must be used. False The values in an initialization list are stored in the array in the order they appear in the list. True C++ allows you to partially initialize an array. True If an array is partially initialized, the uninitialized elements will contain “garbage.” False If you leave an element uninitialized, you do not have to leave all the ones that follow it uninitialized. False If you leave out the size declarator of an array definition, you do not have to include an initialization list. False The uninitialized elements of a string array will automatically be set to the value "0". False You cannot use the assignment operator to copy one array’s contents to another in a single statement. True When an array name is used without brackets and a subscript, it is seen as the value of the first element in the array. False To pass an array to a function, pass the name of the array. True When defining a parameter variable to hold a single-dimensional array argument, you do not have to include the size declarator. True When an array is passed to a function, the function has access to the original array. True A two-dimensional array is like several identical arrays put together. True It’s best to think of two-dimensional arrays as having rows and columns. True The first size declarator (in the declaration of a two-dimensional array) represents the number of columns. The second size definition represents the number of rows. False

Two-dimensional arrays may be passed to functions, but the row size must be specified in the definition of the parameter variable. False C++ allows you to create arrays with three or more dimensions. True A vector is an associative container. False To use a vector, you must include the vector header file. True vectors can report the number of elements they contain. True

You can use the[]operator to insert a value into a vector that has no elements. False If you add a value to a vector that is already full, the vector will automatically increase its size to accommodate the new value. True If data are sorted in ascending order, it means they are ordered from lowest value to highest value. True If data are sorted in descending order, it means they are ordered from lowest value to highest value. False The average number of comparisons performed by the linear search on an array of N elements is N/2 (assuming the search values are consistently found). True The maximum number of comparisons performed by the linear search on an array of N elements is N/2 (assuming the search values are consistently found). False A semicolon is required after the closing brace of a structure or union declaration. True A structure declaration does not define a variable. True

The contents of a structure variable can be displayed by passing the structure variable to the cout object. False

Structure variables may not be initialized. False In a structure variable’s initialization list, you do not have to provide initialzers for all the members. True You may skip members in a structure’s initialization list. False

The following expression refers to element 5 in the array carInfo: carInfo.model[5] False

An array of structures may be initialized. True

A structure variable may not be a member of another structure. false

A structure member variable may be passed to a function as an argument. True An entire structure may not be passed to a function as an argument. False

A function may return a structure. True When a function returns a structure, it is always necessary for the function to have a local structure variable to hold the member values that are to be returned. True The indirection operator has higher precedence than the dot operator. False The structure pointer operator does not automatically dereference the structure pointer on its left. False In a union, all the members are stored in different memory locations. False All the members of a union may be used simultaneously. False

You may define arrays of unions. true

You may not define pointers to unions. false An anonymous union has no name. true

If an anonymous union is defined globally (outside all functions), it must be declared static. true...


Similar Free PDFs