apcsa-String

apcsa-String

11th Grade

12 Qs

quiz-placeholder

Similar activities

Data Type Review

Data Type Review

KG - Professional Development

12 Qs

Practice for 8th AP Java Quiz

Practice for 8th AP Java Quiz

10th - 12th Grade

14 Qs

Python Basics

Python Basics

KG - University

16 Qs

ONG LẤY MẬT

ONG LẤY MẬT

9th - 12th Grade

10 Qs

Bài 12. KIỂU XÂU- part 1

Bài 12. KIỂU XÂU- part 1

11th Grade

7 Qs

Substring

Substring

9th - 12th Grade

12 Qs

TIN 11- KIỂU XÂU

TIN 11- KIỂU XÂU

11th Grade

10 Qs

Kiểu dữ liệu xâu kí tự - xử lí xâu kí tự

Kiểu dữ liệu xâu kí tự - xử lí xâu kí tự

9th - 12th Grade

14 Qs

apcsa-String

apcsa-String

Assessment

Quiz

Computers

11th Grade

Medium

Created by

lin fu

Used 6+ times

FREE Resource

12 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 5 pts

Consider s1 and s2 are String:

       s1 = "aardvark";

  s2 = s1.substring(4);

What does s2 get?

dvar

vark

ark

dvark

2.

FILL IN THE BLANK QUESTION

1 min • 10 pts

Assume the following declaration exists:

String qqq = "Haleakala";

 What will be output after the statement executed

    System.out.println(qqq.substring(5,9));

3.

FILL IN THE BLANK QUESTION

1 min • 10 pts

Assume the following declaration exists:

   

    String qqq = "Haleakala";

    int  index= qqq.indexOf("leak");

What is the value of index?

4.

FILL IN THE BLANK QUESTION

1 min • 10 pts

Assume the following declaration:

String kkk=“princess”;

String yyy=“princesS”;

 int   x=kkk.compareTo(yyy);

What is the value of x then?

(tip:返回ascII码差值,小写a是97, 大写A是65)

5.

FILL IN THE BLANK QUESTION

1 min • 10 pts

Suppose:

 String name=“Mississippi”;

 int length=name.length();

What is the value of length?

6.

FILL IN THE BLANK QUESTION

1 min • 10 pts

What is the index value of character “d”  in string “Amanda”?

7.

MULTIPLE CHOICE QUESTION

2 mins • 10 pts

Suppose that strA=”TOMATO”, strB=”tomato”, and strC=”tom”. Given that “A” comes before “a” in dictionary order, which is true?

strA.compareTo(strB)<0  && strB.compareTo(strC)<0

strB.compareTo(strA)<0 || strC.compareTo(strA)<0

strC.compareTo(strA)<0  && strA.compareTo(strB)<0

!(strA.equals(strB)) && strC.compareTo(strB)<0

Answer explanation

D。strB比strC大三,因为多三个字母,如果strB是 tomato22, 那么他比strC大5, 因为多5个字母。反之是-3;

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?