jk2 java test

23
Complete this sentence: Values are stored in the computer by their _____________ _______. Mark for Review Points Number type Programming type Variable type (*) Value type Which is an example of the Boolean variable type? Mark for Review Points Hello World True or False (*) An object 3. The initializer of a variable with a TextString value t ype could be (select all that apply): Mark for Review (1) Points (Choose all correct answers) "Greetings" (*) "Howdy" (*) "4" (*) None of the above. Incorrect. Refer to Section 2 Lesson 8. 4. Define the value of the variable NumBarks based on the following math calculation: NumBarks * 5 = 25 Mark for Review (1) Points 6 1 25 5 (*) Correct 5. In Alice, an event is considered: Mark for Review (1) Points A party with at least 20 people. An object's orientation. Error handling A keystroke or mouse click. (*) Correct 6. In Alice, when coding for keyboard control, the program mer's job is to consider at least 70% of every key stroke the user could take. T rue or false? Mark for Review (1) Points True False (*) Incorrect. Refer to Section 2 Lesson 8. 7. What can be used as a guideline to ensure your animatio n fulfills animation principles? Mark for Review (1) Points The Internet An animation checklist (*) A close friend Other programmers Correct 8. The animation checklist helps you confirm that all elem ents of the animation are operating as expected. True or false? Mark for Review (1) Points True (*) False Correct

Upload: pero42

Post on 09-Jul-2016

178 views

Category:

Documents


1 download

DESCRIPTION

Java final test questions for the final fundamentals test oracle

TRANSCRIPT

Page 1: Jk2 Java Test

Complete this sentence: Values are stored in the computer by their ____________________. Mark for Review PointsNumber typeProgramming typeVariable type (*)Value typeWhich is an example of the Boolean variable type? Mark for Review PointsHello WorldTrue or False (*)An object3. The initializer of a variable with a TextString value type could be (select all that apply): Mark for Review (1) Points(Choose all correct answers)"Greetings" (*)"Howdy" (*)"4" (*)None of the above. Incorrect. Refer to Section 2 Lesson 8.4. Define the value of the variable NumBarks based on the following math calculation: NumBarks * 5 = 25 Mark for Review (1) Points61255 (*) Correct5. In Alice, an event is considered: Mark for Review (1) PointsA party with at least 20 people.An object's orientation.Error handlingA keystroke or mouse click. (*) Correct6. In Alice, when coding for keyboard control, the programmer's job is to consider at least 70% of every key stroke the user could take. True or false? Mark for Review (1) PointsTrueFalse (*)Incorrect. Refer to Section 2 Lesson 8.7. What can be used as a guideline to ensure your animation fulfills animation principles? Mark for Review (1) PointsThe InternetAn animation checklist (*)A close friendOther programmersCorrect8. The animation checklist helps you confirm that all elements of the animation are operating as expected. True or false? Mark for Review (1) PointsTrue (*)FalseCorrect

Page 2: Jk2 Java Test

9. Which of the following elements of the animation should be tested before the animation is considered complete? Mark for Review (1) PointsMath calculations operate as expected.Objects move with smooth timing.Comments are added to each sequence of instructions.Control statements are operating as expected.All of the above. (*) Correct10. The animation should be tested throughout development, not just at the end of the animation's development. True or false? Mark for Review (1) PointsTrue (*)FalseCorrectPage 1 of 1 Summary Section 1(Answer all questions in this section)1. The list below describes variables. All are correct except which one? Mark for Review (1) PointsA place in memory where data of a specific type can be stored for later retrieval and use.Has a unique name.Has a type associated with it.Arranged in rows and columns. (*) Correct2. Examine the following code. What are the variables? Mark for Review (1) PointsargsnitAll of the above are variables. (*) Correct3. The following are examples of what in Java? booleanbytecharshortintlongfloatdouble Mark for Review (1) PointsTypes (*)ExpressionsVariablesSpecificationsCorrect4. The list below displays valid primitive types in Java, except which one? Mark for Review (1) PointsbooleanString (*)longint

Page 3: Jk2 Java Test

