Skip to main content
Engineering LibreTexts

9.3: Problems

  • Page ID
    76138
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    1. Comment on the following: “If a program produces a correct result, it is obviously correct”. What does it mean to have a correct program?
    2. Present you understanding of the term erroneous. Do you think it should be applied to programs?
    3. Implement a multiply function using only addition and recursion.
    4. Implement a program to reverse the digits in an integer number. For example, for the number 5271, change the integer value to 1725.
    5. Implement a recursive program that takes in a number and finds the square of that number through addition. For example if the number \(3\) is entered, you would add \(3+3+3=9\). If \(4\) is entered you would add \(4+4+4+4=16\). This program must be implemented using recursion to add the numbers together.
    6. Write a recursive program to calculate Fibonacci numbers. Use the definition of a Fibonacci number where \(F(n) = F(n-1) + F(n-2), F(0) = F(1) = 0\).
    7. Write a recursive program to calculate factorial numbers. Use the definition of factorial as \(F(n) = n * F(n-1)\).
    8. Combinations, Permutations

    In this chapter you will learn (Chapter 10):

    1. The definition of an array, and how to implement and access array elements using index.
    2. What is heap memory, how to allocate it, and how to use it.
    3. Null terminated arrays, and array processing using element pointers
    4. How to allocate an array in stack memory, on the program stack, or in heap memory, and why arrays are most commonly allocated on heap memory.
    5. How to use array addresses to access and print elements in an array.
    6. Call by Value, Call by Reference, and Call by Reference Value (or Reference Type)
    7. An algorithm to reverse an array, and how to it in ARM assembly.

    This page titled 9.3: Problems is shared under a CC BY 4.0 license and was authored, remixed, and/or curated by Charles W. Kann III via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.

    • Was this article helpful?