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
What type of data structure uses key-value pairs for storage?
Answer: Dictionary (hash map)
A dictionary or hash map stores data as key-value pairs, allowing fast lookup by key.
Which 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.
What is the purpose of a 'break' statement inside a loop?
Answer: To immediately exit the loop
A break statement terminates the enclosing loop immediately, transferring control to the statement after the loop.
In programming, what is a 'string'?
Answer: A sequence of characters treated as text
A string is a data type that represents a sequence of characters, typically used to store and manipulate text.
Which principle of OOP allows the same method name to behave differently based on the object that calls it?
Answer: Polymorphism
Polymorphism lets a single interface or method name work with different underlying data types or classes.
What is the Big O notation O(1) used to describe?
Answer: An algorithm with constant time complexity regardless of input size
O(1) means the operation takes the same amount of time no matter how large the input is.
What is the purpose of comments in source code?
Answer: To provide human-readable explanations that are ignored by the compiler
Comments are annotations in code intended for human readers; they are skipped by compilers and interpreters.