AP CSA Unit 2 Review

Flashcard
•
Computers
•
10th - 12th Grade
•
Hard
Wayground Content
FREE Resource
Student preview

30 questions
Show all answers
1.
FLASHCARD QUESTION
Front
Consider the following code segment.
System.out.println("W");
System.out.println("X");
System.out.print("Y");
System.out.print("Z");
What is printed as a result of executing the code segment?
Back
W
X
YZ
2.
FLASHCARD QUESTION
Front
Consider the following code segment:
String str = "AP";
str += "CS " + 1 + 2;
System.out.println(str);
What is printed as a result of executing the code segment?
Back
APCS 12
3.
FLASHCARD QUESTION
Front
Consider the following code segment.
String one = "ABC123";
String two = "C";
String three = "3";
System.out.println(one.indexOf(two));
System.out.println(one.indexOf(three));
System.out.println(two.indexOf(one));
What is printed when the code segment is executed?
Back
2
5
-1
4.
FLASHCARD QUESTION
Front
What is printed when the following code segment is executed?
public double calculate(double x)
{
return x + 1.5;
}
Double d1 = new Double(7.5);
System.out.println(calculate(d1));
Back
9.0
5.
FLASHCARD QUESTION
Front
Consider the following code segment, which is intended to display 6.0.
double fact1 = 1 / 2;
double fact2 = 3 * 4;
double product = fact1 * fact2;
System.out.println(product);
Which of the following best describes the error, if any, in the code segment? Options:
There are no errors and the code works as intended.
Either the numerator or the denominator of the fraction 1 / 2 should be cast as double.
The expression fact1 * fact2 should be cast as double.
The expressions 1 / 2 and 3 * 4 should both be cast as double.
The variables fact1 and fact2 should both be declared as int.
Back
Either the numerator or the denominator of the fraction 1 / 2 should be cast as double.
6.
FLASHCARD QUESTION
Front
Java has 8 primitive data types, which of the following best describes the int datatype?
Back
An int can be stored with 32 bits of memory.
7.
FLASHCARD QUESTION
Front
Is the Main() method mandatory for a Java program?
Back
No, the Main() method is not mandatory for a Java program.
Create a free account and access millions of resources
Similar Resources on Wayground
20 questions
AP CSA unit 1 review

Flashcard
•
11th Grade - University
28 questions
Units 1 to 6: Mock Exam Final - AP Computer Science A

Flashcard
•
9th - 12th Grade
25 questions
MW CodeHS Basic Java Review for test

Flashcard
•
8th - 12th Grade
21 questions
C.P. - Flashcard #2 - Review

Flashcard
•
9th - 12th Grade
24 questions
Java String class methods

Flashcard
•
10th - 12th Grade
21 questions
Java Math class methods (PAW)

Flashcard
•
10th - 12th Grade
25 questions
JavaScript Console & Graphics Review

Flashcard
•
9th - 12th Grade
21 questions
Java Loops

Flashcard
•
KG
Popular Resources on Wayground
55 questions
CHS Student Handbook 25-26

Quiz
•
9th Grade
10 questions
Afterschool Activities & Sports

Quiz
•
6th - 8th Grade
15 questions
PRIDE

Quiz
•
6th - 8th Grade
15 questions
Cool Tool:Chromebook

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

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
20 questions
Bullying

Quiz
•
7th Grade
18 questions
7SS - 30a - Budgeting

Quiz
•
6th - 8th Grade