Free Online Flashcard Deck

2 Variables, Data Types, and Expressions Free Online FlashCards

Study 2 Variables, Data Types, and Expressions with 12 free online flashcards. Review key terms, definitions, and concepts with this interactive flashcard deck.

12 cards
01
Front

What is the difference between a value and a literal?

Back

A value is data that a program can store or use; a literal is a value written directly in source code, such as 42 or "Ada".

02
Front

What is a variable?

Back

A variable is a name associated with a value, allowing a program to refer to, reuse, or update that information.

03
Front

What does a data type determine?

Back

A data type identifies what kind of value is represented and which operations are appropriate for it.

04
Front

Is "42" a string or an integer?

Back

True. The string "42" is text, whereas 42 is an integer.

05
Front

What values can a Boolean contain?

Back

A Boolean has one of two logical values: True or False. Comparisons commonly produce Boolean results.

06
Front

What is an expression?

Back

An expression is code that evaluates to a value. It can contain literals, variables, operators, function calls, or nested expressions.

07
Front

What does 2 + 3 * 4 evaluate to?

Back

14. Multiplication has higher precedence than addition, so 3 * 4 is evaluated before 2 is added.

08
Front

What is the result of 7 // 2 in Python?

Back

3. In Python, // performs floor division, producing the whole-number quotient for 7 divided by 2.

09
Front

What is the result of 7 % 2?

Back

1. The remainder operator % gives what remains after integer division: 7 % 2 equals 1.

10
Front

How do = and == differ in Python?

Back

= assigns a value to a variable; == compares two values for equality and produces a Boolean result.

11
Front

After count = 10 and count = count + 1, what is count?

Back

11. Python evaluates count + 1 using the current value 10, then assigns the result back to count.

12
Front

What is type conversion?

Back

Type conversion changes a value from one data type to another, such as converting the text "20" to the integer 20 with int().