Preview

Homework Week 2

Satisfactory Essays
Open Document
Open Document
743 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Homework Week 2
COMP122
Week 1 Homework

Part 1: Complete the following problems.

1. What is machine code? Why is it preferable to write programs in a high level language such as C++?
Machine code it the language that the computer understands. High level languages are better because they are easier to understand and work with.
2. What does a compiler do? What kinds of errors are reported by a compiler?
A compiler translates one computer language into another. It also pics up errors in the program being put together.
3. What does the linker do?
A linker takes multiple object files, and turns them into an executable program
4. What is an algorithm?
The list of instructions to complete a task on a program
5. Bob enters a pizza shop and notices there are three different sizes of pizzas available. Sizes are given as the diameter of the pizza in inches. The cost of a pizza is based on the size. Bob would like to know which size of pizza has the lowest cost per square inch.

a. Identify the inputs and outputs for this problem.
The inputs are the diameters and cost of each of the three different sizes, and utputs are the size of pizza with the lowest cost per inch b. Identify the processing needed to convert the inputs to the outputs.
Area of each pizza in square inches = pi * (diameter / 2)^2
Cost per square inch = cost / area

c. Design an algorithm in pseudocode to solve this problem. Make sure to include steps to get each input and generate each output.
1. Find the diameter of the first size pizza
2. Find the area of the first pizza
3. Find the cost per square inch of the first pizza
4. Find the diameter of the second size pizza
5. Find the area of the second pizza
6. Find the cost per square inch of the second pizza
7. Find the diameter of the third pizza
8. Find the cost of the third pizza
9. Find the cost per square inch of the third pizza
10. Pic the pizza with the best value

Part 2: Complete the following problems.

1. Given the

You May Also Find These Documents Helpful

  • Satisfactory Essays

    The second category of fault changes individual instructions in the text segment. These faults are intended to approximate the assembly-level manifestation of real C-level programming…

    • 285 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Cs Programming Chapter 1

    • 2450 Words
    • 10 Pages

    ____ errors are relatively easy to locate and correct because the compiler or interpreter you use highlights every error.…

    • 2450 Words
    • 10 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Copyright © 2012 Pearson Education, Inc. 0-5 Terminology • Machine instruction: An instruction (or command) encoded as a bit pattern d) d d tt recognizable by the CPU • Machine language: The set of all instructions recognized by a machine Copyright © 2012 Pearson Education, Inc. 0-6 3 Machine Language Philosophies • Reduced Instruction Set Computing (RISC) – Few, simple, efficient, and fast instructions – Examples: PowerPC from Apple/IBM/Motorola and ARM • Complex Instruction Set Computing (CISC) –…

    • 783 Words
    • 4 Pages
    Satisfactory Essays
  • Better Essays

    Compilation: programs are translated into machine code which can directly execute on the computer. Compiler analyzes the whole code and generates the machine code which makes it very fast process. And due to this, compiled programs don’t require any second application or package to run it. The time takes to create a program from compilation is relatively faster than interpretation. As a disadvantage, compilation process is hardware specific into which machine it get compiled. Architecture of the computer affects…

    • 1672 Words
    • 7 Pages
    Better Essays
  • Satisfactory Essays

    Verbal Problem Solving

    • 652 Words
    • 3 Pages

    Verbal and problem solving There are two steps to solving math word problems: 1. Translate the wording into a numeric equation that combines smaller "expressions" 2. Solve the equation! Suggestions:…

    • 652 Words
    • 3 Pages
    Satisfactory Essays
  • Powerful Essays

    Today's computer programmer has many languages to choose from, but what's the difference between them? What are these languages used for? How can we categorize them in useful ways?…

    • 1471 Words
    • 6 Pages
    Powerful Essays
  • Powerful Essays

    A compiler is a computer program (or set of programs) that transforms source code written in a programming language (the source language) into another computer language (the target language, often having a binary form known as object code). The most common reason for wanting to transform source code is to create an executable program.…

    • 3794 Words
    • 16 Pages
    Powerful Essays
  • Good Essays

    Compiler Phases

    • 306 Words
    • 2 Pages

    The compiler has a number of phases plus symbol table manager and an error handler.…

    • 306 Words
    • 2 Pages
    Good Essays
  • Better Essays

    The first step creates the program; the second translates it into a language more suitable for machine execution (and puts the result in a file namedMyProgram.class); the third actually runs the program.…

    • 1755 Words
    • 8 Pages
    Better Essays
  • Good Essays

    Writing a computer is tedious and time consuming task. There are some specialized tools for helping in implementation of various phases of compilers. These tools are called compiler construction tools. These tools are also called compiler-compiler, compiler-generator, or translator writing system.…

    • 2111 Words
    • 6 Pages
    Good Essays
  • Good Essays

    Mobile Cloning

    • 4981 Words
    • 20 Pages

    compilers are used to generate software that can run on computers with a new architecture or on specialpurpose devices that cannot host their own compilers.…

    • 4981 Words
    • 20 Pages
    Good Essays
  • Good Essays

    Compiler Construction

    • 376 Words
    • 3 Pages

    Compiler-a program that translates an executable program in one language into an executable program in another language…

    • 376 Words
    • 3 Pages
    Good Essays
  • Good Essays

    compilation, written in a language, goes to compiler, produces the program into machine code, creates a compiled version.…

    • 291 Words
    • 2 Pages
    Good Essays
  • Satisfactory Essays

    research methodology

    • 415 Words
    • 2 Pages

    16. Explain the following: (i) Absolute Cell Referencing (Ii) Formula (iii) function (iv) Active Cell (v) Relative Cell Referencing.…

    • 415 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    Computer programmers write programs. After computer software engineers and systems analysts design software programs, the programmer converts that design into a logical series of instructions that the computer can follow. The programmer codes these instructions in any of a number of programming languages, depending on the need. The most common languages are C++ and Python.…

    • 2605 Words
    • 11 Pages
    Powerful Essays