2.2 Flashcards

1
Q

What is a variable in programming?

A

A variable is a storage location identified by a name that holds a value.

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

True or False: A constant can be changed after it has been declared.

A

False

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

Fill in the blank: A _____ is a sequence of instructions that a computer can execute.

A

program

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

What does an algorithm represent?

A

An algorithm is a step-by-step procedure for solving a problem.

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

Which of the following is a data type? (a) Integer (b) Loop (c) Function

A

a) Integer

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

What is the purpose of a loop in programming?

A

A loop is used to execute a block of code repeatedly until a condition is met.

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

What is the difference between a syntax error and a runtime error?

A

A syntax error occurs when the code violates the language’s rules, while a runtime error occurs during the execution of the program.

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

True or False: A function can return a value.

A

True

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

What is an array?

A

An array is a collection of items stored at contiguous memory locations.

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

Which keyword is used to define a function in Python?

A

def

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

What is meant by ‘conditional statement’?

A

A conditional statement executes different actions based on whether a condition is true or false.

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

Fill in the blank: A _____ is a reusable piece of code that performs a specific task.

A

function

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

What does ‘debugging’ refer to in programming?

A

Debugging is the process of identifying and removing errors from computer software.

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

What is the purpose of comments in code?

A

Comments are used to explain code and are ignored by the compiler.

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

Which of the following is a control structure? (a) If statement (b) Array (c) Function

A

a) If statement

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

True or False: A string is a data type that represents a sequence of characters.

17
Q

What does ‘iteration’ mean in programming?

A

Iteration refers to the repeated execution of a set of instructions in a loop.

18
Q

What is the purpose of an ‘if’ statement?

A

An ‘if’ statement executes a block of code if a specified condition is true.

19
Q

Fill in the blank: A _____ is a variable that holds a true or false value.

20
Q

What is a ‘syntax error’?

A

A syntax error occurs when the code does not conform to the rules of the programming language.

21
Q

What is a ‘loop control variable’?

A

A loop control variable is a variable that determines how many times a loop will execute.

22
Q

Which of the following represents a list of items? (a) Integer (b) Array (c) String

23
Q

What is meant by ‘scope’ in programming?

A

Scope refers to the visibility of variables and functions within a program.

24
Q

True or False: A ‘for’ loop is used for iterating a specific number of times.

25
Q

What is a ‘parameter’ in a function?

A

A parameter is a variable used to pass information into a function.

26
Q

Fill in the blank: A _____ is a programming construct that allows for decision-making.

A

conditional statement

27
Q

What do we call a value that does not change during the execution of a program?