Chapter 1 Flashcards

(34 cards)

1
Q

What is a variable?

A

A name that holds a value

Variables are fundamental in programming as they store data that can be changed during the execution of a program.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is an assignment?

A

Giving a variable a value, like x = 5

Assignment is a key concept in programming where a value is assigned to a variable.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is an int?

A

A whole number, like 4

Integers are commonly used in programming for counting and indexing.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a float?

A

A number with a decimal, like 3.5

Floats are used for representing real numbers and are important for calculations that require precision.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What does + do?

A

Adds numbers

The addition operator can also be used for string concatenation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What does - do?

A

Subtracts numbers

Subtraction is a fundamental arithmetic operation in programming.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What does * do?

A

Multiplies numbers

Multiplication is essential for scaling values and calculations.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What does / do?

A

Divides numbers

Division can result in float values if the divisor is not a factor of the dividend.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What does // do?

A

Divides and keeps only the whole number

This is known as floor division and is useful for integer results.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does ** do?

A

Raises a number to a power

Exponentiation is used in many mathematical and scientific calculations.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What does % do?

A

Gives the remainder after dividing

The modulus operator is often used to determine even or odd numbers.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is order of operations in Python?

A

Python follows PEMDAS

PEMDAS stands for Parentheses, Exponents, Multiplication and Division (from left to right), Addition and Subtraction (from left to right).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is a string?

A

Words or text inside quotes, like ‘hello’

Strings are used to represent textual data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is string concatenation?

A

Adding strings together, like ‘hi’ + ‘bye’ = ‘hibye’

Concatenation is a common operation for combining strings.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is a Boolean (bool)?

A

A value that is True or False

Booleans are critical for control flow in programming.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What does == mean?

A

Equal to

This operator is used for comparison between values.

17
Q

What does != mean?

A

Not equal to

The inequality operator is essential for conditional statements.

18
Q

What does < mean?

A

Less than

Comparison operators are used to evaluate conditions.

19
Q

What does > mean?

A

Greater than

This operator helps in making decisions based on numerical comparisons.

20
Q

What does <= mean?

A

Less than or equal to

This operator allows for inclusive comparisons.

21
Q

What does >= mean?

A

Greater than or equal to

Similar to <=, it helps in establishing boundaries in comparisons.

22
Q

What does and mean?

A

Both sides must be true

The logical AND operator is used in compound conditions.

23
Q

What does or mean?

A

One side must be true

The logical OR operator allows for flexible condition checks.

24
Q

What does not mean?

A

Switches true to false, or false to true

The NOT operator is used to negate boolean values.

25
What is an expression?
Code that gives a value ## Footnote Expressions can include variables, constants, and operators.
26
What is an algorithm?
Steps to solve a problem ## Footnote Algorithms are essential for programming and computational problem-solving.
27
What does if do?
Checks a condition and runs the code if it's true ## Footnote The if statement is a fundamental control structure.
28
What does elif do?
Checks another condition if if is false ## Footnote Elif allows for multiple conditional branches in code.
29
What does else do?
Runs if all above conditions are false ## Footnote The else statement provides a fallback option in conditional logic.
30
What is selection in coding?
Picking what code runs based on conditions ## Footnote Selection structures are crucial for decision-making in programs.
31
What does input() do?
Asks the user to type something ## Footnote Input functions are used to gather user data during program execution.
32
What does print() do?
Shows text on the screen ## Footnote The print function is commonly used for debugging and displaying output.
33
What is pseudocode?
Fake code to plan real code ## Footnote Pseudocode is a helpful tool for outlining algorithms before actual coding.
34
What is a function?
Named code you can run when you want ## Footnote Functions help to organize code and promote reuse.