Question 1
________may contain different data types.
Question 1 options:
|
a)
|
structures
|
|
b)
|
arrays
|
|
c)
|
both a and b
|
|
d)
|
none of these
|
Question 2
What does the deck[52] array contain in the following statement?
struct card a, deck[52], *cPtr;
Question 2 options:
|
a)
|
card structure elements
|
|
b)
|
a structure elements
|
|
c)
|
*cPtr elements
|
|
d)
|
none of these
|
Question 3
Keyword __________ introduces the structure definition.
Question 3 options:
|
a)
|
structure
|
|
b)
|
str
|
|
c)
|
strdef
|
|
d)
|
struct
|
Question 4
What does the following statement do?
struct card a = { "Three", "Hearts" };
Question 4 options:
|
a)
|
It creates a variable card of type struct with two members specified in the list.
|
|
b)
|
It creates two variables named Three and Hearts of type struct card a.
|
|
c)
|
It creates a variable a to be of type struct card and initializes it to the values in the list.
|
|
d)
|
It creates two variables named Three and Hearts of type struct card.
|
Question 5
Creating a new name with typedef __________.
Question 5 options:
|
a)
|
creates a new type
|
|
b)
|
creates a new type name
|
|
c)
|
creates a new variable
|
|
d)
|
creates a new variable name
|
Question 6
A string array
Question 6 options:
|
a)
|
stores an actual string in each of its elements
|
|
b)
|
can only provide access to strings of a certain length
|
|
c)
|
is actually an array of pointers
|
|
d)
|
is always less memory efficient than an equivalent double-subscripted array
|
Question 7
Assuming that t is an array and tPtr is a pointer to that array, what expression refers to the address of element 3?
Question 7 options:
|
a)
|
*( tPtr + 3 )
|
|
b)
|
tPtr[ 3 ]
|
|
c)
|
&t[ 3 ]
|
|
d)
|
*( t + 3 )
|
Question 8
Given that k is an integer array starting at location 2000, kPtr is a pointer to k, and each integer is stored in 4 bytes of memory, what location does kPtr + 3 point to?
Question 8 options:
Question 9
Which of the following can have a pointer as an operand?
Question 9 options:
Question 10
Preprocessing occurs
Question 10 options:
|
a)
|
before a program is compiled.
|
|
b)
|
during compilation.
|
|
c)
|
after compilation but before execution.
|
|
d)
|
immediately before execution.
|
Question 11
The #include preprocessor directive causes a(n) ____________ to be included in place of the directive.
Question 11 options:
|
a)
|
copy of a file
|
|
b)
|
# character
|
|
c)
|
pointer to a file
|
|
d)
|
constant
|
Question 12
Which of the following statements is correct?
Question 12 options:
|
a)
|
#define X = 3
|
|
b)
|
#define X 3, Y 4
|
|
c)
|
#define X 3
|
|
d)
|
#define X:3
|
Question 13
If the macro
#define RECTANGLE_AREA( x, y ) ( ( x ) * ( y ) )
has been defined. Then the line
rectArea = RECTANGLE_AREA( a + 4, b + 7 );
will be expanded to
Question 13 options:
|
a)
|
rectArea = 11;
|
|
b)
|
rectArea = ( a + 4 * b + 7 );
|
|
c)
|
rectArea = ( ( a + 4 ) * ( b + 7 ) );
|
|
d)
|
RECTANGLE_AREA( a + 4 , b + 7 );
|
Question 14
Which of the following is not a valid directive?
Question 14 options:
|
a)
|
#endif
|
|
b)
|
#if
|
|
c)
|
#for
|
|
d)
|
#elif
|
Question 15
You can use an assignment statement to copy the contents of one struct into another struct of the same type.
Question 15 options:
Question 16
The components of a struct are called the ____ of the struct.
Question 16 options:
|
variables
|
|
identifiers
|
|
elements
|
|
members
|
Question 17
Which of the following struct definitions is correct in C?
Question 17 options:
|
struct studentType { int ID; };
|
|
struct studentType { string name; int ID; double gpa; }
|
|
int struct studentType { ID; }
|
|
struct studentType { int ID = 1; };
|
Question 18
Consider the following struct definition:
struct rectangleData
{
double length;
double width;
double area;
double perimeter;
};
Which of the following variable declarations is correct?
Question 18 options:
|
struct rectangle rectangleData;
|
|
struct rectangleData;
|
|
struct rectangleData myRectangle;
|
|
rectangleData rectangle;
|
Question 19
Typically, in a program, a struct is defined ____ in the program.
Question 19 options:
|
in the main function
|
|
before the definitions of all the functions
|
|
after the definitions of all the functions
|
|
in any function
|
Question 20
An array name and index are separated using ____.
Question 20 options:
|
curly brackets
|
|
square brackets
|
|
a dot
|
|
a comma
|
Question 21
The syntax for accessing a struct member is structVariableName____.
Question 21 options:
|
.memberName
|
|
*memberName
|
|
[memberName]
|
|
$memberName
|
Question 22
Consider the following statements:
struct rectangleData
{
double length;
double width;
double area;
double perimeter;
};
struct rectangleData bigRect;
Which of the following statements correctly initializes the component length of bigRect?
Question 22 options:
|
bigRect = {10};
|
|
bigRect.length = 10;
|
|
length[0]= 10;
|
|
bigRect[0]= 10
|
Question 23
You can assign the value of one struct variable to another struct variable of ____ type.
Question 23 options:
|
a simple data
|
|
the same
|
|
an array
|
|
any
|
Question 24
Consider the following statements:
struct supplierType
{
char name[20];
int supplierID;
};
struct applianceType
{
supplierType supplier;
char modelNo[10];
double cost;
};
struct applianceType applianceList[25];
Which of the following best describes applianceList?
Question 24 options:
|
It is a multidimensional array.
|
|
It is a struct.
|
|
It is an array of structs.
|
|
It is a struct of arrays.
|
Question 25
Consider the following statements:
struct supplierType
{
string name;
int supplierID;
};
struct paintType
{
supplierType supplier;
string color;
string paintID;
};
struct paintType paint;
What is the data type of paint.supplier?
Question 25 options:
|
string
|
|
paintType
|
|
supplierType
|
|
struct
|