double Incorrect. Refer to Section 2 Lesson 9.5. The list below displays valid arithmetic operators in Java, except which one? Mark for Review (1) Points+/-*%$ (*) Correct6. Results of arithmetic operations cannot be stored in a variable. True or false? Mark for Review (1) PointsTrueFalse (*)Correct7. Expressions with relational operators produce true and false values. True or false? Mark for Review (1) PointsTrue (*)FalseCorrect8. What is the result of the following code? Mark for Review (1) Pointsx > y : x > y x < y : x < yx > y : 1x < y : 0x > y : 0 x < y : 1x > y : true x < y : false (*)x > y : false x < y : true Correct9. If a value has been assigned to (is stored in) a variable, that value will be overwritten when another value is assigned to the variable using the assignment "=" operator. True or false? Mark for Review (1) PointsTrue (*)FalseCorrect10. What is the output produced by the following code? Mark for Review (1) Pointsj is 5 k is 5 (*)j is 10 j is 5 k is 5j is 10 k is 10j is 15 k is 15 CorrectTest: Correlating Java Methods, Classes, and Other Structures with Alice 3 Tools: Quiz

Page 4: Jk2 Java Test

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.Section 1(Answer all questions in this section)1. The list below contains method descriptions. All are correct except which one? Mark for Review (1) Points(Choose all correct answers)A subprogram that acts on data and often returns a value. (*)A set of code that is referred to by name. (*)Can be called at any point in a program simply by utilizing its name.Is associated with an instance variable.Correct2. Main is an example of what in the following code? public static void main (String[] args) { System.out.println{"Hello World!");} Mark for Review (1) PointsAn instanceA method (*)A classA variableIncorrect. Refer to Section 2 Lesson 10.3. You have a Class representing Cat. A cat can meow, purr, catch mice, and so on. When you create a new cat, what is it called? Mark for Review (1) PointsA submethodA subprogramAn instance (*)A subclassA variable classCorrect4. You want a block of code to be executed only once if certain conditions are met. What type of Java construct would you use? Mark for Review (1) Pointswhile loopif (*)arrayboolean Correct5. If you want one message to display if a user is below the age of 18 and a different message to display if the user is 18 or older, what type of construct would you use? Mark for Review (1) Pointsfor all loopdo loopwhile loopif (*)Correct6. If you need to repeat a group of Java statements many times, which Java construct should you use? Mark for Review (1) Points(Choose all correct answers)repeat...untildo while loop (*)while loop (*)if Correct

Page 5: Jk2 Java Test

7. Review the code below. Select the result from the following statements about what happens when the loopVal >= 5 . Mark for Review (1) PointsThe message "Printing Some Text" will be printed until loopVal is no longer less than 5.The variable loopVal is initialized to 0.The condition loopVal < 5 is tested before executing anything further in the program. (*)The condition loopVal < 5 returns a boolean value.None of the above. Incorrect. Refer to Section 2 Lesson 10.8. Which of the following statements about methods is false? Mark for Review (1) PointsClasses must be defined directly within a method definition. (*)Methods whose return type is not void are required to include a return statement specifying what to return.The order in which methods are listed within the class is not important.Java does not permit nesting one method definition within another method's definition. Correct9. In Java, a function is a method that must return a value. True or false? Mark for Review (1) PointsTrueFalse (*) Incorrect. Refer to Section 2 Lesson 10.10. What do lines 7, 10 and 13 do in the following code? Mark for Review (1) PointsExport files called A, B, and num3.Create a single file containing A, B, and the value of num3.Print "A", "B" and the value of num3 on the screen. (*)None of the above.Correct11. Consider the following: You want to use the BufferedReader and InputStreamReader classes to get user input from the command line. Which one of the following import statements must you use? Mark for Review (1) Pointsimport java.awt.*;import java.buffer.*;import java.io.*; (*)import java.io.input.*; CorrectTest: Getting Started with Greenfoot: QuizReview your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.Section 11. In Greenfoot, what happens to an instance when the Act button is clicked in the environment? Mark for Review (1) PointsOnly one instance moves until the pause button is clicked.The instance executes all of the programming statements in their class's act method once. (*)The instance executes all of the programming statements in their class's act method repeatedly until the scenario is stopped.The instance executes all of the programming statements in their class's act method two times until the scenario is stopped.The class executes all of the programming statements in their instance's

