From hw

Cards (32)

  • What is embedded code in HTML?
    Code directly on a HTML page
  • What is an example of embedded JavaScript code?
    <Scripts> Alert("hello world"); </script>
  • What are all subroutines in JavaScript called?
    Functions
  • What does the function say_hello do?
    It alerts "hello world"
  • How is an event detected in JavaScript?
    Using a function with an HTML element
  • What is the syntax to define a variable in JavaScript?
    Var age = 17;
  • What is the syntax for a for loop in JavaScript?
    For (var i = 0; i < 5; i++)
  • How do you define an array in JavaScript?
    Var colours = ["red", "orange", "yellow"];
  • How do you add a color to an array in JavaScript?
    Using colours.push("green");
  • What does the function multiply do?
    It returns the product of two numbers
  • What is the syntax for an alert box in JavaScript?
    <script> Alert("hello") </script>
  • How can you output a result directly onto a web page?
    Using document.write(result);
  • How do you use tags to mark-up content in JavaScript?
    By using document.write("<h1>", result, "</h1>");
  • How do you change the value of an HTML element in JavaScript?
    Using document.getElementById("example");
  • What does the chosen_element variable represent?
    A reference to the HTML element with ID "example"
  • What are the main components of a JavaScript function?
    • Function keyword
    • Function name
    • Parameters (optional)
    • Function body
    • Return statement (optional)
  • What are the differences between a for loop and a while loop in JavaScript?
    For Loop:
    • Executes a block of code a specific number of times
    • Initialization, condition, and increment in one line

    While Loop:
    • Executes a block of code as long as a condition is true
    • Initialization is separate from the loop condition
  • Operating systems allow the user to communicate with the computer and perform low level tasks
  • operating systems provide the following features
    1. memory management
    2. resource management
    3. file management
    4. input / output management
    5. interrupt management
    6. utility software
    7. security
    8. user interface
  • memory management is done by the processes:
    1. paging
    2. segmentation
    3. use of virtual memory
  • paging is when memory is split up into equal sized sections called pages,
    pages can be swapped between main memory and the hard disk as and when needed.
  • segmentation is splitting up memory into logical sized divisions, known as segments
    so this splits it up based on logical flow and structure os the program
  • virtual memory used a section of the hard drive to act as RAM ,this is where the programs go that are not in use and are moved her by paging freeing up space
  • what are issues of paging , segmentation and virtual memory?
    disk thrasing
  • disk thrashing is when the computer freezes as the packets are being swapped too much between hard disk and main memory.
  • interupts are signals generated by software or hardware to indicate to the processor that a process needs attention
    interrupts are stored in order of priority within a priority queue in the interrupt register.
  • Abstraction is removing unnecessary information making it simple and easy for anyone to use
  • Pros of abstraction:
    • Reduces development time
    • Simplifies problems
  • selection/branching
    makes the program run blocks of code based on a condition
  • bubble sort:
    • Not efficient for large data sets
    • Repetitive
    • Merge is more efficient for 250,000 bits of data in data base
  • queue follows the FIFO pro pile and is for scheduling
  • Stacks use the LIFO principle and act like an undo feature