1.1.2 Flashcards

(35 cards)

1
Q

What is the purpose of an algorithm in computer science?

A

To provide a step-by-step procedure for solving a problem.

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

True or False: A flowchart is a graphical representation of an algorithm.

A

True

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

Fill in the blank: An algorithm must always terminate after a finite number of steps; this is known as __________.

A

finiteness

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

What are the three basic control structures in algorithms?

A

Sequence, selection, and iteration.

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

Multiple Choice: Which of the following is NOT a type of control structure? A) Sequence B) Selection C) Looping D) Iteration

A

C) Looping

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

What is a variable in programming?

A

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
7
Q

True or False: Variables can hold multiple data types at the same time.

A

False

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

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

A

equality

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

What does ‘iteration’ refer to in algorithms?

A

Repeating a set of instructions until a condition is met.

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

Multiple Choice: Which loop structure continues until a condition is false? A) For loop B) While loop C) Do-while loop D) All of the above

A

D) All of the above

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

What is a conditional statement?

A

A statement that 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

True or False: A ‘for’ loop is typically used when the number of iterations is known.

A

True

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

Fill in the blank: A __________ is a collection of data items stored under a single name.

A

array

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

What is the purpose of a function in programming?

A

To encapsulate a block of code that performs a specific task.

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

Multiple Choice: What is the return type of a function that does not return a value? A) int B) void C) string D) None of the above

A

B) void

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

What is the difference between a parameter and an argument?

A

A parameter is a variable in a function definition; an argument is the actual value passed to the function.

17
Q

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

18
Q

Fill in the blank: The __________ is the main entry point of most programs.

A

main function

19
Q

What is debugging?

A

The process of finding and fixing errors in code.

20
Q

Multiple Choice: Which of the following is a common debugging tool? A) Compiler B) IDE C) Text editor D) All of the above

A

D) All of the above

21
Q

What is pseudocode?

A

An informal way of describing an algorithm using a mixture of natural language and programming-like syntax.

22
Q

True or False: Pseudocode can be executed directly by a computer.

23
Q

Fill in the blank: __________ refers to the process of analyzing a problem and defining its requirements.

A

Problem definition

24
Q

What is the significance of testing an algorithm?

A

To ensure that it works correctly and efficiently under various conditions.

25
Multiple Choice: Which testing method involves running the algorithm with known inputs and verifying the outputs? A) Black box testing B) White box testing C) Regression testing D) All of the above
A) Black box testing
26
What does 'complexity' in algorithms refer to?
The amount of resources (time and space) required to execute the algorithm.
27
True or False: An algorithm with a lower time complexity is generally more efficient.
True
28
Fill in the blank: The __________ notation is used to describe the performance of an algorithm.
Big O
29
What is an infinite loop?
A loop that continues to execute indefinitely due to a condition that never becomes false.
30
Multiple Choice: Which of the following can cause an infinite loop? A) Incorrect loop condition B) Missing loop counter C) Both A and B D) None of the above
C) Both A and B
31
What is a binary search algorithm?
An efficient algorithm for finding an item from a sorted list by repeatedly dividing the search interval in half.
32
True or False: A linear search is generally faster than a binary search for large datasets.
False
33
Fill in the blank: __________ is the process of transforming data into a format suitable for analysis.
Data preprocessing
34
What is the purpose of sorting algorithms?
To arrange data in a specific order, such as ascending or descending.
35
Multiple Choice: Which sorting algorithm repeatedly steps through the list, compares adjacent elements and swaps them if they are in the wrong order? A) Quick sort B) Bubble sort C) Merge sort D) Insertion sort
B) Bubble sort