Page 6: Jk2 Java Test

act method two times until the scenario is stopped. Correct2. In Greenfoot, the Run button repeatedly executes all of the programming statements in the class's act method in sequential order until the pause button is clicked. True or false? Mark for Review (1) PointsTrue (*)False Correct3. An object is an instance of a class. True or false? Mark for Review (1) PointsTrue (*)FalseCorrect4. In Greenfoot, the class holds the general attributes of an instance, such as the methods it inherits. True or false? Mark for Review (1) PointsTrue (*)FalseCorrect5. A subclass has what kind of relationship to a superclass? Mark for Review (1) Points"for-what""a-is""is-a" (*)"is-by" Correct6. What does an instance of the World class do? Mark for Review (1) PointsProvide the acting objects for the scenario.Provide the background scenery for the scenario. (*)Provide the superclass for acting objects.Provide the source code for instances.Correct7. In Greenfoot, after a subclass is created, what has to occur before instances can be added to the scenario? Mark for Review (1) PointsCreation of an instanceCompilation (*)Creation of source codeEditing of source code Correct8. In Greenfoot, after a subclass is created and compiled, you cannot edit the subclass's source code. True or false? Mark for Review (1) PointsTrueTest: Using Methods, Variables and Parameters: QuizReview your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.Section 1(Answer all questions in this section)1. In Greenfoot, the move method expects what type of information in its parameters? Mark for Review (1) PointsDegrees to turn

Page 7: Jk2 Java Test

True or false responseString statementInteger of steps to move forward (*)Correct2. In Greenfoot, the turn method expects what type of information in its parameters? Mark for Review (1) PointsDegrees to turn (*)True or false responseString statementInteger of steps to move forwardParameter voidCorrect3. Using the Greenfoot IDE, only five instances can be added to a scenario. True or false? Mark for Review (1) PointsTrueFalse (*) Correct4. In Greenfoot, the instance has a source code editor. True or false? Mark for Review (1) PointsTrueFalse (*) Correct5. In the Greenfoot IDE, an instance's position is on the x and y coordinates. True or false? Mark for Review (1) PointsTrue (*)False Correct6. In Greenfoot, which of the following options are not possible when associating an image file with an instance? Mark for Review (1) PointsAdd a video (*)Draw an imageImport an imageSelect an image from the Greenfoot libraryCorrect7. An instance variable can be saved and accessed later, even if the instance no longer exists. True or false? Mark for Review (1) PointsTrueFalse (*)Correct8. A variable is also known as a ____________. Mark for Review (1) PointsInstanceClassField (*)SyntaxMethodCorrect9. In Greenfoot, the body of the method is located in between which of the following characters? Mark for Review (1) PointsParnetheses ( )Curly brackets { } (*)Square brackets [ ]

Page 8: Jk2 Java Test

Asterisks **Correct10. In Greenfoot, methods can be called in the act method. When the Act button is clicked in the environment, the methods in the method body of the act method are executed. True or false? Mark for Review (1) PointsTrue (*)FalseCorrectPage 1 of 1 SummaryFalse (*) CorrectPage 1 of 1 Summary Test: Working with Source Code and Documentation: QuizReview your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.Section 1(Answer all questions in this section)1. The list below provides actions you can perform in the Greenfoot code editor except one. Which one should be removed? Mark for Review (1) PointsWrite source code to tell the class how to act in the scenario.Review the class's inherited methods and properties. (*)Write and edit source code.Write and edit comments. Correct2. The list below displays components of the Greenfoot source code editor except one. Which one should be removed? Mark for Review (1) PointsDocumentationCommentsMethod bodyInstance creator (*)Class description Correct3. In a Greenfoot if-statement, the programming statements that the if-statement executes are written in curly brackets. True or false? Mark for Review (1) PointsTrue (*)False Correct4. An if-statement requires which type of information returned from the condition? Mark for Review (1) PointsIntegerActionTrue or false (*)MethodCorrect5. In Greenfoot, which of the following methods display an object's orientation? Mark for Review (1) Points(Choose all correct answers)void move()int getRotation() (*)int getX() (*)

Page 9: Jk2 Java Test

