Comp Sci Review

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

String s1 = "xyz"; String s2 = s1; String s3 = s2; I. s1.equals(s3) II. s1 == s2 III. s1 == s3

I, II, III

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.

String s1 = "hi"; String s2 = "bye"; String s3 = new String("hi");

!(s1 == s2) && !(s1 == s3)

String s1 = new String("hi there"); int pos = s1.indexOf("e"); String s2 = s1.substring(0,pos);

hi th

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, III, and IV

String s1 = "Hi"; String s2 = s1.substring(0,1); String s3 = s2.toLowerCase();

h

String s1 = "abccba"; int pos = s1.indexOf("b");

1

String s1 = "Hi There"; String s2 = s1; String s3 = s2; String s4 = s1; s2 = s2.toLowerCase(); s3 = s3.toUpperCase(); s4 = null;

Hi There

String s1 = "Miss you!"; int len = s1.length();

9

What is the value of s1 after the following code executes? String s1 = "Hey"; String s2 = s1.substring(0,1); String s3 = s2.toLowerCase();

Hey

String s1 = "Hi"; String s2 = s1.substring(0,1); String s3 = s2.toLowerCase();

Hi

System.out.println("13" + 5 + 3);

1353

String s1 = "baby"; String s2 = s1.substring(2);

aby

String s1 = "baby"; String s2 = s1.substring(0,3);

bab

String s1 = "Hi"; String s2 = "Bye"; int answer = s1.compareTo(s2);

positive (> 0)

Given the following code segment, what is in the string referenced by s1? String s1 = "xy"; String s2 = s1; s1 = s1 + s2 + "z";

xyxyz

What is the value of len after the following executes? String s1 = "Hey, buddy!"; int len = s1.length();

11

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

String s1 = "hi"; String s2 = "bye"; String s3 = "hi";

s1 == s2 && s1 == s3

Which of the following is true after the code executes? String s1 = new String("hi"); String s2 = "bye"; String s3 = "hi"; s2 = s1;

s1 == s2 && s1.equals(s3)

What is the value of pos after the following code executes? String s1 = "ac ded ca"; int pos = s1.indexOf("d");

3

String s1 = "baby"; int len = s1.length();

4


संबंधित स्टडी सेट्स

Business Statistics - Chapter 5: Discrete Probability Distributions Quiz

View Set

Pure Monopoly Asarta Module Russell B

View Set

أسئلة الفصل الثالث - أكمل

View Set

Marketing research chapter 6 smart book

View Set

Chapter 1: The Nature of Fashion

View Set