CS 159 Exam 1 True and False
A scanf function is composed of a format string and a data list.
F
A single scanf function call can be used to display the prompt for input to the user and accept the input from the user.
F
A variable declared in the local declaration section of a function can have the same identifier as one of the parameters of the function.
F
Each rectangle on a structure chart represent only the standard library functions used in a program.
F
In additional to alphabetic and digits characters it is acceptable to use underscores, dashes and periods as part of an identifier.
F
Parameters being received by a function will be commented to the right of where they are defined.
F
The C language uses only the return statement to achieve communication of data between a calling and a called function.
F
The control of the program always returns from the calling function to the main function.
F
The first line of the function definition with a semicolon.
F
The function call requires the data types and identifiers for each parameter.
F
The function declaration requires the data types and identifiers for each parameter.
F
The precision modifier can specify the number of digits to display on both sides of the decimal-point with a floating point value.
F
The return statement cannot contain an expression.
F
The return statement in main will return control back to the first statement in main.
F
You should declare multiple variables on one line.
F
A C program begins with a section for preprocessor directives.
T
A function header comment for every user defined function must be inserted immediately above the definition of the function it is documenting.
T
A function mat return at most one value.
T
A function that does one and only one process is functionally to only a single task.
T
A literal constant is data that is not represented by any other symbol in a given expression.
T
A local variable cannot be referenced through its identifier outside of the function for which it is defined.
T
A printf function is composed of a format string and a data list.
T
A program that does not compile cannot be successfully submitted for grading.
T
A structure chart may show the data that is exchanged between functions.
T
A structure should be created before your program has been written.
T
A user-defined function may be called more than once in a program.
T
A variable declared in the local declaration section of a function has a scope that extends until the end of that function.
T
A variable that is not initialized at the time it is declared will be storing an unknown value.
T
A width modifies is used to reserve a given number of spaces to assist with the alignment of the value being displayed.
T
Additional local variables can be defined in the local decl
T
All code found between { and } should be indented two additional spaces.
T
All variables should be commented to the right of each declaration.
T
An identifies cannot begin with a digit character.
T
Any complier warnings remaining in a submission will result in a loss of points.
T
Comment are added to a program to improve its level of documentation intended for other programmers.
T
Data sent from the calling function to the function being called will be received in the same order in which it was passed.
T
Do not single ( or double) space the entire program. use blank lines when appropriate.
T
Every program must have exactly one function named main.
T
Functional cohesion is measure of how closely the processes in a function are related.
T
Given the address of a variable the called function can access and manipulate the value of a variable in the calling function.
T
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.
T
In most cases the definition of symbolic/defined constants will not terminate with a semi-colon.
T
Individual tasks in a program must be factored into individual user-defined functions.
T
It is a good design practice to design a user-defined function such that it is testable apart from the rest of the program.
T
It is a good design practice to not repeat the logic of one function in other functions of the program.
T
It is good design practice to limit user-defined functions to only a single task.
T
It is not possible to access a variable in the calling function by its identifier when inside the called function.
T
It is poor programming style to reuse identifiers within the same scope.
T
Multi-line comments cannot be nested
T
No code is contained in a structure chart and only demonstrates the function flow through the program.
T
Objects with a global scope are visible everywhere in the program.
T
One benefit of user-defined functions is the potential reduction or elimination of duplicate code.
T
Parameters are defined as local variables in the function header and should not be redefined within the local declaration section of the function.
T
Rarely are single character identifies considered meaningful for variables in a program.
T
Select meaningful identifies (names) for all variables in your program.
T
The asterisk (*) in a variable declaration indicates that the variable are not data variables but address variable holding the address of other variables in the program.
T
The asterisk has two different uses, declaring and address variable (pointer) and indirectly accessing the data ( in the memory location to which the variable points).
T
The course program headers are multi-line comments.
T
The data type of a variable will determine the amount of memory that is necessary to reserve for it.
T
The files stdio.h and math.h are libraries that contain standard functions for our use.
T
The function call is an executable statement.
T
The function definition contains executable statements that perform the task of the function.
T
The function definition requires the data types and identifiers for each parameter.
T
The implementation of advanced concepts, those yet to be introduced in lecture, is not permitted in an assignment.
T
The individual task represented by a function should be testable apart from the rest of the program.
T
The operators that can be applied to a value are restricted by its data type.
T
The preprocessor is a part of the compiling process and prepares your code for the remainder of that process.
T
The return(0); statement will be the final statement in the main function.
T
The role of the main function is to coordinate the function calls and to establish the data needs for a program.
T
The scope of an object determines the region of the program in which it is visible.
T
The selection of a conversion code in format string depends on the type of value it will represent.
T
The use of literal constants should be minimized and the use of symbolic/ defined constants should be maximized in your program.
T
The use of symbolic / defined constants can improve the documentation of a program.
T
The value of a local variable may be returned through a return statement of a user defined function.
T
There is no need to include example output with your submission.
T
To obtain the address of a variable we use the address operator (&).
T
To store a memory address that is sent from the calling function, the called function should use a special type of a variable known as pointer.
T
Variable declarations will NEVER be permitted in the global section this semester.
T
While commonly used in a printf function, the scanf function would not make use of the '\n' character.
T
Within each function the local declarations and executable statements must NOT be permitted to overlap.
T
You should place a single space between all operators and operands.
T