void turn() Correct6. In Greenfoot, which of the following methods return the world that the instance lives in? Mark for Review (1) PointsWorld getClass()World getWorld() (*)getRotation()getXY() CorrectPage 1 of 1 SummaryTest: Developing and Testing an Application: QuizReview your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.Section 1(Answer all questions in this section)1. Which of the following is an incorrectly written programming statement? Mark for Review (1) Pointsmove(): (*)move(2);turn(25);turn(2);Correct2. Which of the following features of Greenfoot will teach you how to identify bugs in your program? Mark for Review (1) PointsCode editorCompilation (*)Instance creationDocumentation Correct3. In object oriented programming, programmers analyze a problem and create objects to solve the problem. True or false? Mark for Review (1) PointsTrue (*)FalseCorrect4. Which of the following statements is most correct? Mark for Review (1) PointsMy program is complete when it compiles.My program is complete when I add music to it.My program is complete when it runs and I've tested the code. (*)My program is complete when I add images to it.CorrectPage 1 of 1 SummarySection 1(Answer all questions in this section)1. Which of the following Greenfoot methods returns a random number between 0, up to and including 10,000? Mark for Review (1) PointsGreenfoot.getRandomNumber(10,000)Greenfoot.getRandomNumber(10,001) (*)Greenfoot.getRandomNumber(9,999)Greenfoot.getRandomNumber(0-10,000)Correct2. What does the following Greenfoot programming statement tell the class to do?

Page 10: Jk2 Java Test

if (Greenfoot.getRandomNumber(100) < 6) { turn(18); } Mark for Review (1) PointsIf a random number is returned that is greater than 6, turn 18 degrees.If a random number is returned that is less than 6, move 18 steps.If a random number is returned that is less than 6, turn 18 degrees. (*)Turn 6 degrees, then turn 18 degrees. Correct3. Which of the following comparison operators represents "greater than or equal"? Mark for Review (1) Points>>= (*)= =! =Correct4. In Greenfoot you can use comparison operators to compare a variable to a random number. True or false? Mark for Review (1) PointsTrue (*)False Incorrect. Refer to Section 3 Lesson 5.5. An if-else statement executes its first code block if a condition is true, and its second code block if a condition is false, but not both. True or false? Mark for Review (1) PointsTrue (*)FalseIncorrect. Refer to Section 3 Lesson 5.6. Use your Greenfoot experience to answer the question: The first step to executing an if-else statement is to:____________. Mark for Review (1) PointsExecute the if statementExecute the else statementEvaluate the classEvaluate the condition (*) Correct7. The list below displays characteristics of a Greenfoot world constructor, except for one. Which one should be removed? Mark for Review (1) PointsDefines the instance's size and resolution.Has a void return type. (*)Has no return type.Has the same name as the name of the class.Executed automatically when a new instance of the class is created. Incorrect. Refer to Section 3 Lesson 5.8. In Greenfoot, which keyword calls the World superclass? Mark for Review (1) Pointsworldconstructorsuper (*)addObjectnewCorrect9. In Greenfoot, which of the following is the correct notation for calling a method for an instance of a class? Mark for Review (1) Pointsobject-name.method-name(parameters); (*)

Page 11: Jk2 Java Test

class-name.method-name(parameters);Method-name.object-name(parameters);Method-name.object-name; Correct10. In Greenfoot, a semicolon is not necessary at the end of a method that uses dot notation. True or false? Mark for Review (1) PointsTrueFalse (*) Correct11. In Greenfoot, the origin of the world coordinate system (0,0) starts in the center of the world. True or false? Mark for Review (1) PointsTrueFalse (*) Correct12. Which keyword indicates that Greenfoot needs to create a new object? Mark for Review (1) Pointsnew (*)addObjectnewObjectnewClass CorrectTest: Defining Methods: QuizReview your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.Section 1(Answer all questions in this section)1. In the Greenfoot IDE, any new methods you create are written in the class's source code, below the act method. True or false? Mark for Review True (*)False Correct2. In reference to Greenfoot, if the following method was defined in a superclass, public void lookForEdge(){...}all subclasses of the superclass will inherit the method.True or false? Mark for Review True (*)False CorrectTest: Using Sound and Keyboard Control: QuizReview your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.Section 1(Answer all questions in this section)1. In Greenfoot, the sound file must be saved in the scenario and written in the source code for it to play. True or false? Mark for Review (1) PointsTrue (*)FalseCorrect2. You cannot record unique sounds in Greenfoot. You can only use the sounds that are stored in the Greenfoot library. True or false?

