Unit 1 CSA Code

Unit 1 CSA Code

12th Grade

6 Qs

quiz-placeholder

Similar activities

CS A Unit 1 Review

CS A Unit 1 Review

Unit 1

Unit 1

CSA - Final Review

CSA - Final Review

AP CSA | U1: Object-Oriented Programming By Mr. Benvenuto

AP CSA | U1: Object-Oriented Programming By Mr. Benvenuto

Java Inheritance and Method Quiz

Java Inheritance and Method Quiz

AP CSA Unit 1 Review

AP CSA Unit 1 Review

AP CSA Unit 9 - Inheritance

AP CSA Unit 9 - Inheritance

Unit 1 CSA Code

Unit 1 CSA Code

Assessment

Quiz

Computers

12th Grade

Medium

Created by

Gareth Yeoman

Used 3+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

6 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 5 pts

A Painter object called myPainter is facing north. Consider the following code segment.

while (!myPainter.isFacingSouth()) {

myPainter.turnLeft();

}

myPainter.turnLeft();

The effect of this code is that the myPainter object is now:

facing north

facing east

facing west

facing south

Answer explanation

This code runs you will turnLeft until you face south. Once you face south you will turnLeft 1 time in this example. This means you will face east.

2.

MULTIPLE CHOICE QUESTION

30 sec • 5 pts

Which of the following is a TRUE statement about constructors in Java?

The constructor contains all of the methods that an object can utilize.

The constructor is used to create objects of a class.

The constructor should not have the same name as the class.

In inheritance, the parent class should always contain the keyword super.

3.

MULTIPLE CHOICE QUESTION

30 sec • 5 pts

A Painter object called myPainter is initially facing east. Consider the following code segment.

while (myPainter.canMove()) {

myPainter.move(); }

After the loop has terminated, which of the following MUST be true?

The Painter object is blocked from moving north.

The Painter object is blocked from moving south.

The Painter object is blocked from moving east.

The Painter object will crash into an object or wall.

Answer explanation

When painter can move it will continue until it runs into a wall

4.

MULTIPLE CHOICE QUESTION

30 sec • 5 pts

Which of the following are inherited when one class extends another?

I. private attributes

II. public constructors

III. public methods

  II and III

I and II

III only

I only

5.

MULTIPLE CHOICE QUESTION

30 sec • 5 pts

Consider the following class headers.

public class Food { //implementation not shown }

public class Dessert extends Food { //implementation not shown }

public class Cookie extends Dessert { //implementation not shown }

Which statement below is true regarding the class declarations?

I. Food is a subclass of Cookie

II. Dessert is a superclass of Cookie

III. Cookie is a subclass of Dessert

IV. Cookie is a superclass of Food

II and III

II and IV

I and II

III only

6.

MULTIPLE CHOICE QUESTION

30 sec • 5 pts

Which of the following evaluates to false?

I. true

II. !true

III. false

IV. !false

III and IV

II and III

I and IV

III only