focp

Cards (23)

  • Intended Learning Outcomes (ILO) include:
    • Outline the basic structures in programming
    • Define data types for computer program
    • Determine the properties of algorithm and devise an algorithm to solve any real-world problem
    • Utilize the functions to breaking down the tasks to solve problem
    • Explain the usage of array data structure
    • Develop programs using the high-level languages
  • CPU (Central Processing Unit) consists of Control Unit (CU) and Arithmetic Logic Unit (ALU)
  • Fetch/Decode/Execute process:
    • Fetch: CPU's control unit fetches the next instructions from main memory
    • Decode: Control unit decodes the instructions
    • Execute: Signal is routed to the appropriate component for operations
  • A computer program contains step by step instructions to perform a specific task
  • Programming languages include Machine Language, Assembly Language, and High-Level Language
  • Machine Language:
    • Consists of machine language instructions
    • Binary language understood by computers using 1s and 0s
  • Assembly Language (Low-Level Language):
    • Uses mnemonic and symbols
    • Requires conversion to machine language for computer understanding
  • High-Level Language:
    • Closer to human languages and further from machine languages
    • Easier to read, write, and maintain
    • Programs must be translated into machine language by a compiler or interpreter
    • Examples: C, C++, Java, Python, COBOL, BASIC
  • Compiler Vs Interpreter:
    • Interpreter translates program one statement at a time
    • Compiler scans the entire program and translates it as a whole into machine code
    • Interpreters are faster to analyze source code but slower in execution
    • Compilers take more time to analyze source code but have faster execution
    • Interpreters do not generate object code, hence memory efficient
    • Compilers generate object code which requires more memory
    • Examples: JavaScript, Python, Ruby (interpreters); C, C++, Java (compilers)
  • All computer programs, no matter how simple or complex, are written using one or more of 3 basic structures:
    • Sequence
    • Selection
    • Repetition
  • Sequence Structure:
    • Involves following step-by-step instructions from beginning to end
    • Algorithms provide step-by-step instructions for accomplishing a task
    • Directs the computer to process program instructions one after another in the order listed
    • Found in every program
  • Selection/Decision Structure:
    • Based on conditions that indicate a decision needs to be made, followed by an appropriate action
    • Conditions specify the decision to be made, resulting in either true or false
    • Instructions indented in the true and false paths
  • Repetition Structure:
    • Indicates one or more instructions need to be repeated until a certain condition is met
    • Uses loops or iterations
  • Control / Logic Structure includes: Sequence Structure, Selection Structure, Repetition Structure
  • Solving Everyday Problems:
    • Identify important components
    • Goal of solving a problem
    • Plans an algorithm
  • Creating Computer Solutions to Problems:
    1. Analyze the problem
    2. Plan the algorithm
    3. Desk-Check the algorithm
    4. Code the Algorithms into a program
    5. Desk-Check the program
    6. Evaluate & Modify the program
  • Step 01- Analyze the problem:
    • Understand the problem
    • Important components: Input of the Problems, Output of the problems
    • Decide the Input and Output for the computer
  • Hint for Analyzing Problems:
    • Example of James wanting a program to calculate and display the cost of a 4K Ultra HD TV
  • Exercise:
    1. Alycia Thompkins wants a program to display her raise and new salary amounts
    2. Professor Carlos wants a program to display the average of two test scores
    3. Manager of a local restaurant wants a program to display suggested tip amounts
    4. James Monet saving $2 per day, calculate his savings in one year
  • Step 2-Plan the Algorithms:
    • Transform input into output
    • Instructions start with a verb
    • Begin with entering input items
    • Record instructions to process input items
    • End with displaying, printing, or storing output items
  • Pseudocode:
    • Short English statements used in planning algorithms
    • Not understood by the computer
    • Helps programmers in planning
  • Flowchart:
    • Uses standardized symbols to visually depict algorithms
    • Contains symbols for Start, Stop, Input/Output, Process
  • Step 3-Desk-Check the Algorithms:
    • Review algorithm at the desk
    • Hand-tracing with pen, pencil & paper
    • Verify instructions and order
    • Choose sample data for input values and compute expected outputs