CSc 2010 Programming Challenges

Introduction

Do not turn these in early. Note that any assignments posted in advance may change.

Due January 24, 2011:
1). Definition
What is computer science? Find another definition, and say how it is similar and how it is different to the one in the book. You must choose a definition THAT HAS NOT YET BEEN CHOSEN. Use the class comment system to claim your definition's source.

Due January 31, 2011:
2). Algorithm
Write an algorithm to describe something, such as a part of your day. Include at least one conditional.

Due February 7, 2011:
3). Pseudocode
Explain how pseudocode is different from an algorithm. Give examples of each.

Due February 14, 2011:
4). Scientific comparisons 1
A scientist must often compare two similar things. Given two cars, which one is faster? More importantly, how did you arrive at this conclusion? Cite your sources. Remember that Wikipedia is not appropriate for college-level work.

Due February 21, 2011:
5). Translate steps 1-4, 6-8, 10 and 14 from Figure 3.14 (the shuffle-left algorithm) into a program, using Calq syntax. Assume that line 9 is simply "Else", and translate that as well. Use Calq for the program, and also submit a screen-shot from it that shows that your program works.

Due March 7, 2011:
6). Scientific comparisons 2
A scientist must often compare two similar things. Given two computers, which one is faster? More importantly, how did you arrive at this conclusion? Cite your sources. Remember that Wikipedia is not appropriate for college-level work.

Due March 14, 2011:
7). Boolean expressions
Implement solutions to the practice problems on page 159 (3rd ed), using Calq. Note that Calq uses && in place of AND, || in place of OR, and ~ in place of NOT. Use parentheses instead of square brackets, since these have a different meaning in Calq. Also, in Calq, the single equals sign is used for assignment, while the double equals sign is used to compare values (as in this assignment). Copy and paste the input and output, showing that these work.

Due March 21, 2011:
8). Generating a truth table
Use Calq to write a small program to produce a truth table for the function:

    f = (a OR b) AND (not (a OR b))

Try the following code to get an idea about how to print values:

  a = 1;
  b = 2;
  c = 3;
  disp(a + ' plus ' + b + ' is ' + c)

Due March 28:
9). Assembly language
Simulate a simple disassembler. Given the sequence of integers [10, 10, 45, 24, 89, 22, 21, 10, 16], assume that these are to be decoded with a sub-set of an instruction set. 10 is the opcode for load register A with the data value that follows (where the value specifies the data, not a memory location), 12 means load register A's value from the memory location given in the next value, 22 means store register A's value in the following memory location, 24 means add the following value to register A, 45 means increment register A, and 46 means decrement register A. For example, 12 13 would be interpreted as: get the value from memory location 13, and store it in register A. Decoding it results in: LOAD A, [13] ; Load memory(13) into register A.

Due April 4:
10). Assembly language 2
Suppose that we have the following program. Using the same opcodes as in the previous question, translate this program to a list of numbers. Make sure to explain how you arrive at your answers.

  LOAD A, [4A] ; Load memory(4A) into register A
  INC A         ; Increment register A
  STORE [4A], A ; Store register A into memory(4A)
  ADD A, 3       ; register A = register A + 3
  STORE [4B], A ; Store register A into memory(4B)
  DEC A         ; Decrement register A

Due April 11:
11). Networking
Find an example of a negative consequence of using social networking (MySpace, FaceBook, Twitter, etc). Describe the story in your own words, and be sure to cite at least one source. What, in your opinion, should be done, i.e. to prevent a situation like the one that you describe?

Due April 18:
12). Java
Translate the following Calq program into Java.
  a = 6.99; % An amount in dollars
  b = a * 1.32; % assuming conversion rate of 1.32
  disp(a + ' Dollars is about ' + b + ' Euros');
Show that it runs.

Due April 25:
13). TBA