CS 159 True/False
A scanf function is composed of a format string and a data list.
False
A single scanf function call can be used to display the prompt for input to the user and accept the input from the user.
False
A structure chart should be created after your program has been written.
False
A terminal semicolon after an if condition is optional.
False
A variable declared in the local declaration section of a function can have the same identifier as one of the parameters of the function.
False
Course standards require brackets { and } to be used with all if-else constructs.
False
Each switch case label is the keyword case which must be followed by a constant expression inside of single quotes.
False
In additional to alphabetic and digits characters it is acceptable to use underscores, dashes, and periods as part of an identifier.
False
It is a logical error to associate two switch case labels with a common set of actions.
False
Parameters being received by a function will be commented to the right of where they are defined.
False
The C language uses only pass by value and return to achieve communication of data between a calling and a called function.
False
The complement of x > 0 && x < 10 || x % 2 == 0 is x <= 0 || x >= 10 && x % 2 != 0
False
The control of the program always returns from the calling function to the main function.
False
The first line of the function definition terminates with a semicolon (;).
False
The function call requires the data types and identifiers for each parameter.
False
The function declaration requires the data types and identifiers for each parameter.
False
The parentheses around the logical expression of an if statement are optional.
False
The precision modifier can specify the number of digits to display on both sides of the decimal-point with a floating-point value.
False
The return statement cannot contain an expression.
False
The return statement in main will return control back to the first statement in main.
False
You should declare multiple variables on one line.
False
3 && - 3 && 10 && - 10
True
3 == 3 && - 1 && 1
True
3 == 4 || 6 || 8
True
3 || - 3 || 10 || - 10
True
3 || 6 && 0
True
6 % 2 || 7 % 2
True
A C program usually begins with a section for pre-processor directives.
True
A dangling else logical error can be avoided through the use of { and } with all nested if/else constructs.
True
A function header comment for every user-defined function must be inserted immediately above the definition of the function it is documenting.
True
A function may return at most one value.
True
A function that does one and only one process is functionally cohesive.
True
A literal constant is data that is not represented by any other symbol in a given expression.
True
A local variable cannot be referenced through its identifier outside of the function for which it is defined.
True
A printf function is composed of a format string and a data list.
True
A program that does not compile cannot be successfully submitted for grading.
True
A structure chart may show the data that is exchanged between functions.
True
A user-defined function may be called more than once in a program.
True
A variable declared in the local declaration section of a function has a scope that extends until the end of that function.
True
A variable that is not initialized at the time it is declared will be storing an unknown value.
True
A width modifier is used to reserve a given number of spaces to assist with the alignment of the value being displayed.
True
Additional local variables can be defined in the local declaration section of a function.
True
All code found between { and } should be indented two additional spaces.
True
All variables should be commented to the right of each declaration.
True
An identifier cannot begin with a digit character
True
Any compiler warnings remaining in a submission will result in a loss of points.
True
Data sent from the calling function to the function being called will be received in the same order in which it was passed.
True
Do not single (or double) space the entire program, use blank lines when appropriate.
True
Each rectangle on a structure chart represents the user-defined and standard library functions used in a program.
True
Every program must have exactly one function named main.
True
Functional cohesion is a measure of how closely the processes in a function are related.
True
Given the address of a variable the called function can access and manipulate the value of a variable in the calling function.
True
In downward communication (passing by value) it is only a copy of the data that is sent from the calling function to the called function.
True
In most cases the definition of symbolic/defined constants will not terminate with a semi-colon.
True
Individual tasks in a program must be factored into individual user-defined functions.
True
It is a good design practice to design a user-defined function such that it is testable apart from the rest of the program.
True
It is a good design practice to limit user-defined functions to only a single task.
True
It is a good design practice to not repeat the logic of one function in other functions of the program.
True
It is not possible to access a variable in the calling function by its identifier when inside the called function.
True
It is poor programming style to reuse identifiers within the same scope.
True
Multi-line comments cannot be nested.
True
No code is contained in a structure chart and only demonstrates the function flow through the program.
True
No two switch case labels can represent the same constant expression value.
True
Objects with a global scope are visible everywhere in the program.
True
One benefit of user-defined functions is the potential reduction or elimination of duplicate code.
True
Parameters are defined as local variables in the function header and should not be re-defined within the local declaration section of the function.
True
Select meaningful identifiers (names) for all variables in your program.
True
The asterisk (*) in a variable declaration indicates that the variables are not data variables but address variables holding the addresses of other variables in the program.
True
The asterisk has two different uses, declaring an address variable (pointer) and indirectly accessing the data (in the memory location to which the variable points).
True
The compiler will issue a warning when an assignment operator rather than the equality operator is used in the logical expression of an if condition.
True
The complement of x % 3 == 0 || x % 3 == 2 is x % 3 != 0 && x % 3 != 2
True
The complement of x > 3 is x <= 3
True
The conditional expression has three operands and two operators.
True
The control expression that follows the keyword switch may be an integer or character expression.
True
The data type of a variable will determine the amount of memory that is necessary to reserve for it.
True
The files stdio.h and math.h are libraries that contain standard functions for our use
True
The following two logical expressions are equivalent: !(x < 10) and x >= 10
True
The following two logical expressions are equivalent: x % 2 and x % 2 != 0
True
The function call is an executable statement.
True
The function definition contains executable statements that perform the task of the function.
True
The function definition requires the data types and identifiers for each parameter.
True
The implementation of advanced concepts, those yet to be introduced in lecture, is not permitted in an assignment.
True
The individual task represented by a function should be testable apart from the rest of the program.
True
The operators that can be applied to a value are restricted by its data type.
True
The return(0); statement is usually the final statement in the main function
True
The role of the main function is to coordinate the function calls and to establish the data needs for a program.
True
The scope of an object determines the region of the program in which it is visible.
True
The selection of a conversion code in a format string depends on the type of value it will represent.
True
The short-circuit method of evaluating logical expressions is only relevant to those expressions that make use of at least one logical operator.
True
The use of literal constants should be minimized and the use of symbolic/defined constants should be maximized in your program.
True
The use of symbolic/defined constants can improve the documentation of a program.
True
The value of a local variable may be returned through a return statement of a user-defined function.
True
There is no need to include example output with your submission.
True
To obtain the address of a variable we use the address operator (&).
True
To store a memory address that is sent from the calling function, the called function should use a special type of variable known as a pointer.
True
Variable declarations will NEVER be permitted in the global section this semester.
True
When only one data item needs to be returned we should use the standard return statement.
True
While commonly used in a printf function the scanf function would not make use of the '\n' character.
True
Within each function the local declarations and executable statements must NOT be permitted to overlap.
True
You should place a single space between all operators and operands.
True
