CSC 200 - True/False Problems

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

Both of the following if statements perform the same operation. if (sales > 10000) commissionRate = 0.15; if (sales > 10000) commissionRate = 0.15;

T

By being able to pass arrays as arguments, you can write your own functions for processing C-strings.

T

C++ does not perform array bounds checking, making it possible for you to assign a pointer the address of an element out of the boundaries of an array.

T

Each individual element of an array can be accessed by the array name and an element number, called a subscript.

T

Floating point constants(e.g., 29.6) are stored in memory as doubles.

T

If an array is partially initialized, the uninitialized elements will be set to zero.

T

If an integer array is partially initialized, the uninitialized elements will be set to zero.

T

If the sub-expression on the left side of the || operator is true, the expression on the right side will not be checked.

T

In C++ there can be an array of four dimensions

T

In C++, key words are written in all lowercase letters.

T

It is legal to subtract a pointer variable from another pointer variable.

T

It is possible to define a file stream object and open a file in one statement.

T

String objects have a member function named c_str that returns the contents of the object formatted as a null-terminated C-string.

T

The amount of memory used by an array depends upon the array's data type and the number of elements in the array.

T

The cin >> statement will stop reading input when it encounters a nuewline character.

T

The extraction operator (>>) stops reading a string when it encounters a space.

T

The following two expressions are identical: X||Y&&Z __________________ X||(Y&&Z)

T

The isdigit function will return a true if its argument is a digit between 0 and 9.

T

The itoa function is similar to atoi, but it works in reverse.

T

The number of comparisons made by a binary search in worst case is expressed in powers of two.

T

The number of comparisons made by a binary search is expressed in powers of two.

T

If the sub-expression on the left side of an && operator is true, the expression on the right side will not be checked.

F

If you attempt to store data past an array's boundaries, it is guaranteed that the compiler will issue an error.

F

If you do not follow a consistent programming style, your programs will generate compiler errors.

F

If you want to know the length of the string that is stored in a string object, you can call the object's size member function.

F

In C++, it is impossible to display the number 34.789 in a field of 9 spaces with 2 decimal places of precision.

F

In programming, the terms "line" and "statement" always mean the same thing.

F

It is possible to use parenthesizes-style casting notation (e.g., (int)string) to convert from string objects to numbers or from numbers to string objects.

F

Local variables are initialized to zero by default.

F

Pseudocode is a form of program statement that will always evaluate to "false."

F

The C++ compiler performs strict array bounds checking when it encounters an array of characters.

F

The C++ language requires that you give variables names that indicate what the variables are used for.

F

The ampersand (&) is used to dereference a pointer variable in C++.

F

The bubble sort is an easy way to arrange data into ascending order, but it cannot arrange data into descending order.

F

The cin << statement will stop reading input when it encounters a newline character.

F

The cin.ignore() member function can only be used to skip over 1 character.

F

The code " if(-50) " would cause a compiler error.

F

The compiler will complain if you try to access array element 14 in a 10-element array.

F

The condition that is tested by a while loop must be enclosed in parentheses and terminated with a semicolon.

F

The fixed manipulator causes a number to be displayed in scientific notation.

F

The following code correctly determines whether x contains a value in the range of 0 through 100. if (x>= && <= 100)

F

The following code correctly determines whether x contains a value in the range of 0 through 100. if (x >= 0 && <= 100)

F

The increment and decrement operators can be used in mathematical expressions; however, they cannot be used in relational expressions.

F

The length() string member function counts the terminating null character.

F

The preprocessor executes after the compiler.

F

The scope of a variable declared in a for loop's initialization expression always extends beyond the body of the loop.

F

The strlen function returns a C-string's length and adds one for \0.

F

Two dimensional arrays can be passed to function, but the row size MUST be specified in the definition of the parameter variable.

F

Use of an unseeded rand() function returns a pure random number sequence.

F

Using a binary search, you are more likely to find an item than if you use a linear search.

