cis 311 exam

Upload: brandon-tucker

Post on 09-Oct-2015

287 views

Category:

Documents


2 download

DESCRIPTION

MIS

TRANSCRIPT

Exam Practice TestsFunctionsWhat is the output of the following program?

Answer5

2

7

"getValue(x)"

A function ________ eliminates the need to place a function definition before all calls to the function.Answerheader

prototype

argument

parameter

None of these

________ functions may have the same name, as long as their parameter lists are different.AnswerOnly two

Two or more

Zero

Un-prototyped

None of these

A(n) ________ argument is passed to a parameter when the actual argument is left out of the function call.Answerfalse

true

null

default

None of these

This is a dummy function that is called instead of the actual function it represents.Answermain function

stub

driver

overloaded function

Here is the header for a function named computeValue:

Which of the following is a valid call to the function?AnswercomputeValue(10)

computeValue(10);

void computeValue(10);

void computeValue(int x);

What is the output of the following program?

Answer22

42

24

44

EXIT_FAILURE and ________ are named constants that may be used to indicate success or failure when the exit( ) function is called.AnswerEXIT_TERMINATE

EXIT_SUCCESS

EXIT_OK

RETURN_OK

None of these

Which line in the following program contains a call to the showDub function?

Answer4

6

10

15

Functions are ideal for use in menu-driven programs. When a user selects a menu item, the program can ________ the appropriate function.Answercall

prototype

define

declare

None of these

A ________ variable is declared outside all functions.Answerlocal

global

floating-point

counter

None of these

Look at the following function prototype.

What is the data type of the funtion's parameter variable?Answerint

double

void

can't tell from the prototype

This statement causes a function to end.Answerend

terminate

return

release

None of these

If a function is called more than once in a program, the values stored in the function's local variables do not ________ between function calls.Answerpersist

execute

communicate

change

None of these

A function ________ contains the statements that make up the function.Answerdefinition

prototype

call

expression

parameter list

A(n) ________ is information that is passed to a function, and a(n) ________ takes the information that is passed to the function.Answerfunction call, function header

parameter, argument

argument, parameter

prototype, header

None of these

This function causes a program to terminate, regardless of which function or control mechanism is executing.Answerterminate( )

return( )

continue( )

exit( )

None of these

When used as parameters, these types of variables allow a function to access the parameter's original argument.Answerreference

floating-point

counter

undeclared

None of these

What is the output of the following program?

Answer202

222

000

200

Which line in the following program contains the prototype for the showDub function?

Answer4

6

10

15

A function can have zero to many parameters, and it can return this many values.Answerzero to many

no

only one

a maximum of ten

None of these

This type of variable is defined inside a function and is not accessible outside the function.Answerglobal

reference

local

counter

None of these

It is a good programming practice to ________ your functions by writing comments that describe what they do.Answerexecute

document

eliminate

prototype

None of these

Which of the following statements about global variables is true?AnswerA global variable is accessible only to the main function.

A global variable is declared in the highest-level block in which it is used.

A global variable can have the same name as a variable that is declared locally within a function.

If a function contains a local variable with the same name as a global variable, the global variable's name takes precedence within the function.

All of these are true

What is the output of the following program?

Answer202

222

000

200

The value in a(n) ________ variable persists between function calls.Answerdynamic

local

counter

static local

Look at the following function prototype.

How many parameter variables does this function have?Int myfunction (double,double,double)

Answer1

2

3

can't tell from the prototype

These types of arguments are passed to parameters automatically if no argument is provided in the function call.Answerlocal

default

global

relational

None of these

In a function header, you must furnish:Answerdata type(s) of the parameters

data type of the return value

the name of function

names of parameter variables

All of these

A function is executed when it is:Answerdefined

prototyped

declared

called

None of these

This is a collection of statements that performs a specific task.Answerinfinite loop

variable

constant

function

None of these

This is a statement that causes a function to execute.Answerfor loop

do-while loop

function prototype

function call

None of these

Given the following function definition

Answer1 2 3

1 6 3

3 6 3

1 14 9

None of these

The value in this type of local variable persists between function calls.Answerglobal

internal

static

dynamic

None of these

If a function does not have a prototype, default arguments may be specified in the function ________.Answercall

header

execution

return type

None of these

Which line in the following program contains the header for the showDub function?

Answer4

6

10

15

ook at the following function prototype.

What is the data type of the funtion's return value?Answerint

double

void

can't tell from the prototype

Arrays

If you leave out the size declarator in an array definition:Answeryou must furnish an initialization list

you are not required to initialize the array elements

all array elements default to zero values

your array will contain no elements

Moving to the next question prevents changes to this answer.Question 2What will the following code display?

int numbers[ ] = {99, 87, 66, 55, 101 };cout