Page 12: Jk2 Java Test

Mark for Review (1) PointsTrueFalse (*) Correct3. What type of parameter does the keyDown method expect? Mark for Review (1) PointsThe password that will protect the class.The name of the key to press on the keyboard. (*)The name of the class that will use the key.The name of the sound file to play when the key is pressed.CorrectPage 1 of 1 Summary Test: Creating a World, Animating Actors, and Ending a Game: QuizReview your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.Section 1(Answer all questions in this section)1. In Greenfoot, which method body correctly adds an instance of the World to a scenario, with size x = 300 y = 300 and a resolution of 2 pixels per cell? Mark for Review (1) Pointsworld(300, 300, 2);Super(300,300,2);super(2,300,300);super(300,300,2); (*)Correct2. A constructor is executed once in the course of a Greenfoot scenario. True or false? Mark for Review (1) PointsTrueFalse (*)Correct3. Which of the following Greenfoot programming statements creates a new instance of Duke, and places him at x = 140, y = 130 in the world? Mark for Review (1) PointsaddObject(new( ), 140, 130);addObject(new Duke( ), 140, 130); (*)new(addObject(Duke ), 140, 130);new(Duke( ) 140, 130); Correct4. Which keyword is used to add an actor to a Greenfoot world? Mark for Review (1) PointsaddObjectaddnew (*)super Correct5. Which of the following is the correct syntax for declaring a variable in Greenfoot? Mark for Review (1) Points(Choose all correct answers)public variable-type variable-name; (*)private variable-name, variable-type;public variable-name variable type;private variable-type variable-name; (*)

Page 13: Jk2 Java Test

