Blue Pelican JavaExercise Quiz Test Keysby

83928 Words594 Pages
Blue Pelican Java Exercise, Quiz, & Test Keys by Charles E. Cook Version 3.0.5k Copyright © 2004 - 2007 by Charles E. Cook; Refugio, Tx (All rights reserved) This page is intentionally left blank. Keys for Quizzes/Exercises/Projects The short quizzes for each lesson in this section are not comprehensive and not very difficult. Normally, only basic, superficial questions are asked. The general philosophy here is for the specter of a quiz to always be hanging over the student where he knows he must quickly acquire a general working knowledge of the subject but at the same time knows he will not be asked in-depth or tricky questions. It is hoped that this gentle, but persistent pressure, will encourage the student to keep current with…show more content…
int i = 407; 7. Write a single line of code that will create a String variable called my_name and store your name in it. String my_name = “Barney Fife”; 8. Write a line of code that will declare the variable count to be of type int. Don’t initialize. int count; 9. Write a line of code that initializes the double precision variable bankBalance to 136.05. Assume this variable has already been declared. bankBalance = 136.05; 10. Which of the following are legal variable names? scooter13 139_scooter homer-5 ;mary public doubled double ab c 11. Which of the following is the most acceptable way of naming a variable. Multiple answers are possible. a. GroovyDude b. GROOVYDUDE c. groovyDude d. Groovydude e. groovy_dude f. groovydude 12. Comment on the legality of the following two lines of code. double dist = 1003; //legal int alt = 1493.86; //illegal Answers 3-1 Quiz on Lesson 3 1. What is output by the following code? String s = “Mona Lisa”; System.out.println(s.length( )); 2. What is output by the following code? String girl = “Heather Jones”; System.out.println(girl.substring(8)); 3. What is output by the following code? String girl = “Heather Jones”; System.out.println(girl.substring(8,11)); 4. What is the index of the ‘L’ in the String “Abraham Lincoln”? 5. What is output by the following code? String s = “Beaver Cleaver”; System.out.println(s.toUpperCase( )); Answers 3-2 Key to Quiz on Lesson 3 1. What is output by the

    More about Blue Pelican JavaExercise Quiz Test Keysby

      Open Document