C programming true/false

Ace your homework & exams now with Quizwiz!

A for statement cannot be used to implement a sentinel-controlled loop

False

A function interface comment consists of the function result type or void, the function name, and the formal parameter declaration list.

False

A function prototype specified the function operation.

False

A syntax error in a program is an error that causes the program to produce incorrect output

False

A test of an individual function is called a top-down test.

False

After the last statement of a function executes, control is transferred to the next defined function.

False

An actual argument of type int cannot be passed to a corresponding formal parameter of type double.

False

An array must be initialized when it is declared.

False

Because the following statement is a valid call to function wow, wow must be a void function. num = wow(x, y);

False

Before a new value can be stored in a memory cell, a C program must first execute the erase function to remove the cell's old contents.

False

Every function prototype must include at least one formal parameter.

False

Functions are permitted to have only one input argument.

False

Functions do not need comments.

False

If the value of x is 735, the statement printf("%4d", x); will display four blanks followed by 735.

False

In C, the || operator is evaluated before the && operator.

False

In a for statement, you may only increment or decrement the loop counter by one.

False

In counting loops, the counter must be initialized to zero before execution of the loop body begins.

False

It is common for array elements to be stored in adjacent memory cells but it is not necessary.

False

Loop counter variables are usually of type double.

False

Machine language is same for all CPU

False

Pseudocode is a special form of machine language produced by the C compiler.

False

Referencing an identifier outside its scope will cause a run-time error

False

Single array elements may not be used as function arguments

False

Statements in a high level are converted to statements in machine language

False

Subscript range errors are syntax errors.

False

Tables are always displayed using counter-controlled while loops.

False

The condition str1 < str2 is true if the string value of str1 alphabetically precedes the string value of str2.

False

The following function call stores in target the null-terminated string "Eliza". strncpy(target, "Elizabeth", 5);

False

The least common error in using an array is a subscript range error.

False

The length of a string is determined by the size of the variable in which it is stored and does not depend on the value stored in the variable.

False

The loop repetition condition of a for statement is tested at the end of each pass.

False

The loop that follows displays 29 lines of output. for (i = 0; i < 30; i = i + 1) printf("%d\n", i);

False

The relative order that functions are defined affects their order of execution.

False

The sentinel value is always the last value added to a sum being accumulated in a sentinelcontrolled loop.

False

The sprintf function is used to print string variables.

False

The statement c = d; checks to see if variables c and d have the same value.

False

The string "Hello" could be stored in the variable str declared as follows char str[5];

False

The string library function strcmp compares the lengths of two strings

False

The symbol = is the C equality operator.

False

This assignment statement stores the sum of b and c in a: b + c = a;

False

When a program begins to execute, the contents of the memory cells it uses are initially empty

False

When an array is passed to a function, the function operates on a local copy of the array.

False

You cannot declare a 2-dimensional array of characters the way you do for numeric data types.

False

. A counting loop with a control variable of type double will not always execute the same number of times on different computers.

True

A compound statement is a sequence of statements enclosed in {} braces.

True

A function call is a valid statement.

True

A function must be defined before it can be referenced.

True

A function's return type may not be an array.

True

A list of instructions to the computer is called a program

True

A local variable of a function is not visible in any other function.

True

A statement may not extend over multiple lines.

True

A type char literal is enclosed in single quotes

True

A user-defined function can call library functions or user-defined functions.

True

An actual output argument must be of the same pointer data type as the corresponding formal parameter.

True

An algorithm should be carefully hand traced before it is implemented in C.

True

An array can use an enumerated type for a subscript.

True

An array name with no subscript is a pointer

True

An integer output parameter is represented in C using a parameter of type int *.

True

C accepts any nonzero value as true.

True

Functions can be called several times from different points in a program because for each call the program keeps track of the statement to which control returns after the call finishes its last step

True

If "cat" is the value of the string variable str, then str[3] is the null character.

True

If name is a string variable whose value is "Elizabeth", the function call strcpy(target, &name[5]); assigns the string "beth" to target

True

If the computer is switched off, data in secondary storage is usually lost

True

If x is a type double variable and n is of type int, the following assignment statements are equivalent. x = n; x = (double)n;

True

Loop control variables may be used as array subscripts.

True

Part of operating system typically store in ROM for faster booting

True

Program readability can be improved by indenting both the true and false tasks of all ifelse statements.

True

Some files contain data for a program; other contain the program to produce incorrect output

True

The C language is case sensitive.

True

The C language requires the programmer to declare every variable used in a program.

True

The assignment operator = can be used for string assignment only when initializing a string variable in its declaration.

True

The body of a for statement might not be executed at all

True

The body of a while statement must cause the loop repetition condition to become false after a finite number of passes to prevent an infinite loop.

True

The directive #define FIVE 5 notifies the C preprocessor that it is to replace each use of FIVE by 5.

True

The following decision structure is invalid: if x <= y printf("%lf", x); else printf("%lf", y);

True

The following program segment gives x and y the same value if the condition is true: if (x > y) { y = x; x = y; }

True

The function fgets will not cause buffer overflow.

True

The loop repetition condition of a while or for statement can be false before the loop begins to execute.

True

The preprocessor directive #include should be present in a program that calls the fabs library function.

True

The return statement may be omitted from a function's body if the function does not return a result.

True

The update expression in a sentinel-controlled for loop usually involves a call to scanf or fscanf.

True

The value of the expression x + y * z * z is always the same as the value of x + ((y * z) * z)

True

The word double is a reserved word in C so it cannot be used as a variable name.

True

When the function scanf is used to input a string, it ignores leading white space characters.

True

typedef is a reserved word.

True


Related study sets

Chapter 53. Medication Administration

View Set

ARTS: Neoclassical and Romantic Period

View Set

OB Chapter 7: Emotion and Stress

View Set

Robbins & Cotran Review of Pathology Pg. 626 31. Final Review and Assessment

View Set

Vocab Words 80-100 Short Meanings

View Set