• No results found

quiz pbo

N/A
N/A
Protected

Academic year: 2021

Share "quiz pbo"

Copied!
25
0
0

Loading.... (view fulltext now)

Full text

(1)

Test: Section 2 Quiz 1 - L1-L7

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 2 - Quiz 1 L1-L7

(Answer all questions in this section)

1. What does a visual storyboard help the reader understand?

(Choose all correct answers)

The components of the scene. (*) How the initial scene will be set up. (*) The actions that will take place. (*) The code that is debugged.

Correct

2. In Alice, procedural abstraction is the concept of making code easier to understand and reuse. True or false?

True (*) False

Correct

3. From your Alice lessons, what does inheritance mean?

Each subclass inherits the methods and properties of its superclass. (*)

Each class has its own methods and properties that are non-transferable to any other class. Each superclass inherits the methods and properties of its subclass.

Each class inherits the methods and properties of all classes available in Alice. Correct

(2)

(Choose all correct answers)

Select the project from the My Projects tab. (*) Browse for the project using the File System tab. (*) Click and drag the file from your computer into Alice 3.

Double-click on the project file name in the folder it is stored in on your computer. Correct

5. In Alice, where does an instance's axes intersect?

At the world's center point. At the instance's center point. (*) At the instance's head.

At the instance's feet. Correct

Page 1 of 3

Next

Summary

Test: Section 2 Quiz 1 - L1-L7

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 2 - Quiz 1 L1-L7

(Answer all questions in this section)

6. What is the purpose of a function in Alice?

To define how the object should execute a task. To position the object in the Scene editor. To save the project.

To compute and answer a question about an object. (*) Incorrect. Refer to Section 2 Lesson 3.

(3)

7. In Alice the Functions tab will display the pre-defined functions for the selected instance. True or false?

True (*) False

Correct

8. Which of the following is a reason why you might disable programming statements in your Alice code?

To make an object turn and move simultaneously. To disable the entire program.

To make an object move forward.

To help isolate portions of code during testing. (*) Correct

9. From your Alice lessons, which of the following are reasons why random numbers would be used by a computer?

(Choose all correct answers)

For security. (*)

For creating procedures. For simulation. (*) For opening a project.

Correct

10. The first step to using a top-down approach to programming is to create a table to align the storyboard steps to the programming instructions. True or false?

True False (*)

Incorrect. Refer to Section 2 Lesson 4.

(4)

Test: Section 2 Quiz 1 - L1-L7

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 2 - Quiz 1 L1-L7

(Answer all questions in this section)

11. From your Alice lessons, which programming instruction represents the following movement: A cat moves forward double (or twice) the distance to the tree.

this.Cat move Forward this.Cat getDistanceTo this.tree * 2.0 (*) this.Cat move forward this.Cat getDistanceTo this.tree + 2.0 this.Cat move Forward this.Cat getDistanceTo this.tree / 2.0 this.Cat move Forward this.Cat getDistanceTo this.tree - 2.0

Correct

12. From your Alice lessons, which programming instruction represents the following movement: A person moves forward the distance to the table, minus the depth of the person.

this.Person move Forward this.Person getDistanceTo this.Table - this.Table getDepth this.Person move Forward this.Person getDistanceTo this.Table + this.Person getDepth this.Table move Forward this.Person getDistanceTo this.Table - this.Table getDepth this.Person move Forward this.Person getDistanceTo this.Table - this.Person getDepth (*)

Incorrect. Refer to Section 2 Lesson 7.

13. Debugging is the process of finding bugs in a software program. True or false?

True (*) False

Correct

14. In Alice, a computer program requires functions to tell it how to perform the procedure. True or false?

(5)

False (*)

Correct

15. In Alice, the procedures' arguments allow the programmer to adjust the object, motion, distance amount, and time duration. True or false?

True (*) False

Correct

Previous

Page 3 of 3

Summar

y

\

Test: Section 2 Quiz 2 - L8-L14

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 2 - Quiz 2 L8-L14

(Answer all questions in this section)

1. Variable values can be changed as often as you like. True or false?

(6)

3. When presenting your Alice animation, ensure that your presentation is thoroughly tested and complete. True or false?

4. What type of Alice listener object is required to target a mouse-click on any object in the scene, allowing the user to drag that object around the scene when the animation is running?

5. What should you refer to for the animation's design specifications as you program your Alice animation?

Page 1 of 3

Next

Summary

Test: Section 2 Quiz 2 - L8-L14

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 2 - Quiz 2 L8-L14

(Answer all questions in this section)

6. A typical application uses various values and these values continuously change while the program is running. True or false?

(7)

Review (1) Points

True (*) False

Correct

