Deck 14: Additional Capabilities

Full screen (f)
exit full mode
Question
The typedef statement creates a new data type.
Use Space or
up arrow
down arrow
to flip the card.
Question
Using uppercase names in typedef statements is mandatory.
Question
One of the differences between the a typedef statement and a #define statement is that typedef statements are processed directly by the compiler while #define statements are processed by the preprocessor.
Question
Compiler processing of typedef statements allows for text replacements that are not possible with the preprocessor.
Question
The statement typedef int ARRAY[100]; is not valid in C.
Question
typedef statements cannot be used with structure definitions.
Question
Both the #ifndef and #ifdef directives permit conditional compilation in that the statements immediately following these directives, up to either the #else or #endif directives, are compiled only if the condition is true, whereas the statements following the #else are compiled only if the condition is false.
Question
The relationship between the #ifdef and #ifndef directives is that the expression #ifndef condition performs the same task as the expression #ifdef !condition.
Question
Sets of related integer values can be equated to an equivalent set of constants using an enumerated list.
Question
An enum statement can be replaced by several typedef statements.
Question
Integer values in an enumeration must be in sequence.
Question
An optional enumerated list name can be used in an enumeration statement.
Question
Enumerated constants can be any valid user-created identifier, but each name in the list must be unique.
Question
In an enumeration, it is not valid for two constants to be equated to the same integer value.
Question
The conditional operator has a lower precedence than the assignment operator.
Question
Conditional expressions are only useful in replacing if-else statements when the expressions in the equivalent if-else statement are not long or complicated.
Question
A goto statement is never required because C's normal structures provide sufficient flexibility to handle all possible flow control requirements.
Question
When working with bit operations, inclusive ORing with a 1 has the same effect as ANDing with a 0.
Question
When the bit operators &, |, and ^ are used with operands of different sizes, the shorter operand is always increased in bit size to match the size of the larger operand.
Question
For positive signed numbers, where the leftmost bit is 0, both arithmetic and logical right shifts produce the same result.
Question
C places several restrictions on the equivalences that can be established with the #define statement.
Question
The advantage of using a macro such as #define SQUARE(x) x * x is that since the data type of the argument is not specified, the macro can be used with any data type argument.
Question
A better alternative to #define SQUARE(x) (x) * (x) is #define SQUARE(x) x * x.
Question
If necessary, a macro definition can be continued on a new line by typing a backslash character, \, before the Enter key is pressed.
Question
The advantage of using a macro instead of a function is an increase in execution speed.
Question
The full function header of a main() function that will receive command-line arguments is int main(int argc, char *argv[]).
Question
Any argument typed on a command line is considered to be an integer.
Question
typedef can be used to create ____.

A)structures
B)variables
C)aliases
D)macros
Question
The statement ____ makes the name REAL a synonym for double.

A)typedef double REAL;
B)#define double REAL
C)enum REAL double
D)typedef REAL double;
Question
The definition REAL val; is ____.

A)not valid in C
B)is equivalent to double val; if it comes after typedef double REAL;
C)will generate a compiler warning
D)defines a macro instance if it comes after #define REAL double
Question
The equivalence produced by a typedef statement can frequently be produced equally well by a ____ statement.

A)enum
B)#define
C)struct
D)alias
Question
ARRAY first, second; is equivalent to the two definitions int first[100]; and int second[100]; if ____.

A)you are using a pre-ANSI C compiler
B)you are using a C/C++ compiler
C)the statement typedef int ARRAY[100]; is used before
D)the statement #define ARRAY int[100]; is used before
Question
The conditional preprocessor directive ____ means "if not defined".

A)#ifdef
B)#ifndef
C)#ifnotdef
D)#ifnotdefined
Question
The conditional preprocessor directive ____ means "if defined".

A)#ifdef
B)#ifndef
C)#ifdefined
D)#if_def
Question
____ is the most frequently used conditional preprocessor directive.

A)#define
B)#else
C)#ifdef
D)#ifndef
Question
Enumerated lists are identified by the reserved word ____ followed by an optional, user-selected name and a required list of one or more constants.

A)list
B)typedef
C)enumerate
D)enum
Question
By default, the first enumerated name in an enumerated list has a value of ____.

A)-1
B)0
C)1
D)NULL
Question
Explicit values can be assigned to each enumerated constant, with unspecified values automatically continuing the integer sequence from the last specified value. For example, ____.

A)enum {Mon: 1, Tue, Wed, Thr, Fri, Sat, Sun};
B)enum {Mon, Tue, Wed, Thr, Fri, Sat, Sun};
Mon = 1;
C)enum {Mon = 1, Tue, Wed, Thr, Fri, Sat, Sun};
D)enum {Mon 1, Tue, Wed, Thr, Fri, Sat, Sun};
Question
A conditional expression uses the conditional operator, ____, and provides an alternate way of expressing a simple if-else statement.

A)->
B)?:
C)?
D):
Question
The operator ____ is a ternary operator.

