Project-Oriented Computer Science Diagnostic Quiz

Fall 2006
Herbert J. Bernstein ( )

POCS Diagnostic Quiz
Fall 2006

 


This web page is http://www.bernstein-plus-sons.com/.dowling/POCSF06/CS_Diagnostic_Quiz.html
Copyright © 2002 -- 2006 Herbert J. Bernstein and other parties. All rights reserved.


This is a project-oriented computer science diagnostic quiz to be taken on the first day of class. This exam is to help you and your instructor see if you are adequately prepared (or perhaps more than adequately prepared) to take the course for which you have registered. Please do the best that you can on this quiz, but the results will not have any impact on your grade for the course. If you find yourself unable to do most or all of these questions, you should discuss this with the instructor immediately. Unless your problems are likely to respond to intensive tutoring, you may wish to consider taking some other course this semester and taking this course when you have a more solid background. However, do not be concerned if you can do most of the problems but cannot do all of the problems.

This exam must be the results of your own efforts.

You may do this exam on paper or on-line. The ONLY use you may make of a computer in doing this quiz on-line is to open one browser window to bring you to the online version of the quiz. You may not use a calculator and you may not search for the answers on the web

To avoid disturbing other students, you must remain seated until the end of the examination period.

  <==== Do this AFTER you've answered all the questions

You probably DON'T want to do this ===>  

Please fill in the following information:

Name:


Email:

Computer skills:
Please list the computer languages (C, C++, Java, VB, ... ) and computer systems (MS Windows, Linux, ...) with which you are familiar.

Please answer as many of the following questions as possible on this form (or on a paper copy of this form).

  1. You need to write a large, complex program by yourself that must work absolutely correctly by a certain date. There is no existing template to follow. You need to pull this together from scratch. Describe the steps you would take to help improve that chances of completing this assignment on time, correctly.

  2. You need to revise an existing program written by somebody else. There is no documentation and there are no comments in the code. Describe the steps you would take to help yourself deal with this problem.

  3. You have a program that you wrote and which you thought was working correctly. Someone has reported a bug. Explain the techniques you would use to isolate and remove the bug.

  4. You have just been hired by a new company and told to work with a group of people you have never met before on an important programming project. They don't know you. You don't know them. None of you know anything about the project other that a vague description: Update the payroll system to conform to the latest revisions in the tax laws. Nobody in the group has been designated as the leader, but you all will be fired if the job is not done properly and on time. You do not wish to be fired. You do not wish to look for another job. What steps would you take to get started on the assigned task?

  5. Take the previous question and assume that you have been brought in as the new boss of the group instead of as just a team member. What would you do differently?

  6. Rewrite the following fragment of code as an equivalent while loop:
    j = 5;
    for ( i = 4; i > 0; i--) {
    j *= i;
    }
    
    Assuming appropriate declarations, after execution of the code fragment in question 6, what will be the final value of j?

  7. Write a program in any language you know that will output the phrase "Hello World".

  8. Briefly explain the relationship between the terms "class" and "object".

  9. Write a java method (or C function) that returns the running integer average of an arbitrary number of integer values accepted from the input stream. As each number is accepted report the average of all the numbers accepted up that that point. The program must be able to handle an arbitrary number of input values without any prior knowledge of how many will have to be handled. If you don't know java or C, but know some other computer language, identify the language and solve the problem in that language.

  10. Write a java method (or C function) that accepts a list of names given one name per line, in the form of first name, middle initial, last name, dynastic indicator, as in Edgar F. Meyer Jr., but which can accept names that do not have a middle initial and/or names that do not have a dynastic indicator. The program is to take the names, convert then to the form last name, comma, first name, middle initial, dynastic indicator and then sorts the list into alphabetic order.

  11. For each of the following problems you will be combining fractions by addition, subtraction, multiplication, or division. Your answer must be a fraction reduced to lowest terms. Fill in the answers after the equals sign.
    Addition Subtraction Mutiplication Division  
                     
    1 7 1 7 1 7 1 7
    -- + -- =   -------- -- - -- =   -------- -- * -- =   -------- -- / -- =   --------
    2 16 2 16 2 16 2 16
           
    3 5 3 5 3 5 3 5
    -- +-- = -------- -- --- = -------- -- *-- = -------- -- /-- = --------
    5 3 5 3 5 3 5 3
           
    9 15 9 15 9 15 9 15
    -- +-- = -------- -- --- = -------- -- *-- = -------- -- /-- = --------
    11 17 11 17 11 17 11 17
           
    11 27 11 27 11 27 11 27
    -- +-- = -------- -- --- = -------- -- *-- = -------- -- /-- = --------
    33 47 33 47 33 47 33 47
           

  12. Perform the indicated arithmetic operations. Give the answer as an integer or as a fraction with the smallest possible denominator. Do not give your answer as a decimal fraction. Write each answer on a single line in the indicated box.

    • 4832197 + 6597875 =
    • 368 - 427 =
    • 468 * 827 =
    • 865 / 35 =
    • (43/87) + (29/137) =
    • (11/12) - (23/24) =
    • (19/21) * (7/8) =
    • (11/13) / (18/19) =

  13. Perform the indicated set operations. Give the resulting set for the following operations. Assume all sets are drawn from the universe of non-negative integers. Write your answer after the equals sign.

    • { 1, 3, 5, 7 } ∪ { 2, 4, 6, 8 } = { }
    • { 1, 3, 5, 7 } ∩ { 2, 4, 6, 8 } = { }
    • { 1, 3, 5, 7 } ∩ ¬ { 2, 4, 6, 8 } = { }

  14. The straight-line distance from city A to city B is 318 miles. The straight-line distance from city B to city C is 165 miles. What are the smallest and the largest possible values of the straight-line distance from city A to city C.

    Smallest:
    Largest:

  15. What is the sum of all the natural numbers from 17 to 1005?

  16. What is the sum of all the powers of 2 from 4 to 256?

  17. Consider the following code fragment. What will be the value of m at the end?

    int n,m;
    n = 3;
    m = 5;
    switch(n){
      case 1: m = 7;
              break;
      case 2: m = 8;
              break;
      case 3: m = 9;
      case 4: m = 10;
              break;
      default: m = 11;
    }
    

  18. Explain the meaning of a pointer.

  19. Explain the meaning of a cast.

  20. Explain the meaning of an array.

  21. Explain the meaning of a formal parameter.

  22.   <==== Do this AFTER you've answered all the questions

    You probably DON'T want to do this ===>  

    Revised 4 Sep 2006