Assignment: #AssessmentQuestions Due: 11/20/2017 Points: 3

Assessment Questions

Create three questions that can potentially be used on the inclass final exam. It is assumed that if any of your questions are on the final, then you'll get those questions correct (a form of extra credit).

Each submitted question has the following parts:

   + the question and/or exerise
   + the answer 
   + an explanation of the answer
   + the motivation for the question
   + question difficulty rating (1 for easy to 5 for hard)
Example 0
   Question: Who was the father of Java?

   Answer: James Gosling

   Explanation: James Gosling created Java during the early 1990s 
   while he was a member of technical staff at Sun Microsystems.

   Motivation: Computing students should know the computer professionals
   who are responsible for creating our present day computing world.

   Difficulty level:  1.
Example 1
   Exercise:  Why does  i = 7, j = 11, k = 17  after the
              following two statements are executed.

   int i = 8, j = 10;
   int k = --i + j++;

   Answer/Explanation:  
   i = 8, j = 10;  i gets assigned 8 and j gets assigned 10
   k = --i + j++  order of operators  (k = ((--i) + (j++)))
   --i  decrements i from 8 to 7 and evaluates to 7
   j++  increments j from 10 to 11 and evaluates to 10
   7 + 10 evaluates to 17
   17 is assigned to k

   Motivation: The increment and decrement are frequently used 
   operators and programmers need to know how they are evaluated.

   Difficulty level:  2.
Example 2
   Exercise:  Write pseudo-Java code that instantiates a 512-element 
   array of class Object elements such that none of the elements 
   are null pointers.

   Answer:
   Object[] o = new Object[512];         // A
   for (int i = 0; i < o.length; i++) // B
      o[i] = new Object();               // C

   Explanation:
   Statement A instantiates an array to store 512
   object variables of type Object. Statement B
   loops through the array. Statement C instantiates 
   a single Object variable and assigns it to the array.

   Motivation:  To ensure an understanding of how to create
   an array of objects.

   Difficulty level:  3.