A)?:
B)->
C)&
D)[]
Question
The ____ statement provides an unconditional transfer of control to some other statement in a program.

A)jump
B)goto
C)label
D)transfer
Question
Using even one ____ statement in a program is almost always a sign of bad programming structure.

A)enum
B)typedef
C)goto
D)#define
Question
The ____ operator causes a bit-by-bit AND comparison between its two operands.

A)~
B)^
C)&&
D)&
Question
1 0 1 1 0 0 1 1 ____ 1 1 0 1 0 1 0 1 results in 1 0 0 1 0 0 0 1.

A)&
B)|
C)>>
D)<<
Question
____ bit operations are extremely useful in masking, or eliminating, selected bits from an operand.

A)&
B)|
C)>>
D)<<
Question
1 0 1 1 0 0 1 1 ____ 1 1 0 1 0 1 0 1 results in 1 1 1 1 0 1 1 1.

A)&
B)|
C)>>
D)<<
Question
____ is the exclusive OR operator.

A)&
B)|
C)^
D)~
Question
1 0 1 1 0 0 1 1 ____ 1 1 0 1 0 1 0 1 results in 0 1 1 0 0 1 1 0.

A)&
B)|
C)^
D)~
Question
The complement operator, ____, is a unary operator that changes each 1 bit in its operand to 0 and each 0 bit to 1.

A)&
B)|
C)^
D)~
Question
For unsigned integers, each left shift (using the << operator) corresponds to ____.

A)multiplication by 2
B)division by 2
C)multiplication by 4
D)division by 4
Question
In an arithmetic right shift (using the >> operator), each right shift corresponds to ____.

A)multiplication by 2
B)division by 2
C)multiplication by 4
D)division by 4
Question
In the equivalence statement #define SQUARE(x) x * x, x is ____.

A)fixed
B)an error
C)a variable
D)an argument
Question
#define SQUARE(x) x * x
Val = SQUARE(num1 + num2);
Results in the equivalent statement ____.

A)val = num1 + (num2 * num1 + num2);
B)val = (num1 + num2 * num1) + num2;
C)val = (num1 + num2) * (num1 + num2);
D)val = num1 + num2 * num1 + num2;
Question
Upon encountering the command line pgm14.3 three blind mice, the operating system stores it as a sequence of ____ strings.

A) one
C) four
B) three
D) five
Question
To standardize arguments passing to a main() function, only ____ item(s) is/are allowed.

A) one
C) three
B) two
D) four
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/55
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 14: Additional Capabilities
1
The typedef statement creates a new data type.
False
2
Using uppercase names in typedef statements is mandatory.
False
3
One of the differences between the a typedef statement and a #define statement is that typedef statements are processed directly by the compiler while #define statements are processed by the preprocessor.
True
4
Compiler processing of typedef statements allows for text replacements that are not possible with the preprocessor.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
5
The statement typedef int ARRAY[100]; is not valid in C.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
6
typedef statements cannot be used with structure definitions.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
7
Both the #ifndef and #ifdef directives permit conditional compilation in that the statements immediately following these directives, up to either the #else or #endif directives, are compiled only if the condition is true, whereas the statements following the #else are compiled only if the condition is false.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
8
The relationship between the #ifdef and #ifndef directives is that the expression #ifndef condition performs the same task as the expression #ifdef !condition.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
9
Sets of related integer values can be equated to an equivalent set of constants using an enumerated list.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
10
An enum statement can be replaced by several typedef statements.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
11
Integer values in an enumeration must be in sequence.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
12
An optional enumerated list name can be used in an enumeration statement.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
13
Enumerated constants can be any valid user-created identifier, but each name in the list must be unique.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
14
In an enumeration, it is not valid for two constants to be equated to the same integer value.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
15
The conditional operator has a lower precedence than the assignment operator.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
16
Conditional expressions are only useful in replacing if-else statements when the expressions in the equivalent if-else statement are not long or complicated.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
17
A goto statement is never required because C's normal structures provide sufficient flexibility to handle all possible flow control requirements.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
18
When working with bit operations, inclusive ORing with a 1 has the same effect as ANDing with a 0.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
19
When the bit operators &, |, and ^ are used with operands of different sizes, the shorter operand is always increased in bit size to match the size of the larger operand.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
20
For positive signed numbers, where the leftmost bit is 0, both arithmetic and logical right shifts produce the same result.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
21
C places several restrictions on the equivalences that can be established with the #define statement.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
22
The advantage of using a macro such as #define SQUARE(x) x * x is that since the data type of the argument is not specified, the macro can be used with any data type argument.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
23
A better alternative to #define SQUARE(x) (x) * (x) is #define SQUARE(x) x * x.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
24
If necessary, a macro definition can be continued on a new line by typing a backslash character, \, before the Enter key is pressed.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
25
The advantage of using a macro instead of a function is an increase in execution speed.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
26
The full function header of a main() function that will receive command-line arguments is int main(int argc, char *argv[]).
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
27
Any argument typed on a command line is considered to be an integer.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
28
typedef can be used to create ____.

