Free Practice Quiz Question List

9 Fundamental Programming Techniques Online Quiz Questions

Use this free practice quiz with 20 questions to review 9 Fundamental Programming Techniques, test your knowledge, and prepare for your next test or exam.

20 questions
01
Choose one
1 point

Which statement correctly describes filtering in a data-processing program?

  1. A

    Transformation changes the number of items by removing failures.

  2. B

    Filtering retains items that satisfy a condition.

  3. C

    Reduction converts each item into a corresponding output item.

  4. D

    Decomposition means repeatedly concatenating strings.

02
Choose one
1 point

A program must read exam scores, validate them, calculate an average, find the highest score, and display a report. Which design best applies decomposition?

  1. A

    Putting all operations in one function to avoid function calls

  2. B

    Repeating the same calculation in several places

  3. C

    Dividing the problem into smaller tasks with clear purposes

  4. D

    Replacing every loop with a list comprehension

03
True or false
1 point

True or false: When a loop accumulates a sum, the accumulator should normally be initialized to 0.

  1. A

    True

  2. B

    False

04
Choose one
1 point

A function must return the first even number in a sequence. Which implementation strategy is most appropriate?

  1. A

    Inspect every item and return the last matching item

  2. B

    Return immediately when the first matching item is found

  3. C

    Sort the sequence before checking for a match

  4. D

    Return -1 whenever a matching item is found

05
Written response
1 point

What naming convention should normally be used for Python function and variable names, such as the name passing_scores?

06
Fill in the blank
1 point

Complete the statements about an index search: Use when both the position and value are needed; a conventional return value for an absent index is .

07
Choose all
1 point

Select all the categories of test cases that a well-designed Python test suite should consider.

  1. A

    Typical cases

  2. B

    Boundary cases

  3. C

    Invalid cases

  4. D

    Special cases

  5. E

    Only cases with positive integers

08
Written response
1 point

The function total_passing_scores processes the values ["72", "58", "invalid", 91, None] with minimum=60. What total does it return?

09
Fill in the blank
1 point

Complete this debugging plan: Use to inspect each position and value, then form one about the cause before changing the code.

10
Choose one
1 point

Which design best makes a function for counting passing scores reusable and easy to test?

  1. A

    A function accepts scores and returns the count, while separate code handles input and printing

  2. B

    A function reads input, performs every operation, and prints the result internally

  3. C

    A function prints intermediate values instead of returning a result

  4. D

    A function stores all input and output in global variables

11
Choose all
1 point

Select all the practices that improve the clarity and maintainability of Python code.

  1. A

    Use descriptive names such as passing_scores

  2. B

    Prefer early returns when they avoid deep nesting

  3. C

    Use except Exception: pass to hide unexpected failures

  4. D

    Write comments that explain intent or non-obvious decisions

12
True or false
1 point

True or false: Using except Exception: pass is generally a poor debugging practice because it can hide unexpected errors.

  1. A

    True

  2. B

    False

13
Open ended
1 point

Explain how decomposition can improve a Python program that analyzes exam scores. Include at least three focused stages and explain two benefits of using separate functions or stages.

14
Choose one
1 point

After reproducing a defect and reading its traceback, which next action best supports systematic debugging?

  1. A

    Add more unrelated features until the failure disappears

  2. B

    Change several parts of the program at once

  3. C

    Reduce the problem to the smallest example that still fails

  4. D

    Suppress the traceback and continue

15
True or false
1 point

True or false: Tests should be independent so that one test's result does not depend on the order in which unrelated tests run.

  1. A

    True

  2. B

    False

16
Choose one
1 point

A program converts every name in ['ada', 'grace', 'margaret'] to title case and keeps the same number of items. Which programming technique is being applied?

  1. A

    Filtering

  2. B

    Transformation

  3. C

    Reduction

  4. D

    Decomposition

17
Choose one
1 point

You are writing a loop to sum the values in a list. Which initial accumulator value is appropriate before the first iteration?

  1. A

    -1

  2. B

    1

  3. C

    0

  4. D

    The first value in the list

18
Choose one
1 point

A function must return the first even number in a sequence and should avoid unnecessary work after finding it. Which implementation approach best matches this requirement?

  1. A

    Sort the list before checking it

  2. B

    Use a loop with an early return

  3. C

    Use a list comprehension that checks every item

  4. D

    Return the final item after the loop

19
Written response
1 point

What programming technique divides a large problem into smaller tasks, each with a clear purpose?

20
Written response
1 point

Which Python built-in should you use when searching through a sequence and needing both each item's position and its value?