|
|
CS 216
Review for Second Quiz
- Variables known to several functions in C
are called ___.
- common
- local
- global
- shared
- Each of the following is a storage class
keyword, except which one?
- register
- local
- extern
- static
- A storage class in C does all of the
following except
- controls which functions in a file have
access to a variable.
- defines the data types that are possible
for a variable.
- determines in how many places the same
variables can be declared.
- determines how long the variable persists in memory.
- What scope do the variables jim and
sandy have, given the statements:
double names(double jim)
{
double sandy = 0.0;
.....
return sandy;
}
- file
- block
- function prototype
- Both b and c are correct answers
- By default, variables declared in a
function are ___.
- static
- register
- external
- automatic
- Automatic variables are initialized automatically to ___.
- 0
- 1
- -1
- They are never initialized automatically.
- External variables have ___ storage duration.
- block
- static
- automatic
- external
- If the keyword extern is used without a data type,
the compiler interprets it as being of type ___.
- int
- void
- char
- float
- Static class variables have ___ scope
but ___ storage duration.
- function, automatic
- block, external
- function, static
- block, static
- Which one of the following is the ANSI C
library random number function?
- random()
- rand0()
- randnum()
- rand()
- The checking of input for suitability is
called data ___.
- certification
- measurement
- validation
- standardization
- ___ programming is the art of protecting a program
(by the addition of extra checks on data)
from future fiddling.
- Protected
- Augmented
- External
- Defensive
- All of the following are advantages of the
modular approach to programming except which one?
- It makes it easier to tinker with the program.
- You can fix one module and leave
the rest of the program alone.
- You can avoid global decisions about
how the program should be designed.
- You can often use less compiler time.
- What does the following statement mean?
const float * ptr;
- The value of ptr cannot be changed.
- The value ptr points to cannot be changed.
- The address ptr points to cannot be changed.
- Both a and b are correct.
- The volatile qualifier is typically
used for ___ addresses.
- function
- variable
- hardware
- pointer
- Which one of the following classes can
only be requested rather than mandated?
- automatic
- register
- static
- external
- What is the keyword for the register storage class?
- reg
- auto_reg
- register
- regist
- Which one of the following storage classes
has local scope but persistent duration?
- auto
- local
- static
- external
- The parts of a structure are called ____.
- elements
- members
- fields
- Either members or fields.
- A structure ___ is the master plan that describes how a
structure is put together.
- framework
- model
- template
- form
- What best describes the use of the word,
book, given the following code?
struct book {
char title[MAXT];
char author[MAXA];
float value;
};
- A data type.
- A tag.
- A C language keyword.
- A switch.
- What is library, given the following code?
struct book {
char title[MAXT];
char author[MAXA];
float value;
} library;
- a constant
- a pointer
- a template
- a variable
- To access individual members of a structure,
what operator is required?
- :
- ;
- .
- ,
- To identify the member, title, of the fifth
element of an array of structures, which of
the following is correct?
- library[4] = title
- library.title[4]
- library[4].title[4]
- library[4].title;
- What data type is handle, given the following structure?
struct guy{
struct names handle;
char favfood[LEN];
char job[LEN];
float income;
};
- int
- struct names
- float
- undetermined
- We can state that the pointer ____ can be made
to point to any structure of the ___ type, given
the statement:
struct guy * him;
- him, guy
- him, pointer
- guy, him
- guy, struct
- If him is a pointer to the structure,
fellow[0], fellow[0].name means the same as ____.
- name -> him
- him -> fellow
- him -> name
- fellow -> him
- If him is a pointer to the structure,
fellow[0], and income is a member of the
structure, all of the following are equivalent
except which one?
- fellow[0].income == him -> income
- (*him).income == him -> income
- fellow[0].income == (*him).income
- (*him).income == him -> fellow
- If jones[] is an array of N structures,
which one of the following is used to pass
the array to a function named sum()?
- sum( jones, N);
- sum(&jones, N);
- sum(*jones, N);
- sum(->jones, N);
- A ___ is a type that enables you to store
different data types in the same memory space,
but not simultaneously.
- set
- intersect
- array
- union
- The -> operator is known as the ___ operator.
- forward looking
- indirect membership
- arrow
- direct membership
- Which one of the following is a VALID typedef statement?
- #typedef REAL float;
- typedef float REAL;
- typedef REAL float;
- #typedef float REAL;
- Which of the following means the same as
STRING name, sign;
given the typedef
typedef char * string;
- char * name, sign;
- char name, sign;
- char * (name, sign);
- char * name, * sign;
- What is meant by the following function prototype?
int (*fp) (const char * ps);
- fp is a function that takes a pointer to char
as an argument and returns an int.
- fp is a function that takes a pointer to char
as an argument and returns a pointer to int.
- fp points to a function that takes a pointer to char
as an argument and returns an int.
- fp points to a function that takes a pointer to char
as an argument and returns a pointer to int.
The answer is c. This answer is supplied because of the confusing
nature of the question. Read it over and see if you understand it.
|