fall2003finalexa

fall2003finalexa - 1.00/1.001 Introduction to Computers and...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
1.00/1.001 Introduction to Computers and Engineering Problem Solving Final Examination - December 15, 2003 Name: E-mail Address: TA: Section: You have 3 hours to complete this exam. For coding questions, you do not need to include comments, and you should assume that all necessary files have already been imported. Good luck! Question Points Question 1 / 10 Question 2 / 10 Question 3 / 20 Question 4 / 60 Total / 100 1 / 15
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Question 1. True or False (10 points) Answer the following questions about Java by circling TRUE or FALSE as appropriate. 1) If a and b are two references of the same type, then a. equals( b) will return true if and only if a and b refer to the same object. TRUE FALSE 2) Collisions will never occur in a hash table that uses chaining. TRUE FALSE 3) Java streams are Last In, First Out stacks. TRUE FALSE 4) It is not possible to read and write one file using the same stream. TRUE FALSE 5) An inorder traversal will visit the nodes in a binary search tree in increasing order. TRUE FALSE 2 / 15
Background image of page 2
Question 2. Conceptual Question (10 points) There are situations or specific sets of data that can make an efficient algorithm or data structure give atypically inefficient or incorrect performance. Please describe at least two examples and strategies to remedy the problem in both cases. 3 / 15
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Question 3. Word Counting (20 points) Ever hungry in your quest to learn more about Java, you spend some time using Google to track down an electronic version of the seminal Java text: The Java Programming Language , Third Edition by Arnold, Gosling, and Holmes. As you settle down for a restful IAP, you notice that the word "java" appears 37 times on the first two pages of this book. This large number of occurrences leads you to wonder how many times "java" appears throughout the entire book. Thankfully, when you have the electronic format, you can write a program to parse the book and count up all of the occurrences. Remembering your Stream lectures, you are quickly able to write a piece of the program that reads in all of the words as String s and stores them in a String[] . You decide that your next course of action will be to build a Map that maps the words to the number of times they occur. 1 Specifically, you will map String s to Integer s. In the box below, write code that will create a Map and fill it so that the keys of the Map are the words in the book and the values are the number of times each word appears. The only variable you know about is the String[] words . This String array contains all of the words as they appear in they book but with each String changed to lowercase. For example, the first four words seen in the book are the title: "The Java Programming
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/29/2011 for the course CIVIL 1.00 taught by Professor Georgekocur during the Spring '05 term at MIT.

Page1 / 15

fall2003finalexa - 1.00/1.001 Introduction to Computers and...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online