1.2.3 Flashcards

(26 cards)

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 variable can be changed after it is initialized.

A

False

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

Fill in the blank: An ________ is a sequence of instructions that performs a specific task.

A

algorithm

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

What is the purpose of a loop in programming?

A

A loop is used to repeat a block of code multiple times.

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

What symbol is often used to denote a comment in Python?

A

#

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

Multiple Choice: Which of the following is a valid variable name? A) 1stVariable B) first_variable C) first-variable D) first variable

A

B) first_variable

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

What does ‘if’ statement do in programming?

A

An ‘if’ statement executes a block of code if its condition evaluates to true.

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

True or False: The else statement can be used without an if statement.

A

False

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

What is the purpose of a function?

A

A function is a reusable block of code that performs a specific task.

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

Fill in the blank: A ________ is a collection of related data items.

A

data structure

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

What is an array?

A

An array is a data structure that can hold multiple values of the same type.

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

Multiple Choice: Which of the following is NOT a data type? A) Integer B) String C) List D) Loop

A

D) Loop

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

What is the difference between a list and a tuple in Python?

A

A list is mutable (can be changed), while a tuple is immutable (cannot be changed).

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

True or False: In programming, ‘syntax’ refers to the structure of code.

A

True

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

What is an error in programming?

A

An error is an issue in the code that prevents it from running correctly.

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

Fill in the blank: A ________ is a way to group related functions and variables.

17
Q

What does ‘debugging’ mean?

A

Debugging is the process of identifying and removing errors from code.

18
Q

Multiple Choice: Which of the following is a control structure? A) Variable B) Loop C) Function D) Data type

19
Q

What is the function of ‘return’ in a function?

A

The ‘return’ statement ends the function and sends a value back to the caller.

20
Q

True or False: Comments in code are executed by the program.

21
Q

What is the purpose of a ‘while’ loop?

A

A ‘while’ loop continues to execute as long as its condition is true.

22
Q

Fill in the blank: The ________ operator is used to compare two values for equality.

23
Q

What is an IDE?

A

An IDE (Integrated Development Environment) is software that provides tools for programming.

24
Q

Multiple Choice: Which of the following is an example of a conditional statement? A) for loop B) if statement C) function D) variable declaration

A

B) if statement

25
What does 'API' stand for?
API stands for Application Programming Interface.
26
True or False: An infinite loop is a loop that never ends.
True