GithubHelp home page GithubHelp logo

js-midterm's Introduction

Instructions:

  • Add your answers inline to the markdown file.
  • Use your own words.
  • Come up with an answer from memory. Write it down, even if the answer is "I don't know."
  • Then, we will go over the answers in class. Write down your revised answer below your original answer.

Part 1: Control Flow - 15 minutes

  1. Draw a diagram of an if statement. Name each of the components and how they work together.

  2. Draw a diagram of a for loop. Describe each of its components. Indicate the order in which they are executed / evaluated.

  3. Functions

  • 3a. Draw a diagram of a function. Describe each of its components and what each component does. Specify which of them are optional.
  • 3b. Draw a diagram of a function being called, showing the instruction execution order.

Part 2: Data Types - 10 minutes

  1. Primitive Data Types
  • 4a. Give an example of an empty string and a non-empty string.
  • 4b. Give an example of a boolean.
  • 4c. Give an example of a Number.
  1. Arrays
  • 5a. Give an example of an empty array.
  • 5b. Give an example of an array with three elements in it.
  • 5c. How do you add another element to this array?
  • 5d. How do you get the length of this array?
  • 5e. Show how to iterate through the array using a loop.
  1. Objects
  • 6e. Give an example of an empty object.
  • 6b. Give an example of an object with three keys and three values.
  • 6c. Give an example of an object with two keys and two functions as values.
  • 6d. Describe one way of adding a key to an object.
  • 6e. Describe the other way of adding a key to an object.
  • 6f. Explain the difference between these two ways, and when it is appropriate to use each way.
  • 6g. Describe how to iterate though an object using a loop.

Part 3: Algorithms - 20 minutes

  1. What is an algorithm?

  2. For the following problem, first write down how exactly to solve the problem in English. Once you are able to describe it in English, translate it into code.

// Given an array of values, write a function that finds the index of where the value is located, and if nothing is found, returns -1.
// Do not use the indexOf function.
// example: for ['apple', 'orange', 'pineapple']
	// 'orange' returns '1'
	// 'durian' returns '-1'
  1. Again, for the following problem, first write down how exactly to solve the problem in English. Once you are able to describe it in English, translate it into code.
// Write a function that finds all the indexes of where the value is located and returns them in an array, and if nothing is found, returns -1
// example: ['apple', 'orange', 'orange', 'pineapple']
	// 'orange' returns [1,2]

js-midterm's People

Contributors

izelnakri avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.