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
What is the output of the following pseudocode? x = 10; y = 3; print(x MOD y)
Answer: 1
The MOD (modulo) operator returns the remainder of 10 divided by 3, which is 1.
Which data structure follows the Last-In, First-Out (LIFO) principle?
Answer: Stack
A stack follows LIFO, meaning the last element pushed is the first one popped.
A variable declared inside a function that cannot be accessed outside it has what kind of scope?
Answer: Local scope
Variables declared inside a function have local scope and are inaccessible outside that function.
What logical operator returns TRUE only when both operands are TRUE?
Answer: AND
The AND operator evaluates to TRUE only if both the left and right operands are TRUE.
In a for-loop defined as 'for i = 1 to 5', how many times does the loop body execute?
Answer: 5
The loop iterates for i = 1, 2, 3, 4, 5, so the body executes exactly 5 times.
Which of the following best describes a constant in programming?
Answer: A named memory location whose value cannot be changed after assignment
A constant is a named storage location whose value is fixed and cannot be modified after it is initially set.
What is the result of evaluating: TRUE OR FALSE AND FALSE?
Answer: TRUE
AND has higher precedence than OR, so FALSE AND FALSE = FALSE first, then TRUE OR FALSE = TRUE.