ShmoopTube

Where Monty Python meets your 10th grade teacher.

Search Thousands of Shmoop Videos

AP Computer Science 4.3 Review of the Basics 187 Views


Share It!


Description:

APCS: Review of the Basics Drill 4, Problem 3. Which of the following correctly constructs the string ShmOOP?

Language:
English Language

Transcript

00:00

Thank you We sneak And here's your shmoop du jour

00:05

brought to you by the schlep Sue sub stringer eight

00:08

thousand It slices trims fillets chops cuts stabs folks scratches

00:13

and oh so much more order Now our operators are

00:17

waiting for your call All right consider the following declaration

00:25

Which of the following correctly constructs this string Shmoop i

00:31

didn't hear the financial and all right oz waiver and

00:36

let's go ah String operations sure in all practicality we

00:41

couldjust say that string j equals shmoop but there's no

00:45

fun to be had in that in this case we're

00:47

being asked to combine slice and dice strings a through

00:50

d to successfully make shmoop as we go down the

00:54

line we're going to rely on the sub string method

00:57

which lets us isolate and use characters of our choosing

01:00

from a given string Well the sub string method is

01:03

given to parameters whenever it's called begin index and the

01:06

end index which indicate the specific characters inside the string

01:10

we want to use for example let's take option a

01:13

option a wants us to take the contents of string

01:16

a show and added to a sub string of string

01:20

See indexes begin with the Numbers 0 rather than 1

01:24

right So the begin index of three means we count

01:27

from left zero one two three like this we're starting

01:31

at zero The thing about the end index is that

01:34

we only go up to that number and don't included

01:37

in the substrate being that end Index's five well let's

01:40

count it up zero one Two three four five and

01:44

p is number five in the index but we don't

01:47

get to include it This gets us to shmoop which

01:52

is no good Option b is a sub string of

01:55

c combined with the entire string d right here begin

01:59

index here is zero so we're starting from the beginning

02:01

of string see the end indexes to someone count zero

02:04

one two and remember we don't get to keep the

02:07

character at the end index we're just getting from this

02:10

bit add to that entire string d and we just

02:14

get shoot not this one was missing it Option c

02:19

is just a simple combination of string a followed by

02:22

string see commission anyone feel like it's wheel of fortune

02:28

here in bizarro land all right option d could be

02:31

promising a couple of sub string operations while the first

02:35

one is a sub string of string be starting at

02:37

character one which is a church It'll never get us

02:41

to where we need to be so it's not deep

02:44

option e option is a sub string of string viet

02:47

index is zero and three and a sub string of

02:51

tea also in zero and three So let's see stringbean

02:54

deck zero means we start at the beginning We'll end

02:57

indexes three so zero one two three and we get

03:01

stringed ian deck zero then zero one two three again

03:05

and we get coop Combine the two and we get

03:08

moved Who Well but that's Not all Call now and

03:11

we'll throw in an additional sub string three thousand at

03:14

no additional cost Just pay shipping and handling one blade

03:17

for each hand means twice the slicing speed and quadruple 00:03:20.285 --> [endTime] the danger Operator's Not really waiting

Up Next

AP Computer Science 1.2 GridWorld Case Study and APIs
493 Views

AP Computer Science 1.2 GridWorld Case Study and APIs. What is the direction of the actor?

Related Videos

AP Computer Science 1.4 Standard Algorithms
200 Views

AP Computer Science 1.4 Standard Algorithms. How many times will mystery be called for mystery(n) for n > 1?

AP Computer Science 2.3 Classes and Objects
191 Views

AP Computer Science 2.3 Classes and Objects. Which of the following is correct implementation of the Country class?

AP Computer Science 3.4 Inheritance, Abstraction, and Polymorphism
204 Views

AP Computer Science 3.4 Inheritance, Abstraction, and Polymorphism. Which of the following will satisfy the conditional if statement for boo, str,...

AP Computer Science 4.2 Standard Algorithms
191 Views

AP Computer Science 4.2 Standard Algorithms. What kind of algorithm is the following?