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
Python Data Types

Quiz
•
9th - 12th Grade
10 questions
Java: repetition control structure for & while

Quiz
•
10th - 12th Grade
6 questions
Java 8 (Массивы)

Quiz
•
8th Grade
10 questions
Variabel dan Tipe Data

Quiz
•
10th Grade
10 questions
Викторина по Python (Урок 1-2)

Quiz
•
5th - 11th Grade
10 questions
C# Data Types

Quiz
•
10th Grade
10 questions
Простые типы данных в С++

Quiz
•
10th Grade
10 questions
Quiz Bloque 3 - Decimo Grado

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

Quiz
•
6th - 12th Grade
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
15 questions
Core 4 of Customer Service - Student Edition

Quiz
•
6th - 8th Grade
15 questions
What is Bullying?- Bullying Lesson Series 6-12

Lesson
•
11th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
18 questions
Company Logos

Quiz
•
6th - 8th Grade
10 questions
Proper Keyboarding Techniques

Interactive video
•
6th - 10th Grade
14 questions
Inputs and Outputs: Computer Science Intro

Lesson
•
5th - 9th Grade
10 questions
Understanding Computers: Hardware, Software, and Operating Systems

Interactive video
•
7th - 12th Grade
29 questions
AP CSP Unit 2 Review (Code.org)

Quiz
•
10th - 12th Grade