
Unit 2 AP CSA Practice Quiz Part 1

Quiz
•
Other
•
9th - 12th Grade
•
Medium
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
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
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
Answer the following
I only
II only
I and II only
II and III only
7.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
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
Similar Resources on Wayground
26 questions
🏰 HW #12 (2/5-2/11)

Quiz
•
11th Grade
30 questions
3Q TLE 10 Summative Assessment 2

Quiz
•
10th Grade
30 questions
Spanish One chapter two (1)

Quiz
•
12th Grade
25 questions
IQ quiz for Grade 4

Quiz
•
4th Grade - University
25 questions
School-Connect 4.0= Module 3: Boosting Academics & Motivation

Quiz
•
9th Grade
26 questions
Introduction to Arduino

Quiz
•
10th - 12th Grade
25 questions
PARCC Review

Quiz
•
KG - University
25 questions
Knowing Products & Services/Knowing the Customer

Quiz
•
11th - 12th Grade
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
10 questions
UPDATED FOREST Kindness 9-22

Lesson
•
9th - 12th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
20 questions
US Constitution Quiz

Quiz
•
11th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Other
10 questions
Video Games

Quiz
•
6th - 12th Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
UPDATED FOREST Kindness 9-22

Lesson
•
9th - 12th Grade
20 questions
US Constitution Quiz

Quiz
•
11th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
24 questions
Scientific method and variables review

Quiz
•
9th Grade
20 questions
Biomolecules

Quiz
•
9th Grade
6 questions
Rule of Law

Quiz
•
6th - 12th Grade