Blue Pelican JavaExercise Quiz Test Keysby

Topics: For loop, ASCII, Programming language Pages: 595 (83928 words) Published: November 11, 2014
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 his studies and be rewarded with a frequent “100” on these little quizzes. It is suggested that a quiz be given the day after a new lesson is introduced.

Answers 1-1

Quiz on Lesson 1
1. Create the “skeleton” of a program.

2. Write a line of code that will cause the word Hello to be printed.

3. Consider the following code:
System.out.print(“Fire”);
System.out.println(“ Ants”);
Which of the following is actually printed?
a. Fire Ants
b. Fire
Ants
4. What is the syntax for indicating that a line of text is not Java code; rather, it is a rem?

Answers 1-2

Key to Quiz on Lesson 1
1. Create the “skeleton” of a program.
public class Tester
{
public static void main(String args[])
{
}

}

2. Write a line of code that will cause the word Hello to be printed. System.out.println(“Hello”);
3. Consider the following code:
System.out.print(“Fire”);
System.out.println(“ Ants”);
Which of the following is actually printed?
a. Fire Ants
a
b. Fire
Ants
4. What is the syntax for indicating that a line of text is not Java code; rather, it is a rem? // should precede the text

Answers 1-3

Project… From Me To You, Key
//Author: Charles Cook
//Date created: Mar 22, 2005
public class Tester
{
public static void main(String args[])
{
System.out.println("From: Bill Smith");
System.out.println("Address: Dell Computer, Bldg 13");
System.out.println("Date: April 12, 2005");
System.out.println(" ");
System.out.println("To: Jack Jones");
System.out.println(" ");
System.out.println("Message: Help! I'm trapped inside a computer!"); }
}

Answers 2-1

Quiz on Lesson 2
1. What are the three variable types we have studied up to this point?

2. Suppose you have the number 189.24. Which variable type would you use to store this number?

3. Write a line of code that declares k to be an integer.

4. Which of the following are illegal names for a variable?
num , Num, count, 12flag, flag-stuff, flagStuff, flag_stuff, flag stuff

5. Which of the following is the least desirable way to name a variable? redcolor, red_color, redColor

Answers 2-2

Key to Quiz on Lesson 2
1. What are the three variable types we have studied up to this point? String, int, double
2. Suppose you have the number 189.24. Which variable type would you use to store this number?
double
3. Write a line of code that declares k to be an integer.
int k;
4. Which of the following are illegal names for a variable?
num , Num, count, 12flag, flag-stuff, flagStuff, flag_stuff, flag stuff 12flag, flag-stuff, flag stuff
5. Which of the following is the least desirable way to name a variable? redcolor, red_color, redColor
redcolor

Answers 2-3

Key to Exercise on Lesson 2

1. What are the three main types of variables used in JAVA and what are they used to store? a. String…stores names, letters, sentences, or any combination of characters, etc. b. int …stores integers, positive or negative

c. double…stores decimal fraction numbers
2. What type of variable would you use to store your name?
String
3. What type of variable would you use to store the square root of 2? double…square root of 2 is approximately 1.414
4. What type of variable would you use to store...
Continue Reading

Please join StudyMode to read the full document

You May Also Find These Documents Helpful

  • Essay about Free Blue Pelican Java Answer Book
  • OLS is blue Essay
  • Organizational Leadership Test Questions with Answers Essay
  • The Blue Essay
  • quiz 3 Essay
  • Essay on Quiz
  • Quiz Ans Research Paper
  • Quiz Essay

Become a StudyMode Member

Sign Up - It's Free