Final Study Guide
- The final will be given on Monday, December 5 from 7 to 10pm in room 14-249.
- You should bring a scantron form and your Android phone and cable if you have not turned them in already.
- You should bring a pencil and eraser.
- There will be a review session in ??? at ???
- Dr. Janzen will have office hours in his office or 14-256 on Monday, December 5 from 2 to 4pm.
- You may not use any study aids during the exam. For instance, books, notes, friends, phones, computers will not be allowed.
- The exam will contain multiple choice, fill-in-the-blank, short answer, and programming questions.
- Although the exam is comprehensive, it will focus on topics from the last half of the course, primarily Java and Android
- You may be asked questions regarding:
- material presented during lecture and lab - be sure to review notes linked from the course schedule
- reading assignments
- the course project including topics such as (but not limited to) process, organization, domain, technology
- the functionality of Android phones (e.g. touch, magnetometer, accelerometer, internet, GPS, wifi, internet)
- capabilities and limitations of Scratch
- capabilities and limitations of App Inventor
- Java programming fundamentals
- answer questions about programming and Java basics (e.g. what is a data type?, what is the difference between if and while?)
- be able to write short programs that use class, if/else, for, while, primitive data types, built-in operators (+,-,*,/,%,++,==,!=,&&,||), functions/methods
- you are encouraged to carefully review labs 4 through 9
- you may also find value in doing sample problems at codingbat.com
- sample problems will also be provided through email
- program testing fundamentals
- be able to write JUnit tests (e.g. use assertEquals and assertTrue as in this example)
- Android programming fundamentals
- answer questions about Android programming concepts (e.g. what is an Activity?, what is an Intent?, what is a layout?, what is a view?, what are possible values for layout_width in an xml layout file?)
- be able to write short programs similar to the HelloWorld, Rock/Paper/Scissors, and TicTacToe programs in the labs
- be able to write methods similar to Intents and Shared Preferences
- Below are some sample final exam programming questions. Some exam questions will likely come from this list.
For each of the Java questions, be able to write a set of JUnit tests and the method or class as appropriate.
- Write an onCreate method in an Activity class that retrieves a TextView with id 'text1' from a layout file name 'finalexam1.xml', and sets the text displayed to be "I got an A".
- Write an onCreate method in an Activity class that retrieves a Button with id 'button1' from a layout file name 'finalexam2.xml', and registers a click listener that starts another activity named 'Game.class'. Use an anonymous inner class.
- Write an xml layout file that declares a LinearLayout with a Button with id 'button1' followed by a TextView with id 'text1'.
- Write the code that would go in onPause() and onResume() to save then restore the contents of an EditText with id 'joke1' using SharedPreferences.
- Write a method that accepts a number x and computes x2 + 3.
- Write a method that accepts a number x and computes 4x3 + 3x2 + 9
- Write a method that accepts A, B, and C, and x, and computes Ax2 + Bx + C
- Write a method that returns the length of the longer of two input strings.
- Write a method that returns the smallest of three given numbers.
- Write a method that returns the largest of three given numbers.
- Write a method that returns the "middle" of three given numbers.
- An etude has a title, a composer, and a difficulty. Design a class for etudes, and give three examples.
- Write a method named 'notTooDifficult', that accepts an etude and a difficulty and returns 'true' when the etude is easier than the given difficulty.
- A phone has a maker, a year of construction, and a quality. Design a class for phones, and give three examples.
- Write a method named 'oldPhone', that accepts a phone and a year of construction and returns true when the phone was built in or before the given year.
- A singer has a height, a weight, a name, and a famousness ranking. Design a class for singers, and give three examples.
- Write a method named 'shortNameSinger', that accepts a singer and returns true if the singer's name is shorter than 10 characters.
- Write a method that returns true exactly when an array of ints contains a 6.
- Write a method that returns true exactly when an array of strings contains "boo".
- Write a method that returns true exactly when an array of booleans contains a false.
- Write a method that returns true exactly when an array of ints contains an int greater than 12.
- Write a method that returns true exactly when an array of strings contains a string longer than 4 characters.
- Write a method that returns true exactly when it is given a number for which x9 + 3x + 2 = 0
- Write a method that accepts an array of ints and an int 'n' and returns true exactly when 'n' occurs in the array.
- Write a method that accepts an array of ints and an int 'x' and returns the index of the first occurrence of the int 'x' in the array.
- Write a method that accepts an array of strings and a string 's' and returns the index of the first occurrence of the string 's' in the array.
- Write a method that accepts an array of numbers and returns their sum.
- Write a method that accepts an array of numbers and returns their product.
- Write a method that accepts an array of non-negative numbers and a size of the array, and returns the largest number in the array. If called with an empty array, the result should be zero.
- Write a method named 'putAtEnd' that accepts an array of ints, the number of elements currently in the array, and a single int, and adds the single int at the end of the array.
- Write a method named 'append' that accepts two arrays of ints and appends them together.
- Write a method named 'reverse' that accepts an array of ints and returns the reversed list.
- Write a method named 'countPizza' that accepts an array of strings and returns the number of times that 'pizza' occurs in it.
- Write a method named 'countBiggerThan9' that accepts an array of ints and returns the number of elements that are strictly larger than 9.
- Write a method named count-falses that accepts an array of booleans and returns the number of booleans that are false.
- Write a method that accepts an array of numbers and computes their mean.