![placeholder image to represent content](/_next/image?url=%2Fassets%2Fquiz_default_logo.jpg&w=256&q=75)
Review Quiz
Quiz by Praise Apata
Feel free to use or edit a copy
includes Teacher and Student dashboards
Measure skillsfrom any curriculum
Tag the questions with any skills you have. Your dashboard will track each student's mastery of each skill.
- edit the questions
- save a copy for later
- start a class game
- automatically assign follow-up activities based on students’ scores
- assign as homework
- share a link with colleagues
- print as a bubble sheet
- Q1
What are parameters?
The type that is given to a variable
The formal values that a method prints to the screen
The value that a method returns
The formal names given to the data that gets passed into a method
60s - Q2
A procedure that is defined by the user is called a
keyword
variable type
method
variable
60s - Q3
All non-void methods must have which of the following?
An argument
A parameter
A print statement
A return value
60s - Q4
What is true of a void method?
It can take any parameter
It returns no value
It takes no parameters
It returns any value
60s - Q5
What does this method call doubleNumber(7.8); return, given the following method?
public double doubleNumber(double myNumber){
return (double) (int) myNumber * 2;
}
14.0
15.0
This method is improperly written
16
15.6
60s - Q6
What does the method call mystery("APCSA"); return for the following method?
public String mystery(String x){
return x * 3;
}
APCSA APCSA APCSA
APCSAAPCSAAPCSA
This method is improperly written
APCSA 3
APCSA3
120s - Q7
What will the value of myBankAccount be after the method call depositMoney(myBankAccount, 572);?
int myBankAccount = 122;
public void depositMoney(int bankAccount, int deposit){
bankAccount += deposit;
}
572
694
The code will result in an error
122
30s - Q8
What is returned by this method call: translator("pokemon")?
public String translator(String word){
return word.substring(1) + word.substring(0,1) + "ay";
}
This method call will result in an error
"okemonay"
"okemonpay"
"pokemonpay"
120s - Q9
What will this method call print to the screen?
public static void formatText(int a, int b, String c){
System.out.println(b + " " + c + ", " + a);
}
formatText(2018, 17, "Dec")
Dec 17 2018
17 Dec 2018
17 Dec, 2018
Dec 17, 2018
120s - Q10
What is wrong with this method definition?
public int printPayAmount(int amount){
System.out.println(amount);
}
This is a String type method
Nothing is returned from this method
This method should be private
The method is never called
120s - Q11
A coffee shop has created a DrinkOrder class. The class contains variables to represent the following:
- A String variable called name to represent the name of the drink.
- An int variable called ounces to indicate how many ounces the drink should be.
- A boolean variable called isIced to indicate whether the drink is iced.
- An object latte has been declared as type DrinkOrder after someone has ordered a Latte.
Which of the following descriptions is accurate?
An attribute of latte is DrinkOrder
An instance of latte is DrinkOrder
An attribute of DrinkOrder is latte
An instance of the DrinkOrder class is latte
An attribute of name is latte.
300s - Q12
After the execution of the following lines of code, what will be output onto the console?
String letters = "ABCde";
String name = "Karel the Dog";
String letter = "D";
System.out.println(name.indexOf(letter));
System.out.println(letters.indexOf(name.substring(3,4)));
System.out.println(letters.indexOf(letter));
-1
7
10
10
3
-1
0
4
-1
10
4
-1
10
7
3
300s - Q13
Which of the following code segments would successfully square the minimum value between two int variables x, y?
Math.pow(Math.min(x, y));
Math.min(Math.pow(x, y));
Math.pow(Math.min(x, y), 2);
Math.pow(2, Math.min(x, y));
120s - Q14
Consider the following code segment:
String str = "I am";
str += 10 + 3;
String age = "years old";
System.out.println(str + age);
What is printed as a result of executing the code segment?
I am 13 years old
I am13years old
I am 103 years old
I am103years old
years oldI am 13
120s - Q15
A science teacher wants to create an Elements class for the Periodic Table. They want to include several attributes to the Elements class: the atomic weight, the element name, and the atomic number for the element.
For example, if you wanted to create an entry for Oxygen you would use the following data:
Name: Oxygen
Atomic Weight: 15.999
Atomic Number: 8
Which of the following instance variables makes the most sense based on these attributes?
private int atomicWeight;
private String name;
private double atomicNum;
private double atomicWeight;
private String name;
private double atomicNum;
private double atomicWeight;
private String name;
private int atomicNum;
private int atomicWeight;
private String name;
private int atomicNum;
300s