Programming Fundamentals & Logic Flashcards
7 cards from real CPA 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 & Logic flashcards as text
Which type of error occurs when a program compiles successfully but produces incorrect results at runtime?
Answer: Logic error
A logic error means the program runs without crashing but produces wrong output due to a flaw in the algorithm.
An algorithm that divides a problem into smaller subproblems of the same type and solves them recursively is using which strategy?
Answer: Divide and conquer
Divide and conquer breaks a problem into smaller instances of itself, solves each recursively, and combines the results.
What value does an uninitialized boolean variable typically hold by default in strongly-typed languages?
Answer: FALSE
In most strongly-typed languages, boolean variables default to FALSE when declared but not explicitly initialized.
Which control structure is most appropriate when you need to execute a block of code at least once before checking a condition?
Answer: do-while loop
A do-while loop executes its body first, then checks the condition, guaranteeing at least one execution.
What is the purpose of a flowchart in programming?
Answer: To visually represent the steps and logic of an algorithm
A flowchart uses standardized symbols to graphically depict the flow of logic and decision-making steps in an algorithm.
If a function calls itself within its own definition, it is known as a:
Answer: Recursive function
A recursive function is one that calls itself as part of its own execution to solve a problem.
Which of the following is an example of a relational operator?
Answer: >=
The >= (greater than or equal to) operator is a relational operator used to compare two values.