7. The following are examples of what in Java? boolean bite char short int long float double Mark for Review (1) Points Expressions Variables Types (*) Specifications Correct

8. You want an event to happen when an object collides with another object, which category of event handler would you choose?

Mark for Review (1) Points Scene Activation/time Mouse Position/Orientation (*) Keyboard

Incorrect. Refer to Section 2 Lesson 11.

9. When you import a class from another file you have to

import the entire class. True or false? Mark for

Review (1) Points

True False (*)

(8)

10. In Alice, which of the following programming statements moves the butterfly forward, double the distance to the tree?

Mark for

Review (1) Points

this.Butterfly move forward {this.Butterfly getDistanceTo this.Tree / 2}

this.Butterfly move backward {this.Butterfly getDistanceTo this.Tree / 2}

this.Butterfly move forward {this.Butterfly getDistanceTo this.Tree * 2} (*)

this.Butterfly move backward {this.Butterfly getDistanceTo this.Tree * 2}

Test: Section 2 Quiz 2 - L8-L14

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 2 - Quiz 2 L8-L14

(Answer all questions in this section)

11. In Alice, which of the following programming statements moves the cat forward the distance to the bird?

this.Cat move forward {this.Cat getDistanceTo this.Bird} (*) this.Cat move {this.Bird getDistanceTo this.Cat / 2}

this.Bird move forward {this.Bird getDistanceTo this.Cat} this.Cat move forward {this.Bird getDistanceTo this.Cat / 2}

(9)

Export 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.

13. Java programs can be simple programs that run from the command line, or they can have complex graphical user interfaces. True or false?

True (*) False

14. A conditional loop is a loop that will continue forever. True or false?

True False (*)

(10)

True False (*)

Previous

Page 3 of 3

Summary

Test: Section 3 Quiz 2 - L6-L10

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 3 - Quiz 2 L6-L10

(Answer all questions in this section)

1. In Greenfoot, a way to have all subclasses of a superclass inherit a method is by adding the method to the superclass. True or false?

True (*) False

Correct

2. To execute a method in your Greenfoot game, where is it called from?

The actor class The gallery The world

The act method (*) Correct

3. A collision in Greenfoot is when two actors make contact?

True (*) False

(11)

Correct

4. What type of parameter does the keyDown method expect?

The name of the key to press on the keyboard. (*)

The name of the sound file to play when the key is pressed. The name of the class that will use the key.

The password that will protect the class. Correct

5. In Greenfoot what command would you use to detect if a mouse has been clicked on an actor?

Actor.clicked(this)

Greenfoot.mouseClicked(this) (*) Greenfoot.clicked(this)

Greenfoot.pressed(this)

Incorrect. Refer to Section 3 Lesson 7.

Page 1 of 3

Next

Summary

Test: Section 3 Quiz 2 - L6-L10

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 3 - Quiz 2 L6-L10

(Answer all questions in this section)

6. You cannot record unique sounds in Greenfoot. You can only use the sounds that are stored in the Greenfoot library. True or false?

True False (*)

(12)

7. We can use the Actor constructor to automatically create Actor instances when the Greenfoot world is initialized. True or false?

True False (*)

Correct

8. Which class holds the method that ends a Greenfoot game?

GreenfootImage Actor

Greenfoot (*) Class

Incorrect. Refer to Section 3 Lesson 8.

9. Using the Greenfoot IDE, when is a constructor automatically executed?

When the act method is executed. When source code is written.

When a new instance of the class is created. (*) When a new image is added to the class.

Correct

10. In Greenfoot, you can cast an Actor class to a World class?

True False (*)

Incorrect. Refer to Section 3 Lesson 9.

(13)

Test: Section 3 Quiz 2 - L6-L10

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 3 - Quiz 2 L6-L10

(Answer all questions in this section)

11. In Java what is casting?

When you remove an object instance. When you reset an object instance. Casting is not possible in Java.

When you take an Object of one particular type and turn it into another Object type. (*) Incorrect. Refer to Section 3 Lesson 9.

12. From your Greenfoot lessons, abstraction techniques can only be used once in a class's source code. True or false?

True False (*)

Correct

13. Use your Greenfoot knowledge: An array object holds a single variable. True or false?

True False (*)

Correct

14. From your Greenfoot lessons, which of the following are examples of actions that can be achieved using the while loop?

Create 50 instances of the Fly class. Call the move method 1 million times. Call the move and turn methods 10 times.

(14)

Create 100 instances of an Actor subclass. All of the above. (*)

Correct

15. In the Greenfoot IDE, what symbols indicate that the variable is an array?

Square brackets [ ] (*) Semicolon ;

Curly brackets { } Colon :

