Leveling exercise

Please do each of the following small assignments in class today.

  • You will have 30 minutes in class
  • The objective is a baseline assessment of preparation for this class and whether you meet the pre-requisite
  • It will not be part of your grade but it could
  • This will be the only work you do on paper!
NOTE You can use any programming language or do it in pseudo code. Get as far as you can. Partial work will get credit.

Web Servers

True/false: Answer the following questions true or false. If you feel ambivalent then clarify.

  • Any computer can be a client or a server
  • A computer can be a client or a server but not both at the same time
  • To access a web server you must know it’s domain name
  • JavaScript is a general purpose programming language
  • Authorization often involves enterering a user’s name and password
  • A web server responds to requests by returning some kind of HTML

Web Server: Give a simple technical explanation of a web server:



Browsers: Which of these are always involved when you enter a URL into a browser?

  1. HTTP
  2. Javascript
  3. Swift
  4. HTML
  5. CSS

3 line programming problem

  • You may do this in any language you like, including pseudo code
  • Write a short program that prints out all the even numbers between 20 and 100

Basic shell commands

What are the shell commands to do the following activities:

  1. list all the files in the current directory
  2. change to a different directory
  3. delete a file
  4. delete a directory and its contents

What do the following shell commands do?

  1. cp my_file.rb your_file.rb
  2. cd ..
  3. mv /mydev/freetime/home.rb /mydev/sample/home.rb

Simple Class Design

  • We want to represent a simple graphical world of simple two dimensional shapes
  • Shapes are:
    • Points, that have an x and y coordinate
    • Rectangles, defined by a point at top-left and a point at bottom-right
    • Circles, defined by a center point and a radius
  • Scenes, defined by including zero or more shapes

  • Define a class structure for each of those. You may use inheritence if you want.
  • The scene class should include methods as follows:
    • constructor
    • add shape
    • delete shape
    • count shapes
  • Write a main program that
    • Creates a scene with 2 rectangles and a circle
    • Adds an additional rectangle to the scene
    • Deletes the circle from the scene
    • Prints out a report showing how many shapes of each kind exist in the scene