CSIT 111 Quiz #6

¡Supera tus tareas y exámenes ahora con Quizwiz!

A Return statement is optional in a function.

False

All properties of objects are listed in the properties list for an object. Therefore, functions are not necessary, but instead are only very convenient.

False

Although a Return statement is mandatory in a function, the statement can be removed by dragging it to the trash can.

False

Both functions and conditional execution control statements cannot be used with methods.

False

If the following world-level method is called from "world.my first method", what value would be returned? If False Return False Return True If True Return False Return True

False

If the following world-level method is called from "world.my first method", what value would be returned? If True Return False Return True

False

If the following world-level method is called from "world.my first method", what value would be returned? No Variables Return False Return True

False

If the following world-level method is called from "world.my first method", what value would be returned? Return 2 < 2

False

If the following world-level method is called from "world.my first method", what value would be returned? Return Both False == False and False

False

If the following world-level method is called from "world.my first method", what value would be returned? Return Both True and Eithe False, or Not True, or both

False

If the following world-level method is called from "world.my first method", what value would be returned? Return Either Not True or False, or both

False

If the following world-level method is called from "world.my first method", what value would be returned? Return Not Either True or False, or both

False

If the following world-level method is called from "world.my first method", what value would be returned? Return Not True

False

If the following world-level method is called from "world.my first method", what value would be returned? Return True! = True

False

It is not possible to specify the range of the random number function.

False

The only built-in functions in Alice are methods.

False

The value returned by a function is known as an argument.

False

How many user-created functions are called when the below code is run?

1

Given the following scene and code for the World.calc function, and a call to the function. The penguin and Alice are separated by 4 meters; Alice and the cow are separated by 3 meters. What value will the function return?

10 meters

Functions are an example of abstraction.

True

Given the following scene and code for the World.closer function, and a call to the function. What can be deduced about the calling function, considering that one of the four choices below must be true?

there is a If/Else control structure

How many total functions are called when the below code is run?

3

The penguin is .5 meters away from the soccer ball. How long will the following code take to run, assuming that only actions which change the state of the world take up time?

5 or more seconds

Given the following scene and code for the World.closer function. Alice is standing between a cow and a penguin. What value would be returned when a call to the function is executed?

Unclear. We need more information.

Which of the below ways are functions and methods similar.

both are called both are a collection of motion instructions

Functions allow you to _______________.

check certain conditions within a world while an animation is running

Match each control structure, appearing in the left column, with its description, appearing in the right column.

Do in order = makes a collection of instructions run sequentially Do together = makes a collection of instructions run at the same time If/Else = controls whether a block of instructions is executed or a method is called

A function can be used to check out a current condition in the world and make a decision about whether (or not) a method is called. Which control structure most likely uses the information returned from the function to evaluate whether (or not) to call a method?

If/Else

The use of a Boolean function to decide whether (or not) to call a method, most likely involves the use of what control structure?

If/Else

Complex logical expressions can be equivalently written as nested If statements.

True

Functions and conditional execution control statements are two key concepts in programming.

True

Given the following scene, what would the expression below evaluate to?

True

If the following world-level method is called from "world.my first method", what value would be returned? Return Either False or True, or both

True

If the following world-level method is called from "world.my first method", what value would be returned? Return Either True or False, or both

True

If the following world-level method is called from "world.my first method", what value would be returned? Return False == False

True

If the following world-level method is called from "world.my first method", what value would be returned? Return True

True

In a function, objects do not move, turn, or perform any action. They leave the state of the world unchanged.

True

It is possible for a function to have no arguments.

True

It is possible for the programmer to write their own function in Alice.

True

It is possible to write both class-level and world-level functions.

True

Nested If statements are really composed of multiple If statements.

True

Regardless of how a condition is written, it must evaluate to true or false.

True

Simply put, absolute value ignores a negative sign.

True

The default range of values for a random number is 0 to 1.

True

The output from a function is the value being returned by the function.

True

The purpose of a function is to return a value.

True

Will the penguin always kick the ball when the following code is run?

Yes

One benefit of using functions is ____________.

abstraction

For simplicity, an If/Else control structure is commonly refered to as ___________.

an If statement

The value returned by a function is ____________.

any of the above

Which function or method below could be used in the condition of a Loop structure, if no logical operators are used?

distance to the right of

Given the following scene and code for the World.closer function, and a call to the function. Alice is standing between a cow and a penguin. What value would be returned when a call to the function is executed? a = cow

false

Given the following scene and code for the World.closer function, and a call to the function. Alice is standing between a cow and a penguin. What value would be returned when a call to the function is executed? a = penguin

false

Given the following scene and the following code for the World.closer function, and a call to the function. Alice is standing between a cow and a penguin. What value would be returned when a call to the function is executed? a = penguin c = aliceLiddell

false

Where is the bug in the following code?

in soccerBall.isKickable

Logical operators can be found _____________.

in the list of World functions

Match the six relational operators, in the right column, with their relationship between two values, in the left column.

is equal to = == is greater than = > is not equal to = != is greater than or equal to = >= is less than or equal to = <= is less than = <

Which function or method below could be used in the condition of an If/Else structure, if no logical operators are used?

is smaller than

Match each logical operator, in the left column, with its meaning in the right column.

not = not this or = either this or that or possibly both and = both this and that

Aligning an object with the sense of direction of another object can be accomplished through the use of the ___________.

orient to method

The six relational operators are part of ______________.

the World's built-in functions

There is a bug in the soccerBall.isKickable function in the following code. What is the bug?

the function always returns true

The below loop moves a horse a random distance. After the code is run, where will the horse be with respect to its original position?

the same place where it started

An If/Else statement makes a decision based on ______________.

the value of a condition as a program is running


Conjuntos de estudio relacionados

Chapter 41: Management of Patients with Intestinal and Rectal Disorders

View Set

Classes of Hazards, Hazmat - Will Carry -General Philosophy

View Set

12 PEDIATRIC SUCCESS ORTHOPEDIC DISORDERS

View Set

Physical Science Track In-class Notes

View Set

Med Surg I Exam 1 Practice Questions

View Set