Exam Percentage: / 55 = %

Similar documents
CS Exam 2 - Spring 2010

CS Exam 3 - Spring 2010

CS 1301 Exam 1 Fall 2010

Your (printed!) Name: CS 1803 Exam 3. Grading TA / Section: Monday, Nov. 22th, 2010

CS 1301 Exam 1 Fall 2011

CS 1301 Exam 3 Spring 2014

CS Exam 3 - Spring 2010

CS 1301 Exam 1 Spring 2014

CS 2316 Exam 4 Fall 2012

CS 1301 Exam 1 Fall 2010

CS 2316 Exam 1 Spring 2013

CS 1803 Fall 2010 Exam 1

CS 1301 Exam 2 A Fall 2015

CS 1301 Exam 1 Spring 2014

CS 1301 Exam 1 Spring 2011

CS 2316 Exam 4 Fall 2011

CS 1803 Fall 2010 Exam 1

CS 1301 Exam 1 Fall 2014

CS 1301 Exam 2 Fall 2013

CS 2316 Exam 1 Spring 2014

CS 1301 Exam 1 Fall 2014

CS 1301 Exam 3 Spring 2012

CS 2316 Exam 4 Spring 2013

CS 1301 Exam 2 Fall 2014

CS 1301 Exam 2 Fall 2010

CS 1301 Exam 2 A Fall 2015

CS 2316 Exam 4 Fall 2012

CS 2316 Exam 4 Fall 2014

CS 1301 Exam 1 Spring 2015

CS Name : Grading TA:

CS 1316 Exam 1 Summer 2009

CS 1301 Exam 1 Fall 2013

CS 1301 Exam 3 A Spring 2015

CS 1301 Exam 2 Spring 2014

CS 1301 Exam 3 Fall 2014

CS 1301 Exam 1 Fall 2013

CS 2316 Exam 3 Fall 2011

Question: Total Points: Score:

Question Possible Points Earned Points Graded By GUI 22 SQL 24 XML 20 Multiple Choice 14 Total Points 80

CS 2316 Exam 3 Spring 2013

Section 003 Fall CS 170 Exam 2. Name (print): Instructions:

CS 2316 Exam 3 Fall 2012

CS 2316 Exam 4 Fall 2011

Instructor: Yu Wang 11/16/2012

CS 2316 Exam 4 Spring 2012

CS 170 Exam 2. Version: A Spring Name (as in OPUS) (print): Instructions:

CS 170 Section 3, Spring 2015 Programming in Java Midterm Exam 1. Name (print):

Section 003 Fall CS 170 Exam 1. Name (print): Instructions:

Question: Total Points: Score:

Question: Total Points: Score:

CS 1301 Exam 3 Fall 2010

CS 1301 Post Exam 3 Practice Spring 2016

Question: Total Points: Score:

CS 170 Exam 2. Version: A Spring Name (as in OPUS) (print): Instructions:

CS 170 Section 3, Spring 2015 Programming in Java Midterm Exam 1. Name (print):

Question: Total Points: Score:

CS 170 Exam 2. Version: A Fall Name (as in OPUS) (print): Instructions:

Your (printed!) Name: CS 1803 Exam 2. Grading TA / Section: Monday, Oct 25th, 2010

CS 1322 Test 2 - Version 1 Tuesday June 24 th

CS 2316 Exam 2 Summer 2011

CS 110 Exam 2 Spring 2011

Place your name tag here

Section 002 Spring CS 170 Exam 1. Name (print): Instructions:

CS 170 Exam 1. Version: B Fall Name (as on OPUS):

CS 170 Exam 1. Version: C Fall Name (as on OPUS):

Question: Total Points: Score:

CS 2316 Exam 3 Summer 2014

Question: Total Points: Score:

Question: Total Points: Score:

CS 155 Exam 2 Spring 2015

Question: Total Points: Score:

Question: Total Points: Score:

Question: Total Points: Score:

Question: Total Points: Score:

CS 1301 Exam 1 Fall 2009

