1.1.2 Flashcards
(35 cards)
What is the purpose of an algorithm in computer science?
To provide a step-by-step procedure for solving a problem.
True or False: A flowchart is a graphical representation of an algorithm.
True
Fill in the blank: An algorithm must always terminate after a finite number of steps; this is known as __________.
finiteness
What are the three basic control structures in algorithms?
Sequence, selection, and iteration.
Multiple Choice: Which of the following is NOT a type of control structure? A) Sequence B) Selection C) Looping D) Iteration
C) Looping
What is a variable in programming?
A storage location identified by a name that holds a value.
True or False: Variables can hold multiple data types at the same time.
False
Fill in the blank: The __________ operator is used to compare two values for equality.
equality
What does ‘iteration’ refer to in algorithms?
Repeating a set of instructions until a condition is met.
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
D) All of the above
What is a conditional statement?
A statement that executes different actions based on whether a condition is true or false.
True or False: A ‘for’ loop is typically used when the number of iterations is known.
True
Fill in the blank: A __________ is a collection of data items stored under a single name.
array
What is the purpose of a function in programming?
To encapsulate a block of code that performs a specific task.
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
B) void
What is the difference between a parameter and an argument?
A parameter is a variable in a function definition; an argument is the actual value passed to the function.
True or False: Comments in code are executed by the compiler.
False
Fill in the blank: The __________ is the main entry point of most programs.
main function
What is debugging?
The process of finding and fixing errors in code.
Multiple Choice: Which of the following is a common debugging tool? A) Compiler B) IDE C) Text editor D) All of the above
D) All of the above
What is pseudocode?
An informal way of describing an algorithm using a mixture of natural language and programming-like syntax.
True or False: Pseudocode can be executed directly by a computer.
False
Fill in the blank: __________ refers to the process of analyzing a problem and defining its requirements.
Problem definition
What is the significance of testing an algorithm?
To ensure that it works correctly and efficiently under various conditions.