Unit 2 AP CSA Practice Quiz Part 1

Unit 2 AP CSA Practice Quiz Part 1

9th - 12th Grade

29 Qs

quiz-placeholder

Similar activities

**11th Grade Vocab  2

**11th Grade Vocab 2

11th Grade

25 Qs

NTSE 5 (2020-21)

NTSE 5 (2020-21)

9th - 10th Grade

25 Qs

C Programming

C Programming

12th Grade - University

25 Qs

Finite Linear Systems Test Review

Finite Linear Systems Test Review

12th Grade

28 Qs

Java Quiz

Java Quiz

10th - 12th Grade

24 Qs

Final Exam Review Avancemos, Spanish Level 1

Final Exam Review Avancemos, Spanish Level 1

10th - 11th Grade

25 Qs

Python ծրագրավորման լեզու

Python ծրագրավորման լեզու

9th Grade

27 Qs

PAT Informatika susulan MIPA

PAT Informatika susulan MIPA

10th Grade

30 Qs

Unit 2 AP CSA Practice Quiz Part 1

Unit 2 AP CSA Practice Quiz Part 1

Assessment

Quiz

Other

9th - 12th Grade

Medium

Created by

Madelynn Andino

Used 2+ times

FREE Resource

29 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

A teacher has created a Student class. The class contains the following.

  • An int variable called grade to represent the student’s grade level

    • A String variable called name to represent the student’s name

      • A double variable called average to represent the student’s grade point average

  • A method called updateAverage that updates the student’s average.

The object greg will be declared as type Student.

Which of the following descriptions is accurate?

greg is an instance of the Student class.


greg is an instance of three attributes.


greg is an instance of the updateAverage method.

Student is an instance of the greg object.

updateAverage is an instance of the Student class.

2.

MULTIPLE CHOICE QUESTION

3 mins • 1 pt

Consider the following description of the Thing class which includes two constructors.

public Thing() – Constructs a Thing object that uses a default value to represent a color

public Thing(String setColor) – Constructs a Thing object that uses setColor to represent a color

Which of the following code segments, when appearing in a class other than Thing, will create an instance variable of a Thing object with a value of null ?


private Thing someThing = new Thing()

private Thing someThing;

private Thing someThing = new Thing("Green");

private Thing("Green");

3.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

A student has created a Book class. The class contains variables to represent the following.

An int variable called pages to represent the number of pages

  • A boolean variable called isHardcover to indicate whether or not the book is hardcove

  • The object story will be declared as type Book.

Which of the following descriptions is accurate?

An instance of the story class is Book.

An instance of the Book object is story.

An attribute of the story object is isHardcover.

An attribute of the Book instance is story.

4.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

Media Image

Answer the following

An attribute of the penelope object is email.

An attribute of the mrsPatel object is studentName.

An attribute of the mrsPatel object is email.


An attribute of the penelope object is Parent.

5.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

Media Image

Answer the following

VetRecord(String name, int weight, int age)

VetRecord(String name, int age)

VetRecord(int age, boolean needsVac)

VetRecord(int age, int weight)

6.

MULTIPLE CHOICE QUESTION

3 mins • 1 pt

Media Image

Answer the following


I only


II only


I and II only


II and III only

7.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

Media Image

Answer the following


I only



II and III only

None of the code segments will compile.

II only

Answer explanation

Correct. Code segment I will not compile. To call a nonstatic method outside the MagicNumber class, a MagicNumber object must be created and the nonstatic method must be called using the dot operator on the object name. Code segment II will compile successfully, as it first creates an object of the class MagicNumber and then uses the dot operator to call nonstatic methods that manipulate an instance variable of that object. Code segment III will not compile because the variable n2 has not been properly declared and initialized.

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?