Programming Fundamentals Flashcards
7 cards from real CCS practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 7 Programming Fundamentals flashcards as text
Which of the following best describes an algorithm?
Answer: A step-by-step procedure for solving a problem
An algorithm is a finite, ordered set of instructions designed to solve a specific problem or perform a task.
What is the primary purpose of a function parameter?
Answer: To pass data into a function when it is called
Parameters allow callers to supply input values that the function uses during its execution.
In most programming languages, arrays use which type of indexing by default?
Answer: 0-based indexing
Most languages like C, Java, and Python start array indices at 0, so the first element is at index 0.
What is a 'boolean' data type used for?
Answer: Representing true or false values
A boolean data type holds only two possible values: true or false, commonly used in conditional logic.
Which control structure is best suited when you need to execute a block of code for each item in a collection?
Answer: for loop
A for loop is designed to iterate over a sequence or collection, executing the body for each element.
What does it mean when a variable is declared as a 'constant'?
Answer: Its value cannot be changed after it is set
A constant is a named value that is assigned once and cannot be modified during program execution.
Which sorting algorithm repeatedly swaps adjacent elements that are in the wrong order?
Answer: Bubble sort
Bubble sort works by comparing and swapping adjacent elements repeatedly until the list is sorted.