F

When a function is called, flow of control moves to the function's prototype.

F

When a program uses the setw manipulator, the iosetwidth header file must be included in a preprocessor directive.

F

When you pass an array as an argument to a function, the function will create a local copy of the array.

F

With pointer variables you can access, but you cannot modify, data in other variables.

F

You may not nest a while loop inside a For loop.

F

You may not use the break and continue statements within nested loop syntax.

F

int array[index] is equivalent to *(array + index + sizeof(int) )

F

int num[ ] = {2, 8, -5, 7, 9 }; *num == num[1]; will evaluate to TRUE

F

push_back(value); will insert value into the vector and hence right shift all the elements in the vector by 1 unit.

F

vector<int>list2(list1); on execution will create a vector list1 as a copy of already initialized vector list2

F

The only difference between the get function and the >> operator is that get reads the first character typed, even if it is a space, tab, or the [Enter] key.

T

The open function invoked through an ifstream variable must be passed the name of an existing file.

T

The string class assumes the responsibility for managing the memory in which a string is stored so that the programmer does not have to worry about the size of a string.

T

The value of an arithmetic expression will be of the same type as its most precise operand.

T

When the fixed manipulator is used, the value specified by the setprecision manipulator will be the number of digits to appear after the decimal point.

T

When using the strcat function, you must be careful not to overwrite the bounds of an array.

T

When you pass an array as an argument to a function, the function can modify the contents of the array.

T

You may use the <, >, <=, >=, ==, and != relational operators to compare string objects.

T

You should be careful when using the equality operator to compare floating point values because of potential round-off errors.

T

Assuming myValues is an array of int values, and index is an int variable, both of the following statements do the same thing. cout << myValues[index] << endl; cout << *(myValues + index) << endl;

T

Given float ch = 3.05f, (int)ch and ch(int) produces different outputs

F

An unseeded rand() function will return a pseudo random number.

T

'C' and "C" are the same. Both of them can be assigned to a char variable.

F

*ptr += 4; adds 4 to the address stored in ptr.

F

A For loop is somewhat limited, because the counter can only be incremented by one each time through the loop.

F

A function's return data type must be the same as the function's parameter(s).

F

A local variable and a global variable may not have the same name within the same program.

F

A stack frame is created for all invoked functions except main().

F

A test using the isupper function will return false if the argument is an uppercase character.

F

A while loop is somewhat limited, because the counter can only be incremented by one each time through the loop.

F

Although two-dimensional arrays are a novel idea, there is no known way to pass one to a function.

F

Arithmetic operators that share the same precedence have right to left associativity.

F

Array names are NOT Pointer constants.

F

Assume array 1 and array2 are the names of arrays. To assign the contents of array2 to array1, you would use the following statement. array1 = array2;

F

Assume array1 and array2 are the names of arrays. To assign the contents of array2 to array1, you would use the following statemet. array1 = array2;

F

Before you can perform a selection sort, the data must be stored in ascending order.

F

C++ always checks array indexes and validates that they are within bounds.

F

'\n' would be stored internally using a single byte.

T

A CPU really only understands instructions that are written in machine language.

T

A block of code can be nested.

T

A global variable can have the same name as a variable that is declared locally within a function.

T

A parameter is a local variable that is declared inside the parentheses of a function definition.

T

A pointer can be used as a function parameter, giving the function access to the original argument.

T

A reference parameter is implemented as a local variable in the called function.

T

A static variable that is defined within a function is initialized only once, the first time the function is called.

T

A vector object automatically expands in size to accomodate the items stored in it.

T

An individual array element can be processed like any other type of C++ variable.

T

An initialization expression may be omitted from the for loop if no initialization is required.

T

An ofstream variable can be initialized to the name of an existing file.

T


संबंधित स्टडी सेट्स

NUR 3320 Exam 2: Review Questions

View Set

Chapter 27: PrepU - Common Reproductive Conditions

View Set