← All Mettl Flashcard Decks

Fundamental Coding Skills Flashcards

7 cards from real Mettl practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.

Read the first 7 Fundamental Coding Skills flashcards as text
  1. What is the output of: `print(2 ** 3)` in Python?

    Answer: 8

    The `**` operator in Python is the exponentiation operator, so `2 ** 3` equals 2³ = 8.

  2. Which of the following is a valid way to comment out a single line in Python?

    Answer: # This is a comment

    Python uses the `#` character to start a single-line comment; everything after `#` on that line is ignored.

  3. What is a stack overflow error typically caused by?

    Answer: Unbounded recursion filling the call stack

    A stack overflow occurs when recursive function calls accumulate without hitting a base case, exhausting the call stack's memory.

  4. Which of the following best describes a 'variable scope'?

    Answer: The region of code where a variable can be accessed

    Scope defines the region of the program where a variable is visible and can be referenced.

  5. What does DRY stand for in software development?

    Answer: Don't Repeat Yourself

    DRY (Don't Repeat Yourself) is a principle that encourages reducing code duplication by abstracting repeated logic.

  6. In a for loop `for (int i = 0; i < 5; i++)`, how many times does the loop body execute?

    Answer: 5

    The loop runs for i = 0, 1, 2, 3, 4 (stopping when i reaches 5), so the body executes exactly 5 times.

  7. What is the primary purpose of version control systems like Git?

    Answer: To track changes to code over time and enable collaboration

    Version control systems track the history of code changes, allow branching, and enable multiple developers to collaborate safely.