AP Computer Science A Void

Quiz
•
Computers
•
8th - 12th Grade
•
Medium
ALPA DANI
Used 28+ times
FREE Resource
5 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is an instance method?
An instance method is a piece of code called on a specific instance (an object) of the class.
An instance method is a piece of code that does not depend on any specific instances (objects), just on the general class.
An instance method adds functionality to a class by creating private fields.
An instance method adds functionality to the class by printing out a result.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is a correctly written method for the class below?
public class Timer
{
private int startMin;
private int length;
public Timer(int minute, int duration)
{
startMin = minute;
length = duration;
}
public Timer(int duration)
{
startMin = 0;
length = duration;
}
}
public void addFiveMinutes()
{
length = length + 5;
}
public addFiveMinutes()
{
length = length + 5;
}
addFiveMinutes()
{
length = length + 5;
}
public void addFiveMinutes
{
length = length + 5;
}
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following correctly calls the method addFiveMinutes on an object of the Timer class called kitchenTimer?
kitchenTimer(addFiveMinutes)
Timer.addFiveMinutes()
kitchenTimer.addFiveMinutes()
kitchenTimer.addFiveMinutes
Answered
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Suppose the class Timer has a method called startTime that prints out the starting time of the Timer.
Which of the following correctly uses this method to print out the start time of a Timer object called laundry?
System.out.println(laundry.startTime());
System.out.println(laundry.startTime);
int start = laundry.startTime();
laundry.startTime();
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
A Timer class is a class that represents a minute timer. A partial definition of the class is given below.
public class Timer
{
private int length;
public Timer(int duration)
{
length = duration;
}
public void endTime()
{
System.out.print("The timer will end in " );
System.out.print(length);
System.out.println(" minutes");
}
public void addFiveMinutes()
{
length = length + 5;
}
}
What is the output of the following main method?
public static void main(String[] args){
Timer muffins = new Timer(30);
muffins.endTime();
muffins.addFiveMinutes();
muffins.endTime();
}
The timer will end in 30 minutes
The timer will end in 30 minutes
The timer will end in 35 minutes
The timer will end in 30 minutes
The timer will end in 30 minutes
This method won’t print anything because it doesn’t have any print statements.
Similar Resources on Wayground
10 questions
Logic Building in Java Part 1

Quiz
•
6th - 9th Grade
10 questions
AP CS A Unit 6 Quiz PRACTICE

Quiz
•
9th - 12th Grade
10 questions
Programming in Java

Quiz
•
8th Grade
10 questions
Programming Basics

Quiz
•
11th - 12th Grade
10 questions
Latihan Interface

Quiz
•
9th - 12th Grade
8 questions
Algorithms / Methods

Quiz
•
9th Grade
10 questions
Simulasi 4

Quiz
•
10th Grade
8 questions
Topics 7 & 8 - Static Methods/Variables and Null Keyword

Quiz
•
12th Grade
Popular Resources on Wayground
18 questions
Writing Launch Day 1

Lesson
•
3rd Grade
11 questions
Hallway & Bathroom Expectations

Quiz
•
6th - 8th Grade
11 questions
Standard Response Protocol

Quiz
•
6th - 8th Grade
40 questions
Algebra Review Topics

Quiz
•
9th - 12th Grade
4 questions
Exit Ticket 7/29

Quiz
•
8th Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
19 questions
Handbook Overview

Lesson
•
9th - 12th Grade
20 questions
Subject-Verb Agreement

Quiz
•
9th Grade
Discover more resources for Computers
11 questions
Hallway & Bathroom Expectations

Quiz
•
6th - 8th Grade
11 questions
Standard Response Protocol

Quiz
•
6th - 8th Grade
40 questions
Algebra Review Topics

Quiz
•
9th - 12th Grade
4 questions
Exit Ticket 7/29

Quiz
•
8th Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
19 questions
Handbook Overview

Lesson
•
9th - 12th Grade
20 questions
Subject-Verb Agreement

Quiz
•
9th Grade
40 questions
LSHS Student Handbook Review: Pages 7-9

Quiz
•
11th Grade