Zybooks Chapter 2

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

Given variables x, y, and z. x = 9 y = x + 1 What is x?

9

assignment

An _________ assigns a variable with a value such as x = 5. That assignment means x is assigned with 5, and x keeps that value during subsequent assignments, until x is assigned again.

=

Because in programming ____ means assignment

Indicate the value of x after the assignments execute. x = 2 y = 3 x = x * y x = x * y

18

Indicate the value of x after the assignments execute. y = 30 x = y + 2 x = x + 1

33

Indicate which assignments are valid.: x = y

valid

Indicate which assignments are valid.: x = y + 2

valid

Indicate which assignments are valid: x = 1

valid

A ______________ is a statement that declares a new variable

variable declaration

Complete this assignment to increment y: y = _____

y's current value gets 1 added, and y is assigned with that new value. If y was 7, then y is assigned with 7 + 1 or 8. Therefore: y + 1

Indicate the value of x after the assignments execute. x = 5 x = x + 7

12

Given variables x, y, and z. x = 9 y = x + 1 What is y?

10

Given variables x, y, and z. x = 9 y = x + 1 x = 5 What is y?

10

variable

In a program, a _______ is a named item, such as x or numPeople, used to hold a value.

= is not equals

In programming, = is an assignment of a left-side variable with a right-side value. = is NOT equality as in mathematics. Thus, x = 5 is read as "x is assigned with 5", and not as "x equals 5". When one sees x = 5, one might think of a value being put into a box.

incrementing

Increasing a variable's value by 1, as in x = x + 1, is common, and known as _________ the variable.

Indicate which assignments are valid.: x + 1 = 3

invalid

Indicate which assignments are valid.: x + y = y + x

invalid


Ensembles d'études connexes

Your Money & Credit (Test 1-Ch.2)

View Set

911 Driving School test #3 review

View Set

Kinesiology Chapter 12 Physical Fitness

View Set

Algebra 2 Lap 7: Conic figures (parabola, circle, ellipse, hyperbola)

View Set

"Med-surgical Nursing N214 Test two

View Set