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 programming concept allows a function to call itself to solve a problem?
Answer: Recursion
Recursion is when a function calls itself repeatedly until a base condition is met.
In object-oriented programming, what is the term for bundling data and methods that operate on that data within one unit?
Answer: Encapsulation
Encapsulation bundles data and the methods that manipulate that data into a single class or object.
What does a 'while' loop check before executing its body?
Answer: A condition that must be true to continue
A while loop evaluates its condition before each iteration and exits when the condition becomes false.
Which data structure follows the Last-In, First-Out (LIFO) principle?
Answer: Stack
A stack operates on LIFO, meaning the last element added is the first one removed.
What is the result of the expression 7 % 3 in most programming languages?
Answer: 1
The modulo operator (%) returns the remainder of division; 7 divided by 3 is 2 with remainder 1.
Which type of error occurs when code is syntactically correct but produces an unintended result?
Answer: Logic error
A logic error means the program runs without crashing but produces incorrect output due to flawed reasoning.
What does the term 'scope' refer to in programming?
Answer: The visibility and lifetime of a variable
Scope defines where in the code a variable can be accessed and how long it exists.