Exam 1 Review: True/False Flashcards

(95 cards)

1
Q

A C program begins with a section for preprocessor directives

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

The preprocessor is a part of the compiling process and prepares your code for the remainder of the process.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

The declaration section of a function contains executable instructions for the computer.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Every program must have exactly one function named main.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

The main function is the starting point for execution of the program.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

The gcc compiler as found on Vocareum will issue a warning when the main is not an int function.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

All code found in the executable statements and local declaration sections of the main function is considered to be the body of the function.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Variable declarations will NEVER be permitted in the global section this semester.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

The files stdio.h and math.h are libraries that contain standard functions for our use.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

The return(0); statement will be the final statement in the main function.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Comments are added to a program to improve its level of documentation intended for other programmers.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

A char is any value that can be represented in the character set of the computer.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

The character data type is one of three integral types that cannot contain a fraction part and are whole numbers.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

On the ASCII table all of the lowercase letters are grouped together (same for uppercase)

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

The first 32 characters on the ASCII table are control characters and do not represent alphanumeric, digit, or punctuation characters.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Variables are named memory locations that have a type.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Each variable in a C program must be declared and defined before it can be used

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

It is much easier to find and work with variables if they are defined on separate lines

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Variables in the C language are initialized automatically when they are defined

A

False - when they are declared

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

The backslash is known as an escape character

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

A character constant is enclosed in double quotes

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

A literal constant is an unnamed constant used to specify data

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

The command to create a defined constant is usually placed at the beginning of the program

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

While variables have data types, constants do not.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
All of the compound assignment operators share the same level of operator precedence.
True
26
Operator precedence can be used to bind operators to operands and from that will determine the order of operations in an expression.
True
27
A single-type operation will generate a result of that same type.
True
28
The use of a precision modifier when displaying a floating-point value will result in truncating all digits beyond the specified value
False - rounds, not truncates
29
Converting a higher ranked data type to that of a lower ranked data type may result in the loss of data.
True
30
When two operators with the same precedence occur in an expression and their associativity is left-to-right, the left operator is evaluated first.
True
31
An expression always reduces to a single value.
True
32
The value of the postfix increment expression is determined before the variable is increased.
True
33
The operand in a postfix or prefix expression must be a variable
True
34
The assignment expression evaluates the operand on the right side of the operator and places its value in the variable on the left.
True
35
The compound assignment operator (/=) has a higher level of precedence than the addition (+) operator
False
36
When a compound assignment is used with an expression, the expression is only evaluated first when the parentheses are used to raise its level of precedence
False
37
The result of an expression is undefined when it attempts to modify a single variable more than once.
True
38
When the types of two operands in a binary expression are different, the lower-ranked type is promoted to the rank of the higher type.
True
39
In an assignment statement, promotion occurs if the right expression has a lower rank than the variable on the left and demotion occurs if the right expression has a higher rank.
True
40
An explicit type conversion is the programmer taking control and determining the data type of an operand in an expression.
True
41
To cast data from one type to another we specify the new type in parentheses before the value we want converted.
True
42
The defined constant results in an automatic substitution of the value that follows the symbol where it is found in the program with one exception, no such substitution will take place inside of quotes.
True
43
Problems associated with defined constants are difficult to resolve as the programmer views the original statement and not the statement with the error after the substitution takes place.
True
44
One programming technique to simplify code is to use parentheses, even when unnecessary.
True
45
The function call is an executable statement.
True
46
The function declaration requires the data types and identifiers for each parameter
False - just the data types
47
The function call requires the data types and identifiers for each parameter
False - just the identifiers
48
The first line of the function definition terminates with a semicolon
False - only the call and declaration require semicolon
49
The value of a local variable may be returned through a return statement of a user-defined function
True
50
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
51
Additional local variables can be defined in the local declaration section of a function
True
52
A local variable cannot be referenced through its identifier outside of the function in which it is defined
True
53
A variable declared in the local declaration section of a function can have the same identifier as one of the parameters of the same function
False
54
Individual tasks in a program must be factored into individual user-defined functions
True
55
One benefit of user-defined functions is the potential reduction or elimination of duplicate code.
True
56
A function assignment header for every user-defined function must be inserted immediately above the definition of the function it is documenting.
True
57
Parameters being received by a function will be commented to the right of where they are defined.
False - commented in the header
58
The return statement cannot contain an expression
False
59
Data sent from the calling function to the function being called will be received in the same order it was passed
True
60
The individual task represented by a function should be testable apart from the rest of the program
True
61
The sequence in which the statements are executed in a program can be altered through the use of functions and function calls
True
62
A user-defined function may be called more than once in a program
True
63
The control of the program always returns form the called function to the main function
False - from called function to calling function
64
A function may return at most one value
True
65
The role of the main function is to coordinate the function calls and to establish data needs for a program.
True
66
In downward communication it is only a copy of the data that is sent from the calling function to the called function
True
67
It is not possible to access a variable in the calling function by its identifier when inside the called function
True
68
Given the address of a variable the called function can access and manipulate the value of a variable in the calling function
True
69
The called function must declare a special type of variable known as a pointer to store a memory address that is sent from the calling function
True
70
The called function must declare a special type of variable known as a pointer to store a memory address that is sent from the calling function.
True
71
To obtain the address of a variable, use the address operator (&)
True
72
The asterisk when user in a variable declaration indicates that such variables are not data variables but address (pointer) variables which can store the addresses of other variables in the program.
True
73
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
74
When only one data item needs to be returned to the calling function then we should use the standard return statement rather than passing a single parameter by address
True
75
The scope of an object determines the region of the program in which it is visible (and defined)
True
76
A variable declared in the local declaration section of a function has a scope that extends until the end of that function
True
77
Objects with a global scope are visible everywhere in the program
True
78
It is poor programming style to reuse identifiers within the same scope
True
79
Functional cohesion is a measure of how closely the processes in a function are related
True
80
A function that does one and only one process is functionally cohesive
True
81
It is good design practice to limit user-defined functions to only a single task
True
82
It is good design practice to not repeat the logic of one function in other functions of the program
True
83
It is possible to determine if any parameters are passed to a function by address from the declaration statement of the function
True
84
It is never possible to determine if any parameters are passed to a function by address from an example call to the function
False
85
It is possible to determine if any parameters are passed to a function by address based on the function header
True
86
One benefit of pass by address is that it allows multiple changes to be made in a function and to have those changes available in the calling function
True
87
The * and & are inverse operations of each other
True
88
Conversion codes are needed only for the print of data that is stored in the memory of variables
False
89
A function that passes at least one variable by address must pass them all by address
False
90
When working with a parameter that has been passed by address it is unnecessary to use the address operator in the scanf because a pointer variable already represents a memory location
True
91
The first use of an explicit type conversion will alter the data type of a variable for the remainder of the program
False
92
Implicit type conversions are made to all operands in an expression before any individual operator is evaluated
False
93
A necessary condition to pass parameters by address to a function is the number of function calls in a program can be reduced through the use of passing more parameters by address
False
94
The function definition is an executable statement
False - a function call is an executable statement
95
The defined constant results in an automatic substitution of the value that follows the symbol everywhere and anywhere that symbol is found in the program
False