Section 004 Spring CS 170 Exam 1. Name (print): Instructions:

CS 170 Exam 2. Section 004 Fall Name (print): Instructions:

CS Exam 2 Name: Your Grading TA: This exam has 7 pages including the title page. Please check to make sure all pages are included.

Question: Total Points: Score:

CS 1331 Fall 2016 Exam 2

CS 1301 Exam 1 Answers Fall 2009

CS 190 Exam 1 Fall 2010

CS 1316 Exam 2 Summer 2009

COMP 401 Midterm. Tuesday, Oct 18, pm-3:15pm. Instructions

CS 1331 Exam 1. Fall Failure to properly fill in the information on this page will result in a deduction of up to 5 points from your exam score.

CS 1316 Exam 2 Fall 2009

CS 190 Exam 2 Fall 2014

CS 1316 Exam 3 Fall 2009

CS 1331 Exam 1 ANSWER KEY

CS170 (005): Introduction to Computer Science Exam 2

CIS 110 Introduction to Computer Programming Spring 2016 Midterm

This exam has 10 pages including the title page. Please check to make sure all pages are included.

CIS 110 Introduction to Computer Programming Summer 2014 Midterm. Name:

CIS 110 Introduction to Computer Programming Summer 2016 Midterm. Recitation # (e.g., 201):

Question: Total Points: Score:

CS 111X - Fall Test 1

CIS 110 Introduction to Computer Programming. 13 February 2013 Make-Up Midterm Midterm

CIS Introduction to Computer Programming Spring Exam 1

CSE 1223: Exam II Autumn 2016

CS 101 Spring 2007 Midterm 2 Name: ID:

Transcription:

1/6 CS 1316 - Exam 1 - Spring 2010 Name: CS 1316 - Exam 1 - Spring 2010 Your Grading TA: Your Section : INTEGRITY: By taking this exam, you pledge that this is your work and you have neither given nor received inappropriate help during the taking of this exam in compliance with the Academic Honor Code of Georgia Tech. Do NOT sign nor take this exam if you do not agree with the honor code. DEVICES: If your cell phone, pager, PDA, beeper, ipod, or similar item goes off during the exam, you will lose 10 points on this exam. Turn all such devices off and put them away now. You cannot have them on your desk. ACADEMIC MISCONDUCT will not be tolerated. You are to uphold the honor and integrity bestowed upon you by the Georgia Institute of Technology. Penalties for misconduct will be a zero on this exam, an F grade in the course, and/or other disciplinary action. Keep your eyes on your own paper. Do your best to prevent anyone else from seeing your work. Do NOT communicate with anyone other than a proctor for ANY reason in ANY language in ANY manner. Do NOT share ANYTHING during the exam. (This includes no sharing of pencils, paper, erasers). Follow directions given by the proctor(s). Stop all writing when told to stop. Failure to stop writing on this exam when told to do so is academic misconduct. Do not use notes, books, calculators, etc during the exam. I commit to uphold the ideals of honor and integrity by refusing to betray the trust bestowed upon me as a member of the Georgia Tech community. Signature: Problem Points Earned Points Possible Grader Initials 1. Vocabulary 12 2. Short Answer 7 3. Turtle Graphics 8 4. Code Understanding 8 5. Multiple Choice 2 6. Code Tracing 4 7. Code Writing 14 TOTAL: 55 Exam Percentage: / 55 = %