A)structures
B)variables
C)aliases
D)macros
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
29
The statement ____ makes the name REAL a synonym for double.

A)typedef double REAL;
B)#define double REAL
C)enum REAL double
D)typedef REAL double;
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
30
The definition REAL val; is ____.

A)not valid in C
B)is equivalent to double val; if it comes after typedef double REAL;
C)will generate a compiler warning
D)defines a macro instance if it comes after #define REAL double
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
31
The equivalence produced by a typedef statement can frequently be produced equally well by a ____ statement.

A)enum
B)#define
C)struct
D)alias
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
32
ARRAY first, second; is equivalent to the two definitions int first[100]; and int second[100]; if ____.

A)you are using a pre-ANSI C compiler
B)you are using a C/C++ compiler
C)the statement typedef int ARRAY[100]; is used before
D)the statement #define ARRAY int[100]; is used before
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
33
The conditional preprocessor directive ____ means "if not defined".

A)#ifdef
B)#ifndef
C)#ifnotdef
D)#ifnotdefined
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
34
The conditional preprocessor directive ____ means "if defined".

A)#ifdef
B)#ifndef
C)#ifdefined
D)#if_def
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
35
____ is the most frequently used conditional preprocessor directive.

A)#define
B)#else
C)#ifdef
D)#ifndef
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
36
Enumerated lists are identified by the reserved word ____ followed by an optional, user-selected name and a required list of one or more constants.

A)list
B)typedef
C)enumerate
D)enum
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
37
By default, the first enumerated name in an enumerated list has a value of ____.

A)-1
B)0
C)1
D)NULL
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
38
Explicit values can be assigned to each enumerated constant, with unspecified values automatically continuing the integer sequence from the last specified value. For example, ____.

A)enum {Mon: 1, Tue, Wed, Thr, Fri, Sat, Sun};
B)enum {Mon, Tue, Wed, Thr, Fri, Sat, Sun};
Mon = 1;
C)enum {Mon = 1, Tue, Wed, Thr, Fri, Sat, Sun};
D)enum {Mon 1, Tue, Wed, Thr, Fri, Sat, Sun};
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
39
A conditional expression uses the conditional operator, ____, and provides an alternate way of expressing a simple if-else statement.

A)->
B)?:
C)?
D):
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
40
The operator ____ is a ternary operator.

A)?:
B)->
C)&
D)[]
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
41
The ____ statement provides an unconditional transfer of control to some other statement in a program.

A)jump
B)goto
C)label
D)transfer
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
42
Using even one ____ statement in a program is almost always a sign of bad programming structure.

A)enum
B)typedef
C)goto
D)#define
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
43
The ____ operator causes a bit-by-bit AND comparison between its two operands.

A)~
B)^
C)&&
D)&
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
44
1 0 1 1 0 0 1 1 ____ 1 1 0 1 0 1 0 1 results in 1 0 0 1 0 0 0 1.

A)&
B)|
C)>>
D)<<
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
45
____ bit operations are extremely useful in masking, or eliminating, selected bits from an operand.

A)&
B)|
C)>>
D)<<
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
46
1 0 1 1 0 0 1 1 ____ 1 1 0 1 0 1 0 1 results in 1 1 1 1 0 1 1 1.

A)&
B)|
C)>>
D)<<
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
47
____ is the exclusive OR operator.

A)&
B)|
C)^
D)~
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
48
1 0 1 1 0 0 1 1 ____ 1 1 0 1 0 1 0 1 results in 0 1 1 0 0 1 1 0.

A)&
B)|
C)^
D)~
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
49
The complement operator, ____, is a unary operator that changes each 1 bit in its operand to 0 and each 0 bit to 1.

A)&
B)|
C)^
D)~
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
50
For unsigned integers, each left shift (using the << operator) corresponds to ____.

A)multiplication by 2
B)division by 2
C)multiplication by 4
D)division by 4
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
51
In an arithmetic right shift (using the >> operator), each right shift corresponds to ____.

A)multiplication by 2
B)division by 2
C)multiplication by 4
D)division by 4
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
52
In the equivalence statement #define SQUARE(x) x * x, x is ____.

A)fixed
B)an error
C)a variable
D)an argument
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
53
#define SQUARE(x) x * x
Val = SQUARE(num1 + num2);
Results in the equivalent statement ____.

A)val = num1 + (num2 * num1 + num2);
B)val = (num1 + num2 * num1) + num2;
C)val = (num1 + num2) * (num1 + num2);
D)val = num1 + num2 * num1 + num2;
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
54
Upon encountering the command line pgm14.3 three blind mice, the operating system stores it as a sequence of ____ strings.

A) one
C) four
B) three
D) five
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
55
To standardize arguments passing to a main() function, only ____ item(s) is/are allowed.

A) one
C) three
B) two
D) four
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 55 flashcards in this deck.