
Introduction to Programming Concepts
Variables, data types, control flow (conditionals and loops), functions, arrays and lists, basic recursion, and an introductory look at Big-O notation.
Cards (24)
- 1Front
What is a variable in programming?
BackA named storage location in memory that holds a value which can be read or modified during program execution.
- 2Front
What is the difference between a statically typed and a dynamically typed language regarding variables?
BackIn statically typed languages, variable types are declared and checked at compile time. In dynamically typed languages, types are determined and checked at runtime.
- 3Front
Name the four primitive data types common to most programming languages.
BackInteger (int), floating-point number (float/double), character (char), and boolean (bool/boolean).
- 4Front
What is the difference between an integer and a floating-point data type?
BackIntegers store whole numbers without a decimal point, while floating-point types store numbers with a fractional (decimal) component.
- 5Front
What is a boolean data type?
BackA data type that can hold only one of two values: true or false. It is commonly used in conditional expressions.
- 6Front
What is type casting (type conversion) in programming?
BackThe process of converting a value from one data type to another, either implicitly by the language or explicitly by the programmer.
- 7Front
What is an if-else statement?
BackA conditional control flow structure that executes one block of code if a condition is true and an optional alternative block if the condition is false.
- 8Front
What is a switch (or match) statement used for?
BackIt selects one of several code blocks to execute based on the value of a single expression, serving as a cleaner alternative to multiple if-else-if chains.
- 9Front
What is the key difference between a while loop and a do-while loop?
BackA while loop checks its condition before executing the body, so it may run zero times. A do-while loop executes the body at least once before checking the condition.
- 10Front
What is a for loop and when is it typically preferred over a while loop?
BackA for loop combines initialization, condition check, and increment in one line. It is preferred when the number of iterations is known in advance.
- 11Front
What do the keywords 'break' and 'continue' do inside a loop?
Back'break' immediately exits the loop entirely. 'continue' skips the rest of the current iteration and jumps to the next iteration.
- 12Front
What is a function (or method) in programming?
BackA named, reusable block of code that performs a specific task, optionally accepts input parameters, and optionally returns a value.
- 13Front
What is the difference between a function's parameter and an argument?
BackA parameter is the variable defined in the function signature. An argument is the actual value passed to the function when it is called.
- 14Front
What does it mean for a function to have a return value?
BackThe function computes a result and sends it back to the caller using a return statement, allowing the result to be used in further expressions.
- 15Front
What is variable scope?
BackThe region of code in which a variable is accessible. A local variable is accessible only within the block or function where it is declared; a global variable is accessible throughout the program.
- 16Front
What is an array?
BackA fixed-size, ordered collection of elements of the same data type, stored in contiguous memory locations and accessed by a zero-based index.
- 17Front
What is the time complexity of accessing an element in an array by its index?
BackO(1) — constant time, because the memory address is calculated directly from the base address and the index.
- 18Front
How does a list (dynamic array) differ from a static array?
BackA list can grow or shrink in size at runtime, automatically resizing its underlying storage, whereas a static array has a fixed size set at declaration.
- 19Front
What is recursion in programming?
BackA technique where a function calls itself to solve a smaller instance of the same problem, continuing until a base case is reached.
- 20Front
What are the two essential components of a recursive function?
BackA base case, which stops the recursion by returning a result directly, and a recursive case, which calls the function with a smaller or simpler input.
- 21Front
What happens if a recursive function has no base case?
BackIt results in infinite recursion, eventually causing a stack overflow error when the call stack exceeds its memory limit.
- 22Front
What does Big-O notation describe?
BackBig-O notation describes the upper bound of an algorithm's time or space complexity in terms of input size n, characterizing its worst-case growth rate.
- 23Front
Arrange these Big-O complexities from fastest to slowest: O(n²), O(1), O(n log n), O(log n), O(n).
BackO(1) < O(log n) < O(n) < O(n log n) < O(n²).
- 24Front
What is O(n²) time complexity and what type of algorithm commonly produces it?
BackO(n²) means the runtime grows proportionally to the square of the input size. Nested loops iterating over the same collection (e.g., bubble sort) commonly produce this complexity.
Study this deck free
Create a free account to flip through these flashcards, quiz yourself, play match, and track what you've mastered — or fork the deck to make it your own.