Preview

2012 Summer Final

Good Essays
Open Document
Open Document
859 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
2012 Summer Final
NAME:

NUMBER:

CSE 1020 3.0 Introduction to Computer Science I
Final Exam, Summer 2012
90 Minutes

Name:
Student Number:
CSE email:

Note: Complete all questions in the space provided. Do not separate pages. Ensure your name and student number are on all pages. This is a closed-book test. No external aids are permitted.

DO NOT OPEN THE BOOKLET UNTIL INSTRUCTED TO DO SO

1/8

NAME:

NUMBER:

Consider the following Java program fragment
String s = “radar”; boolean result = true; for(int i=0;i<s.length()/2;i++) { result = result && (s.charAt(i) == s.charAt(s.legnth()-i-1);
System.out.printf(“i %d result %b%n”, i, result);
}
1. [2 marks] What does the Java program fragment shown above output?

2. [2 marks] Suppose that the fragment was run with different strings ‘s’ (replacing the initial string “radar” above). Complete the following table showing the number of character comparisons required when the program is run

!
!
!
!
!
!

String s!
!
!
“radar”
“raddar”
“blueeulb”
“madamiamadam”

Number of character comparisons

3. [2 marks] What is the big-Oh running time of the program fragment. For full marks you must provide a rationale for your answer.

2/8

NAME:

NUMBER:

4. [4 marks] Draw the UML diagram that describes the classes and relationships between the classes Colour, Shape, Blue and Vertex which have the following public properties
!

Shape is a class that has
• public method getName() : String
• public method addVertex(Vertex)
• public method getColour() : Colour
Colour is a class that has
• public method setColour(float, float, float)
Blue is a subclass of Colour that adds a
• public field hue : int

!
!

Vertex is a class that has fields
• public int x
• public int y
!
When shapes are constructed they must have a Colour associated with them, but multiple Vertex(es) can be added independently to a Shape. A Shape has a single
Colour but may have many Vertex’s.

3/8

NAME:

NUMBER:

5. [1 mark] What is meant by the statement that ‘strings in Java are

You May Also Find These Documents Helpful

  • Good Essays

    acct 331 study guide

    • 803 Words
    • 4 Pages

    ALL INFORMATION RELEVANT TO ANSWERING THE PROBLEMS IS FOUND ON THE LAST PAGE OF THE SAMPLE EXAM.…

    • 803 Words
    • 4 Pages
    Good Essays
  • Good Essays

    Agr 3303 Exam 2

    • 2117 Words
    • 9 Pages

    There are 25 questions and each correct response is worth 4 points. Please darken in the circles to spell your last name, FI, and MI and to record your UF ID and test code number. The test code number is located at the bottom of each page of your exam and should be recorded in the spaces provided for questions 76-80. Failure to correctly mark your the test code will result in a grade of 0 for your exam score. Once exams have been graded, your grade will be available through the class website ("exam grades" link). You will need your test code number to access your grade so keep your copy of the exam. Be sure to use a #2 pencil to mark the grade sheet or the computer will not be able to properly grade your exam. Make sure you densely mark the circle corresponding to your choice and make all erasures complete. When you have completed your exam, turn in your scan sheet at the front of the room.…

    • 2117 Words
    • 9 Pages
    Good Essays
  • Good Essays

    responsibility for persons who fail any quiz or test as a result of this document. Always consult the text books…

    • 9489 Words
    • 61 Pages
    Good Essays
  • Good Essays

    SCI 256 Final Exam 1

    • 1357 Words
    • 7 Pages

    Read the directions carefully. Note that the exam is worth a maximum of 15 points (15% of your course grade). Some items are required, and some offer choices of which ones to complete. Responses must be in your own words (no copied content or quotations allowed) in the cells provided; the cells will expand downward as you type. You do not need to cite sources for this test, especially because no copied content is permitted. Be advised that any copied content will not earn points. Please leave the two right-hand scoring columns alone; the instructor will complete those during grading.…

    • 1357 Words
    • 7 Pages
    Good Essays
  • Better Essays

    7. Attached to the back of this exam you will find 3 blank pages, an appendix (formula sheet) and a periodic table. You may remove these from the exam at your convenience.…

    • 2464 Words
    • 11 Pages
    Better Essays
  • Powerful Essays

    You may find it useful to detach the Answer Sheet from the Test Instrument to allow you easier access to both documents. Write your name and section number (e.g., 6980, 6981, 6982, etc.) on the Answer Sheet. You may write on the test instrument, but only responses on the Answer Sheet will be graded.…

    • 2725 Words
    • 11 Pages
    Powerful Essays
  • Satisfactory Essays

    Lewis and clark

    • 353 Words
    • 2 Pages

    The following items may be on the test and should be studied before the test.…

    • 353 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    By submitting this Assessment Book, the Student confirms the information contained in this document is their own work.…

    • 12005 Words
    • 44 Pages
    Powerful Essays
  • Good Essays

    Student Name ______________________________________________________________ School Name _______________________________________________________________ The possession or use of any communications device is strictly prohibited when taking this examination. If you have or use any communications device, no matter how briefly, your examination will be invalidated and no score will be calculated for you. Print your name and the name of your school on the lines above. A separate answer sheet for Part I has been provided to you. Follow the instructions from the proctor for completing the student information on your answer sheet. Then fill in the heading of each page of your essay booklet. This examination has three parts. You are to answer all questions in all parts. Use black or dark-blue ink to write your answers to Parts II, III A, and III B. Part I contains 50 multiple-choice questions. Record your answers to these questions as directed on the answer sheet. Part II contains one thematic essay question. Write your answer to this question in the essay booklet, beginning on page 1. Part III is based on several documents: Part III A contains the documents. When you reach this part of the test, enter your name and the name of your school on the first page of this section. Each document is followed by one or more questions. Write your answer to each question in this examination booklet on the lines following that question. Part III B contains one essay question based on the documents. Write your answer to this question in the essay booklet, beginning on page 7. When you have completed the examination, you must sign the declaration printed at the end of the answer sheet, indicating that you had no unlawful knowledge of the questions or answers prior to the…

    • 7115 Words
    • 29 Pages
    Good Essays
  • Satisfactory Essays

    Touch Doc

    • 468 Words
    • 2 Pages

    Students may bring this sheet into the exam once approved by the teacher. It is to contain the following.…

    • 468 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    Summer 2012 Final

    • 607 Words
    • 3 Pages

    Name ______________________________ ECE 201 Final Exam August 4, 2010 By signing below, I certify that the work submitted on this examination is my own, and that I have adhered to fair standards of academic honesty. This exam is void unless signed. _________________________________ signature Instructions a) Write your name on the front page ONLY. b) Show all your work for the following problems so that partial credit can be assigned. Cross out clearly any work which is to be disregarded. Be certain that the answer is distinguishable from the work. Unsupported answers will not be given credit unless otherwise indicated. c) Extra paper is available if needed. Be sure to label the problem number for each page of your work. d) Use units where required. Answers without units are incomplete, and cannot be assigned full credit. e) Be sure that your work, and discussions and explanations when requested, are clear, concise, and organized. f) Potentially useful formulas are listed on the final page of this exam. g) The point distribution on this exam is as follows: Score Prob. 1 Prob. 2 Prob. 3 Prob. 4 Prob. 5 Prob. 6 Prob. 7 Prob. 8 Total Score 25 Pts. 25 Pts. 25 Pts. 25 Pts. 25 Pts. 25 Pts. 25 Pts. 25 Pts. 200 Pts. Prob. 3 Sum 6, 8 Prob. 5 Prob. 7 Prob. 8 Prob. 4 Outcome #4 (≥13 pts.?) Outcome #5 (≥25 pts.?) Outcome #6 (≥13 pts.?) Outcome #7 (≥13 pts.?) Outcome #8 (≥13 pts.?) Outcome #9 (≥13 pts.?) Yes Yes Yes Yes Yes Yes No No No No No No Prob. 1 Outcome #2 (≥13 pts.?) Yes No…

    • 607 Words
    • 3 Pages
    Powerful Essays
  • Satisfactory Essays

    are attached at the end of the exam. Answer all questions in this booklet. The booklet…

    • 2530 Words
    • 27 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Essay for….

    • 436 Words
    • 2 Pages

    may prepare up to three 3 x 5 index cards of notes at home to use during the test. Your test will be written in ink.…

    • 436 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    Psy 202 Final

    • 1758 Words
    • 8 Pages

    Since human nature is controlled by the individual mind, the only way to come up with some possible explanation is to study the development of the mind, and the impact that society and the environment have on it. In this paper, I will present a brief reflection of my past experiences, my present situation, then analyze how they factor in to the person that I am today using the adult development theories from this class. I will also present my future goals and…

    • 1758 Words
    • 8 Pages
    Powerful Essays
  • Good Essays

    Macro Examples

    • 1120 Words
    • 5 Pages

    7. The If…Then…Else…End If code allows code to be conditionally executed depending on whether a specified logical condition has been met.…

    • 1120 Words
    • 5 Pages
    Good Essays