exam1_Fall2010

exam1_Fall2010 - COMP 1210 Fall 2010 Last Name: _ Exam 1...

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

View Full Document Right Arrow Icon
COMP 1210 Fall 2010 Exam 1 – 09/22/2010 – Page 1 of 8 Last Name: ____________________________ First Name: ________________________________ Multiple Choice (40 items @ 2.5 point each) Select the letter in front of the most correct answer, and mark your scantron accordingly . 1. When an object is created, space is reserved in memory for that object’s _________. a. constructor b. instance data c. methods d. class header e. local variables 2. In which of the following lines of code is a variable declared but not initialized? a. int var1 = 3; b. int var2; c. var2 = 1 / 6; d. var1 = var2; e. Integer i = new Integer(var1); 3. Which of the following lines contains a narrowing conversion? a. double value1 = Double.parseDouble(str); b. int value = "Exam 1!" .length(); c. double value3 = ( int ) 3.5; d. int value4 = 4; e. both b and c 4. Fill in the blank in the Javadoc comment below: /** * Adds interest to the account balance. * * @________ The interest. */ public void addInterest( double rate) a. param b. return c. param rate d. return rate e. param args 5. Which of the following is executed first when you run your Java application? a. The constructor of your class b. The main method of your class c. The toString method of your class d. All static methods of a class e. None of the above
Background image of page 1

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

View Full DocumentRight Arrow Icon
COMP 1210 Fall 2010 Exam 1 – 09/22/2010 – Page 2 of 8 6. A private method is referred to as a(n) ________ method, while a public method is referred to as a(n) ________ method. a. static, class b. class, static c. support, service d. static, service e. service, static 7. Which of the following best describes the variable num? Integer num = new Integer(10); a. a double type variable b. a reference type variable c. a primitive type variable d. a static variable e. a constant field 8. Which of the following (if any) is not a valid variable name? a. old b. new c. total$ d. an_input e. All of the above are valid variable names. 9. Which of the following represents the Java interpreter on your computer and is responsible for running your Java program? a. jGRASP.exe b. java.exe c. javac.exe d. run.exe e. Any IDE can act as a Java interpreter. 10. Suppose that your program produces an incorrect answer as a result of integer division. What type of error is produced? a.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 8

exam1_Fall2010 - COMP 1210 Fall 2010 Last Name: _ Exam 1...

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

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