Public24 cardsby @donk

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)

  • 1
    Front

    What is a variable in programming?

    Back

    A named storage location in memory that holds a value which can be read or modified during program execution.

  • 2
    Front

    What is the difference between a statically typed and a dynamically typed language regarding variables?

    Back

    In statically typed languages, variable types are declared and checked at compile time. In dynamically typed languages, types are determined and checked at runtime.

  • 3
    Front

    Name the four primitive data types common to most programming languages.

    Back

    Integer (int), floating-point number (float/double), character (char), and boolean (bool/boolean).

  • 4
    Front

    What is the difference between an integer and a floating-point data type?

    Back

    Integers store whole numbers without a decimal point, while floating-point types store numbers with a fractional (decimal) component.

  • 5
    Front

    What is a boolean data type?

    Back

    A data type that can hold only one of two values: true or false. It is commonly used in conditional expressions.

  • 6
    Front

    What is type casting (type conversion) in programming?

    Back

    The process of converting a value from one data type to another, either implicitly by the language or explicitly by the programmer.

  • 7
    Front

    What is an if-else statement?

    Back

    A 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.

  • 8
    Front

    What is a switch (or match) statement used for?

    Back

    It 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.

  • 9
    Front

    What is the key difference between a while loop and a do-while loop?

    Back

    A 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.

  • 10
    Front

    What is a for loop and when is it typically preferred over a while loop?

    Back

    A for loop combines initialization, condition check, and increment in one line. It is preferred when the number of iterations is known in advance.

  • 11
    Front

    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.

  • 12
    Front

    What is a function (or method) in programming?

    Back

    A named, reusable block of code that performs a specific task, optionally accepts input parameters, and optionally returns a value.

  • 13
    Front

    What is the difference between a function's parameter and an argument?

    Back

    A parameter is the variable defined in the function signature. An argument is the actual value passed to the function when it is called.

  • 14
    Front

    What does it mean for a function to have a return value?

    Back

    The function computes a result and sends it back to the caller using a return statement, allowing the result to be used in further expressions.

  • 15
    Front

    What is variable scope?

    Back

    The 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.

  • 16
    Front

    What is an array?

    Back

    A fixed-size, ordered collection of elements of the same data type, stored in contiguous memory locations and accessed by a zero-based index.

  • 17
    Front

    What is the time complexity of accessing an element in an array by its index?

    Back

    O(1) — constant time, because the memory address is calculated directly from the base address and the index.

  • 18
    Front

    How does a list (dynamic array) differ from a static array?

    Back

    A 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.

  • 19
    Front

    What is recursion in programming?

    Back

    A technique where a function calls itself to solve a smaller instance of the same problem, continuing until a base case is reached.

  • 20
    Front

    What are the two essential components of a recursive function?

    Back

    A 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.

  • 21
    Front

    What happens if a recursive function has no base case?

    Back

    It results in infinite recursion, eventually causing a stack overflow error when the call stack exceeds its memory limit.

  • 22
    Front

    What does Big-O notation describe?

    Back

    Big-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.

  • 23
    Front

    Arrange these Big-O complexities from fastest to slowest: O(n²), O(1), O(n log n), O(log n), O(n).

    Back

    O(1) < O(log n) < O(n) < O(n log n) < O(n²).

  • 24
    Front

    What is O(n²) time complexity and what type of algorithm commonly produces it?

    Back

    O(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.