Programming Concepts Flashcards

1
Q

What is an algorithm?

A

A step-by-step set of instructions used to solve a problem or perform a task.

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

What is a variable?

A

A named storage location that holds a value which can change while the program is running.

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

What is a constant?

A

A named value that does not change while the program is running.

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

What is sequence in programming?

A

The order in which instructions are executed, one after another.

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

What is selection in programming?

A

Making decisions in code using conditions (e.g., if, elif, else).

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

What is iteration in programming?

A

Repeating a set of instructions — can be a fixed number of times (for) or while a condition is true (while).

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

What is a data type?

A

A classification of data which tells the computer how the programmer intends to use it (e.g., integer, string, boolean).

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

What are the common data types in Python?

A

• Integer (int): whole numbers
• Float: numbers with decimal places
• String (str): text
• Boolean (bool): True or False

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

What is casting in programming?

A

Changing the data type of a value (e.g., int(“10”) to turn a string into an integer).

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

What are the comparison operators in Python?

A

• == (equal to)
• != (not equal to)
• < (less than)
• > (greater than)
• <= (less than or equal to)
• >= (greater than or equal to)

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

What are logical operators in Python?

A

• and: True if both conditions are true
• or: True if at least one condition is true
• not: Reverses the condition (True becomes False)

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

What is a subroutine?

A

A block of code that can be called and reused — either a function or a procedure.

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

What is the difference between a function and a procedure?

A

• Function: returns a value
• Procedure: performs an action but doesn’t return a value

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

What are the advantages of using subroutines?

A

• Avoids repetition
• Makes code easier to read and test
• Allows code reuse
• Makes programs easier to maintain

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

What is the purpose of comments in code?

A

To explain what the code does — useful for documentation and understanding by others (and yourself).

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

What is a syntax error?

A

An error in the code that breaks the rules of the programming language — prevents the program from running.

17
Q

What is a logic error?

A

An error in the program’s design that causes incorrect behaviour or output, even though the code runs.

18
Q

What is debugging?

A

The process of finding and fixing errors (bugs) in a program.

19
Q

What is an IDE?

A

Integrated Development Environment — a software package that provides tools for coding, such as a code editor, debugger, and interpreter/compiler.

20
Q

Name three features of an IDE that help programmers.

A

• Syntax highlighting
• Error messages and debugging tools
• Code completion and suggestions