
AP Comp Sci Final Review (part I)
Authored by Michael Courtright
Computers
9th - 12th Grade
Used 5+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
12 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Class, objects, arrays and Strings are examples of:
nonprimitive data types
primitive data types
inheritance
arrays
recursion
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Downcasting, super(), super, extends, interface and implements are examples of:
nonprimitive data types
primitive data types
inheritance
arrays
recursion
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
enhanced for, nested loop, index and length are examples of:
nonprimitive data types
primitive data types
inheritance
arrays
recursion
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
self-calling, base case and StackOverflowException are examples of:
nonprimitive data types
primitive data types
inheritance
arrays
recursion
5.
MULTIPLE CHOICE QUESTION
3 mins • 1 pt
class MCQReview{
int x;
int y;
MCQReview(int x, int y){
this.x = x;
this.y = y; }
void method(){
x += x++ - y/2 + ++y; }
void display(){
System.out.println("x is: " + x);
System.out.println("y is: " + y); }
public static void main(String[] args){
MCQReview m1 = new MCQReview(10,20);
m1.method();
m1.display(); }
}
What will be the output of the above code segment?
x is: 32
y is: 20
x is: 30
y is: 21
x is: 32
y is: 21
x is: 30
y is: 20
x is: 31
y is: 21
Answer explanation
x = 10, y =20
x += x++ - y/2 + ++y;
According to operator precedence and operator associativity,
x = x+ (x++ - y/2 + ++y);
x = 10 + (10 - 20/2 + 21) // internally y and x are incremented by 1
x = 10 + ( 10 - 10 +21) = 10 + (0 +21) = 31
x ++ will first substitute and then increment, whereas ++y will first increment and then substitute.
6.
MULTIPLE CHOICE QUESTION
3 mins • 1 pt
class MCQReview2{
int x; static int y;
void display(){
System.out.println("x is: " + x);
System.out.println("y is: " + y); }
public static void main(String[] args){
MCQReview2 m1 = new MCQReview2();
MCQReview2 m2 = new MCQReview2();
m1.x = 2;
m1.y = 3;
m2.x = 4;
m2.y = 5;
m1.display();
m2.display(); } }
What will be the output of the above code segment?
x is: 4
y is: 3
x is: 4
y is: 5
x is: 2
y is: 3
x is: 2
y is: 3
x is: 2
y is: 5
x is: 4
y is: 5
x is: 2
y is: 4
x is: 3
y is: 5
x is: 2
y is: 3
x is: 4
y is: 5
Answer explanation
x is: 2
y is: 5
x is: 4
y is: 5
The variable y, being static, is a shared copy for all the objects. If one object alters the value, it will modify for both of the objects. The variable x is nonstatic, which means that it is an instance variable, a different copy for different objects.
7.
MULTIPLE CHOICE QUESTION
3 mins • 1 pt
Assuming that a and b are declared as valid integer values, which of the following is an equivalent statement for the Java statement below?
(x > 5 && x < 8) || (x > 0 || y < 0)
((x > 0) || (x > 5 && x < 8)) || (y < 0)
(x > 5 && x < 8) && (x > 0)
(y < 0) || (x > 5 && x < 8)
(x < 0 && y > 0) && (x < 5 || x > 8)
Answer explanation
((x > 0) || (x > 5 && x < 8)) || (y < 0)
Using the commutative property, the terms can be switched while maintaining the value. The || operator is used with the commutative property, and the expression with && remains together to follow the laws of logic.
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
17 questions
Traffic Light Project Quiz
Quiz
•
9th Grade
10 questions
Sprawdź się
Quiz
•
4th - 12th Grade
10 questions
Bài 25 tin 10
Quiz
•
9th Grade - University
15 questions
Arduino
Quiz
•
7th - 9th Grade
10 questions
TIN HỌC 10 - BÀI 21
Quiz
•
10th Grade
12 questions
Tin học 2
Quiz
•
11th Grade
10 questions
4Q Week3 Review Quiz (Who missed the Quiz ONLY))
Quiz
•
9th Grade
10 questions
Quiz Excel 3
Quiz
•
10th Grade
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
10 questions
Probability Practice
Quiz
•
4th Grade
15 questions
Probability on Number LIne
Quiz
•
4th Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
6 questions
Appropriate Chromebook Usage
Lesson
•
7th Grade
10 questions
Greek Bases tele and phon
Quiz
•
6th - 8th Grade
Discover more resources for Computers
10 questions
Exploring Digital Citizenship Essentials
Interactive video
•
6th - 10th Grade
14 questions
[AP CSP] JavaScript Programming Quiz
Quiz
•
9th - 12th Grade
10 questions
Understanding Computers and Computer Engineering
Interactive video
•
7th - 12th Grade
37 questions
Python - Tuples, Lists, and List Methods
Quiz
•
9th - 12th Grade
60 questions
MOS Word Home, Insert, Reference Ribbon Basics
Quiz
•
9th Grade