Correct6. In Greenfoot, what is the purpose of the variable type? Mark for Review (1) PointsDefines the access specifier used with the variable.Defines what kind of data to store in the variable. (*)Defines which class the variable is associated with.Defines the instance that the variable is associated with. Correct7. Which operator is used to test if values are equal? Mark for Review (1) Points<== (*)>!>Correct8. In Greenfoot, the == operator is used to test if two values are equal. True or false? Mark for Review (1) PointsTrue (*)False Correct9. The GreenfootImage class enables Greenfoot actors to maintain their visible image by holding an object of type GreenfootImage. True or false? Mark for Review (1) PointsTrue (*)False Correct10. What does the following programming statement mean? image1 = new GreenfootImage("duke12.png?); Mark for Review (1) PointsThe variable, image1, cannot use the image file, duke12.png.The image file, duke12.png, has just been drawn and imported into the scenario.The image file, duke12.png, is assigned to the variable image1. (*)Image files from 1-119 are associated with image1.Correct11. In Greenfoot, which method is used to end a game? Mark for Review (1) PointsClass.stop( );Greenfoot.stop( ); (*)Duke.stop( );Game.stop(1); Correct12. Where can we review the available classes and methods in Greenfoot, including the stop method? Mark for Review (1) PointsClass menuObject menuClass Application Programmers' Interface (API)Greenfoot Application Programmers' Interface (API) (*) CorrectPage 1 of 1 Summary Test: Understanding Abstraction: QuizReview your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Page 14: Jk2 Java Test

Section 1(Answer all questions in this section)1. From your Greenfoot lessons, which of the following are examples of when abstraction techniques are used? Mark for Review (1) PointsAssigning a sound file to an instance.Assigning a keyboard key to an instance.Assigning an image file to an instance.All of the above. (*) Correct2. Abstraction occurs in many different ways in programming. True or false? Mark for Review (1) PointsTrue (*)FalseCorrectPage 1 of 1 SummaryTest: Using Loops, Variables, and Strings: QuizReview your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.Section 1(Answer all questions in this section)1. From your Greenfoot lessons, which of the following are examples of actions that can be achieved using the while loop? Mark for Review (1) PointsCreate 50 instances of the Duke class.Call the move method 1 million times.Call the move and turn methods 10 times.Create 100 instances of an Actor subclass.All of the above. (*) Correct2. Which of the following is not a component of a while loop? Mark for Review (1) PointsLocal variableControl operatorLoop variableif statement (*)while keywordCorrect3. If an end to a while loop is not established, what happens? Mark for Review (1) PointsThe code stops after 10 executions.The code stops after 20 executions.The condition becomes false after one minute of executions.The code executes and does not stop. (*)Incorrect. Refer to Section 3 Lesson 10.4. Infinite loops are a common cause of errors in programming. True or false? Mark for Review (1) PointsTrue (*)FalseCorrect5. An array is an object that holds multiple methods. True or false? Mark for Review (1) PointsTrueFalse (*)

Page 15: Jk2 Java Test

Correct6. In Greenfoot, arrays are a way to hold and access multiple variables, and assign different values to new instances each time the while loop executes and produces a new instance. True or false? Mark for Review (1) PointsTrue (*)False Correct7. Which of the following Greenfoot logic operators represents "not"? Mark for Review (1) Points&&&=! (*) Correct8. In the Greenfoot IDE, what does the AND operator (&&) do? Mark for Review (1) PointsCompares two boolean values, and returns a boolean value which is true if and only if both of its operands are true. (*)Compares two boolean values, and returns a boolean value which is true if and only if one of its operands are true.Compares two boolean values and returns a boolean value which is true if either one of the operands is true.Compares two boolean variables or expressions and returns a result that is true if either of its operands are true. Correct9. In Greenfoot, a local variable is declared at the beginning of a class. True or false? Mark for Review (1) PointsTrueFalse (*) Correct10. In Greenfoot, what types of values cannot be stored in a local variable? Mark for Review (1) PointsClass nameObjectsIntegersWorld nameMethod (*) Correct11. In Greenfoot, string concatenation reduces the number of redundant characters or phrases you need to type into each array. True or false? Mark for Review (1) PointsTrue (*)False Correct12. Which of the following is an example of string concatenation? Mark for Review (1) PointsInstead of entering ".png" after each image file name, add && ".png" after the imageName value in the programming statement.Instead of entering ".png" after each image file name, add = ".png" after the imageName value in the programming statement.Instead of entering ".png" after each image file name, add + ".png" after the imageName value in the programming statement. (*)

Page 16: Jk2 Java Test

Instead of entering ".png" after each image file name, add ".png" after the imageName value in the programming statement.CorrectPage 1 of 1 SummaryTest: Creating an Inventory of Java Fundamentals: QuizReview your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.Section 1(Answer all questions in this section)1. From your Greenfoot lessons, the __________ control structure is used to compare and make a decision. Mark for Review (1) PointsConditional (*)RepetitionObsoleteRewind Correct2. From your Greenfoot lessons, the __________ control structure is often referred to as loops. Mark for Review (1) PointsConditionalRepetition (*)ObsoleteRewind Correct3. The construct listed below is described as a __________________./** * Get value and store in variable */ Mark for Review (1) PointsMethodComment (*)Variable AssignmentInstruction Correct4. The construct listed below is described as a __________________.termvar = scanterm.nextLine(); Mark for Review (1) PointsMethodCommentVariable Assignment (*)Instruction Correct5. What is wrong with the following line of code?System.out.println(termvar+'; '+termdef); Mark for Review (1) PointsThere are parenthesis instead of brackets.There are parenthesis instead of curly braces.There are single quotes instead of double quotes. (*)The command is incorrectly capitalized.Nothing is wrong with the code.Incorrect. Refer to Section 3 Lesson 12.6. Which line of code contains a syntax error? Mark for Review (1) Points

Page 17: Jk2 Java Test

23 (*)456Correct7. In which step to create a Greenfoot game do you find and resolve errors in the game? Mark for Review (1) PointsDefine the problemDesign the solutionProgram the solutionTest the solution (*)Correct8. In which step to create a Greenfoot game is the solution implemented? Mark for Review (1) PointsDefine the problemDesign the solutionProgram the solution (*)Test the solutionCorrect9. From your Greenfoot lessons, which of the following are examples of Q/A test variations? Mark for Review (1) PointsChange the environment, change the programmer, change the executionChange the execution, change the data, change the environment (*)Change the environment, change the execution, change the languageAll of the above. Correct10. The variations listed below are examples of changing what part of Q/A testing?Input numbers when characters are expectedInput characters when numbers are expectedInput symbols Mark for Review (1) PointsChange the environmentChange the executionChange the data (*)None of the above CorrectPage 1 of 1 Summary\Test: Compiling with Eclipse: QuizReview your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.Section 1(Answer all questions in this section)1. When Eclipse launches, the Welcome page displays. Once this page is closed you cannot return to the resources available on this page. True or False? Mark for Review (1) PointsTrueFalse (*) Incorrect. Refer to Section 4 Lesson 1.2. Eclipse provides an edit area to help you navigate a hierarchy of information. True or False? Mark for Review (1) PointsTrue

Page 18: Jk2 Java Test

False (*) Incorrect. Refer to Section 4 Lesson 1.3. Eclipse provides views to help you navigate a hierarchy of information. True or False? Mark for Review (1) PointsTrue (*)False Correct4. Tabs are used when more than one file is open in the edit area. True or False? Mark for Review (1) PointsTrue (*)False Correct5. A perspective is described as: Mark for Review (1) PointsA combination of views and editors (*)A combination of views and windowsA combination of editor tabsNone of the above Correct6. The ______________ is the location onto which you will store and save your files. Mark for Review (1) PointsPerspectiveWorkspace (*)EditorNone of the above Correct7. A workspace can have one or more stored projects. True or false? Mark for Review (1) PointsTrue (*)False Correct8. Identify the components in the image below. Mark for Review (1) PointsA-Main Method, B-Class, C-PackageA-Class, B-MainMethod, C-PackageA-Package, B-Main Method, C-Class (*)None of the aboveCorrect9. In Eclipse, when you run a Java Application, the results may be displayed in the Console View. True or False? Mark for Review (1) PointsTrue (*)False CorrectTest: Using Program Control Statements: QuizReview your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.Section 1(Answer all questions in this section)1. What is a loop? Mark for Review (1) PointsA keyword used to skip over the remaining code.A set of logic that is repeatedly executed until a certain condition is met. (*)A segment of code that may only ever be executed once per call of the pr

Page 19: Jk2 Java Test

ogram.None of the above. Correct2. It is necessary to end all loops at some point in your Java program. True or false? Mark for Review (1) PointsTrue (*)FalseIncorrect. Refer to Section 5 Lesson 1.3. Which of the following are types of loops in Java? Mark for Review (1) Points(Choose all correct answers)While (*)If/ElseDo-While (*)For (*) Correct4. Identify which situation could be an example of a WHILE loop. Mark for Review (1) PointsTaking coins out of a pile one at a time and adding their value to the total until there are no more coins in the pile to add.Attending class while school is not over for the day.Petting each animal at the pet store one at a time until all the animals have been petted.All of the above. (*) Correct5. Which of the following correctly initializes a For loop that runs through 5 times? Mark for Review (1) Pointsfor(int i = 0; i == 6; i++)for(int i = 1; i < 6; i++) (*)for(int i = 0; i < 5; I++)for(int i = 1; i < 5; I++)Correct6. What is the function of the word "break" in Java? Mark for Review (1) PointsIt exits the current loop or case statement. (*)It continues onto the next line of code.It stops the program from running.It does not exist in Java.Incorrect. Refer to Section 5 Lesson 1.7. The following code fragment properly implements the switch statement. True or false?default(input)switch '+':answer+=num;break;case '-':answer-=num;break;!defaultSystem.out.println("Invalid input"); Mark for Review (1) PointsTrueFalse (*)Correct8. What is one significant difference between a WHILE loop

Page 20: Jk2 Java Test

and a DO-WHILE loop? Mark for Review (1) PointsThere is no difference between a DO-WHILE loop and a WHILE loop.A DO-WHILE loop does not exist in Java and a WHILE loop does.A DO-WHILE loop includes an int that serves as a counter and a WHILE loop does not.A DO-WHILE loop will always execute the code at least once, even if the conditional statement for the WHILE is never true. A WHILE loop is only executed if the conditional statement is true. (*) Correct9. Which of the following correctly initializes an instance of Scanner, called "in", that reads input from the console screen? Mark for Review (1) PointsScanner in = new Scanner(System.in); (*)Scanner in = new Scanner("System.in");Scanner in = Scanner(System.in);System.in in = new Scanner(); CorrectTest: Using Arrays: QuizReview your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.Section 1(Answer all questions in this section)1. Which of the following statements is a valid array declaration? Mark for Review (1) Points(Choose all correct answers)int number();float average[]; (*)double[] marks; (*)counter int[]; Correct2. The following array declaration is valid:int[] y = new int[5]; Mark for Review (1) PointsTrue (*)FalseCorrect3. Which of the following declares a one dimensional array named "score" of type int that can hold 9 values? Mark for Review (1) Pointsint score;int[] score;int[] score=new int[9]; (*)int score=new int[9];Correct4. Which of the following declares and initializes a two dimensional array? Mark for Review (1) Pointsint[][] array={{1,1,1},{1,1,1},{1,1,1}}; (*)int[] array={{1,1,1},{1,1,1},{1,1,1}};int[][] array={1,1,1},{1,1,1},{1,1,1};int[][] array={1,1,1,1,1,1,1,1,1}; Correct5. Which of the following declares and initializes a one dimensional array named words of size 10 so that all entries can be Strings? Mark for Review (1) PointsString words=new String[10];

Page 21: Jk2 Java Test

char words=new char[10];char[] words=new char[10];String[] words=new String[10]; (*)Correct6. What is the output of the following segment of code? Mark for Review (1) Points2222200 (*)2202This code does not compile.Correct7. What is the output of the following segment of code? Mark for Review (1) Points1286864643432262423242322666666 (*)This code does not compile.Correct8. Which of the following declares and initializes a two dimensional array named values with 2 rows and 3 columns where each element is a reference to an Object? Mark for Review (1) PointsString[][] values={"apples","oranges","pears"};String[][] values=new String[3][2];String[][] values=new String[2][3]; (*)String[][] values; Correct9. Which of the following declares and initializes a two dimensional array where each element is a reference type? Mark for Review (1) PointsString words=new String[10];char[][] words;char[][] words=new char[10][4];String[][] words=new String[10][3]; (*)Incorrect. Refer to Section 6 Lesson 1.10. Which of the following statements print every element of the one dimensional array prices to the screen? Mark for Review (1) Pointsfor(int i=0; i < prices.length; i++){System.out.println(prices[i]);} (*)System.out.println(prices.length);for(int i=1; i <= prices.length; i++){System.out.println(prices[i]);}for(int i=0; i <= prices.length; i++){System.out.println(prices[i]);} Correct11. What is the output of the following segment of code? Mark for Review (1) Points753677665544332217531 (*)This code does not compile.Correct12. The following creates a reference in memory named y that can refer to five different integers via an index. True or false? int[] y = new int[5]; Mark for Review (1) Points

Page 22: Jk2 Java Test

True (*)FalseCorrect13. The following creates a reference in memory named z that can refer to seven different doubles via an index. True or false? double z[] = new double[7]; Mark for Review (1) PointsTrue (*)FalseCorrect14. What is the output of the following segment of code if the command line arguments are "apples oranges pears"? Mark for Review (1) Pointsapplespears (*)orangesargsThis code doesn't compile.Correct15. What is the output of the following segment of code if the command line arguments are "apples oranges pears"? Mark for Review (1) Points0123 (*)This code does not compile.Correct16. What will be the content of array variable table after executing the following code? Mark for Review (1) Points0 0 00 0 00 0 01 0 00 1 00 0 1 (*)1 0 01 1 01 1 10 0 10 1 01 0 0Correct17. What is the output of the following segment of code? Mark for Review (1) Points1286864 (*)643432262423242322666666This code does not compile.Correct18. After execution of the following statement, which of the following are true? int number[] = new int[5]; Mark for Review (1) Points

Page 23: Jk2 Java Test

number[0] is undefinednumber[4] is nullnumber[2] is 0 (*)number.length() is 6Incorrect. Refer to Section 6 Lesson 1.19. The following array declaration is valid. True or false?int x[] = int[10]; Mark for Review (1) PointsTrueFalse (*)CorrectPage 1 of 1 Summary