Correct

Previous

Page 3 of 3

Summary

Test: Section 6 Quiz

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 6 Quiz

(Answer all questions in this section)

1. What are exceptions used for in Java?

Correcting mistakes made in your code and handling extraordinary cases. (*)

Making the program easier to use for the user and reducing the possibilities of errors occuring. Exceptions have no use, they are just a part of the Java language.

(15)

Helping the interpreter compile code quicker and handle user interfaces.

Correct

2. Which of the following correctly matches the symbol with its function?

(Choose all correct answers)

= (single equals sign) compares the value of primitive types such as int or char. == (two equal signs) compares the values of non-primitive objects.

== (two equal signs) compares values of primitive types such as int or char. (*) .equals() compares the value of non-primitive objects. (*)

== (two equal signs) compares the memory location of non-primitive objects. (*)

Incorrect. Refer to Section 6 Lesson 2.

3. What does the interpreter look for when an exception is thrown?

A catch statement in the code. (*)

It does not look for anything. It just keeps reading through your code. It does not look for anything. It stops interpreting your code.

(16)

The end of the code.

Correct

4. Suppose you are writing a program where the user is prompted to the give coordinates where they believe the princess is inside of the castle.

Your program moves the prince to the coordinates that the user specified. If the princess is not found at those coordinates, the user is given a clue that helps them guess coordinates closer to the princess. The user is allowed to enter their new guess of where the princess is.

Assume your program does not take into consideration the possibility that the user may enter coordinates outside of the castle where the princess could not be. What would be the result of the user entering coordinates outside of the castle? How could this be handled in your code?

(Choose all correct answers)

An exception would occur. This could be handled by throwing the exception in your code if the user enters invalid coordinates. When the exception is caught, the prince could be moved to the coordinate inside the castle that is closest to those that the user specified. (*) An exception would occur. This could be handled by throwing an exception in your code if the user enters invalid coordinates. When the exception is caught, the user could be prompted to enter coordinates within the given range of the castle. (*)

An error would occur. Errors cannot be handled by code.

An exception would occur but could not be handled inside your code. The user would have to restart the program and enter proper coordinates.

Correct

5. A logic error occurs if an unintentional semicolon is placed at the end of a loop initiation because the interpreter reads this as the only line inside the loop, a line that does nothing. Everything that follows the semicolon is interpreted as code outside of the loop. True or false?

True

False (*)

(17)

Page 1 of 3

Ne

xt

Sum

mary

Test: Section 7 Quiz

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 7 Quiz

(Answer all questions in this section)

1. What does it mean to inherit a class?

Extending a method from a superclass. A way of organizing the hierarchy of classes.

The subclass (or child class) gains access to any non-private methods and variables of the superclass (or parent class). (*) The access specifier has been set to private.

(18)

2. If you inherit a class, you do not inherit the class' constructors. True or false?

True (*)

False

Incorrect. Refer to Section 7 Lesson 4.

3. It is possible to extend a class that already exists in Java, such as the Applet class. True or false?

True (*)

False

Correct

4. If Oak extends Tree, it is possible to declare an object such that

Tree grandfatherT = new Oak();

True or false?

True (*)

False

(19)

5. Consider the following method of the class Test:

public static List returnList(List list) {

return list; }

Which of the following program segments in Test's client class will compile with no errors?

I. List nums = new ArrayList(); nums = Test.returnList(nums);

II. ArrayList nums = new ArrayList(); nums = Test.returnList(nums);

III. ArrayList nums1 = new ArrayList(); List nums2 = Test.returnList(nums1);

I only I and III (*) II only II and III I, II, and III

Correct

Page 1 of 3

Next

Summary

(20)

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 7 Quiz

(Answer all questions in this section)

6. Which of the following are true about an abstract class?

(Choose all correct answers)

It is identified by the Java keyword abstract. (*) It is possible to create objects of this type. It is possible to create references of this type. (*)

The Java Virtual Machine does not differentiate abstract classes from concrete classes.

7. Public static variables can't have their value reset by other classes. True or false?

True

(21)

8. Static methods can return any object type. True or false?

True (*)

False

9. Static methods can write to class variables. True or false?

True (*)

False

10. The constructor method must always have at least one parameter. True or false?

True

(22)

Previous

Page 2of 3

Ne

xt

Sum

mary

Test: Section 7 Quiz

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 7 Quiz

(Answer all questions in this section)

11. Which of the following creates a method that compiles with no errors in the class?

(23)

12. A class can only have one constructor. True or false?

13. It is possible to return an object from a method. True or false?

(24)

15. Which of the following can be used as a parameter?

(Choose all correct answers)

(25)

References

Related documents