computer science Flashcards

(20 cards)

1
Q

Q1: What is programming?

A

A1: Giving exact step-by-step instructions to a computer so it does exactly what you want.

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

Q2: What is the goal of programming?

A

A2: To speak to computers in their language and create things like games, apps, or drawings

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

Q3: Name three things programming IS.

A
  1. Giving instructions to a machine, 2. Solving problems logically, 3. Like writing a recipe for a robot.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Q4: Name three things programming IS NOT.

A
  1. Clicking randomly, 2. Saying “please” and hoping it works, 3. Magic that happens automatically.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Q5: Why should you learn programming?

A

You can create your own projects, understand apps and websites, practice logical thinking, and control technology.

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

Q6: What does a programmer do?

A

Writes code to tell computers exactly what to do and turns ideas into working creations.

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

Q7: What is a variable?

A

A variable is like a box that stores information, such as numbers, words, or sentences.

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

Q8: Give examples of data types you can store in variables.

A

A8: Text (string), sentence, number (integer), decimal (float).

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

Q9: Rules for naming variables?

A

A9: Must start with a letter, can include numbers (not at start), use underscores for spaces, and cannot use spaces, symbols, or Python keywords.

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

Q10: What is wrong with these variable names: 1name, my name, my-name, print?

A

A10: 1name → starts with number; my name → has space; my-name → hyphen not allowed; print → Python keyword.

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

Q11: What is addition, subtraction, multiplication, division, and modulus?

A

Addition + sums numbers, subtraction - subtracts, multiplication * multiplies, division / divides, modulus % gives remainder.

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

Q12: How does + behave with strings?

A

A12: It joins strings (concatenation).

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

Q13: How does * behave with strings?

A

A13: It repeats strings.

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

Q14: What happens if you try “Hello” + 5?

A

It causes a TypeError because you cannot add a string and a number directly.

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

Q15: What does input() do?

A

A15: Lets the computer ask the user a question and stores the answer as text (string).

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

Q16: How do you get a number from input()?

A

A16: Use int(input()) to convert the text to a number.

17
Q

Q17: How do you fix the error when trying “Hi” + 5?

A

A17: Convert the number to a string with str(5) → “Hi” + str(5).

18
Q

Q18: How do you save a Python program?

A

A18: Click File → Save As…, give a name (e.g., hello_user.py), and click Save.

19
Q

Q19: Why is input() important?

A

A19: It makes programs interactive and allows the computer to “talk” with the user.

20
Q

Q20: What is the difference between the variable name and content inside?

A

: The variable name cannot have symbols like !, but the content inside (string) can, e.g., fruit = “Apple!”.