2/6 CS 1316 - Exam 1 - Spring 2010 Name: 1. Vocabulary (12 points) For each of the following words, write a 1-2 sentence definition of the word as used in this class. Your definition should be concise and to the point, while demonstrating that you know what the term means. a) block - A section of code, typically enclosed with curly brackets { that makes up the body of a loop, function, or conditional. b) class - The fundamental building block of Java programs, they act as the blueprints from which objects are constructed, including definitions of fields and methods. c) private - A keyword that means that only methods within the object can access a particular field or method. d) type declaration - The process of telling the compiler what type of data a variable will hold. e.g. double t; 2. Short Answers ( 7 points) For each of the following questions, write a 1-4 sentence answer: a. What is the difference between a constructor and a method? A constructor is a unique method that is only called when a new instance of an object is created. A constructor must have the same name as the class, and may not have a return type specified. (2pts) b. What is the point of declaring a field private and then declaring a public mutator (set method) that allows the public to change it? Why not just make the field public? It allows you to hide the internal state from direct access by outsiders, and instead require that all accesses to the internal state be done through methods that can act as gatekeepers. This can be used (for example) to give different information at different times. (2pts) c. What would the following math operations result in if run in the interactions pane? To signify that an answer is a Double include at least one decimal place. (1 pt each) > 1/2 Answer: 0 > 10.0/5 Answer: 2.0 > (int) 2.5 * 2 Answer: 4

3/6 CS 1316 - Exam 1 - Spring 2010 Name: 3. Turtle Graphics ( 8 Points) Draw the image that results when this code is executed in the window below. public class TurtleDrawing{ public static void main(string[]args){ World w = new World (500,500); Turtle bert = new Turtle (w); bert.turn(45); for(int i = 1; i <=5; i++){ bert.forward(200); bert.turn(144); Grading: + 1-45 angle for first line + 1 - Starting the turtle in the center + 2-5 sided figure + 2 - Turtle turns to the right each time + 2 - Output is comparable to correct solution

4/6 CS 1316 - Exam 1 - Spring 2010 Name: 4. Code Understanding (8 Points) public class Dog{ public int size; public static String species = "Canine"; public void bark(){ if (size > 5){ System.out.println("Bark!"); else { System.out.println("Yap yap yap"); public static void growl(){ System.out.println("Grrrrr"); The above class Dog has been compiled. Assume a new Dog object has been instantiated as: Dog clifford = new Dog(); clifford.size = 15; -Circle the Java statement(s) below which would cause an error. For each error, specify why the error would occur. -For each statement that would NOT cause an error, write what would be printed! System.out.println(clifford.species); + 1 - Canine System.out.println(Dog.species); + 1 - Canine clifford.bark(); + 1 - Bark! Dog.bark(); + 1 - Circled + 2 - Explanation: Object method cannot be called from a static context clifford.growl(); + 1 - Grrrrr Dog.growl(); + 1 - Grrrrr

5/6 CS 1316 - Exam 1 - Spring 2010 Name: 5. Multiple Choice (2 points) A subclass in Java may extend at most how many superclasses? (circle one) a.) None b.) One Correct Answer c.) Two d.) As many as the coder wishes, provided the syntax is correct. 6. Code Tracing ( 4 points) What will be the output if the following code is executed? int x = 4; int y = 2; if( x < 7 y < 2){ System.out.println("Apple"); if(x > 3 && y > 2){ System.out.println("Banana"); else if(x > 2 y > 0){ System.out.println("Cherry"); else if(x == 4){ System.out.println("Date"); else{ System.out.println("Finished"); Grading: + 2 for Apple + 2 for Cherry - 2 for Each incorrect output

6/6 CS 1316 - Exam 1 - Spring 2010 Name: 7. Code Writing (14 points) Write a class called CombineStrings that contains a static method called combine() that accepts two Strings as parameters and returns a String that is the combination of the two input Strings separated by a space. Write a main method that calls the static method combine() and passes the Strings hello and world into the method. Print the resulting String from the combine() method to the interactions pane. public class CombineStrings { public static void main(string [] args) { String s = CombineStrings.combine("hello", "world"); System.out.println(s); public static String combine(string a, String b) { return a + " " + b; Grading: Class header + 1 - public class CombineStrings Main method + 3 - public, static, void (in that order) + 1 - main(string [] args) + 1 - System.out.println + 1 - Calling combine method with Strings as two parameters Combine method + 3 - static, String, combine (in that order) + 2 - Correct parameters, accepting two String + 1 - String correctly separated by a space + 1 - Returning a String