
AP CSA Strings Review
Authored by Anthony Villanueva
Computers
12th Grade
Used 19+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
15 mins • 1 pt
Given the following code segment, which of the following is true?
String s1 = new String("Hi There");
String s2 = new String("Hi There");
String s3 = s1;
I. (s1 == s2)
II. (s1.equals(s2))
III. (s1 == s3)
IV. (s2.equals(s3))
II and IV
II, III, and IV
I, II, III, IV
II only
IV only
2.
MULTIPLE CHOICE QUESTION
5 mins • 1 pt
What does the following code print?
System.out.println("13" + 5 + 3);
21
1353
It will give a run-time error
138
It will give a compile-time error
Check MeCompare me
3.
MULTIPLE CHOICE QUESTION
5 mins • 1 pt
After the following code is executed, which of I, II and/or III will evaluate to true?
String s1 = "xyz";
String s2 = s1;
String s3 = s2;
I. s1.equals(s3)
II. s1 == s2
III. s1 == s3
I, II, III
I only
II only
III only
II and III only
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is output from the following code?
String s = "Georgia Tech";
String s1 = s.substring(0,7);
String s2 = s1.substring(2);
String s3 = s2.substring(0,3);
System.out.println(s3);
org
eor
eorg
orgi
You will get an index out of bounds exception
5.
MULTIPLE CHOICE QUESTION
5 mins • 1 pt
Given the following code segment, what is the value of s1 after the code executes?
String s1 = "Hi There";
String s2 = s1;
String s3 = s2;
String s4 = s1;
s2 = s2.toLowerCase();
s3 = s3.toUpperCase();
s4 = null;
null
hi there
HI THERE
Hi There
hI tHERE
6.
MULTIPLE CHOICE QUESTION
5 mins • 1 pt
There is a method called checkString that determines whether a string is the same forwards and backwards. The following data sets can be used for testing the method. What advantage does Data Set 2 have over Data Set 1?
Data Set 1 Data Set 2
aba bcb
abba bcd
aBa
Data Set 2 contains one string which should return true and one that should return false.
All strings in Data Set 2 have the same number of characters.
The strings in Data Set 2 are all lowercase
Data Set 2 contains fewer values than Data Set 1.
There are no advantages.
7.
MULTIPLE CHOICE QUESTION
5 mins • 1 pt
Given the following code segment, what is in the string referenced by s1?
String s1 = "xy";
String s2 = s1;
s1 = s1 + s2 + "z";
xyz
xyxyz
xy xy z
xy z
z
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
10 questions
Binary, Bits and Bytes
Quiz
•
9th - 12th Grade
10 questions
ôn giưa ki 2 tin12
Quiz
•
12th Grade
10 questions
Javascript & Client side scripting
Quiz
•
10th - 12th Grade
15 questions
Grade 12-Python selection&iteration
Quiz
•
11th - 12th Grade
9 questions
1.1.2. Types of Processor
Quiz
•
12th Grade
14 questions
Kiểu dữ liệu xâu kí tự - xử lí xâu kí tự
Quiz
•
9th - 12th Grade
15 questions
Lua Review Corona SDK with Notepad++
Quiz
•
10th - 12th Grade
13 questions
Python Fundamentals and Programming
Quiz
•
11th - 12th 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