Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Strings

Total questions: 8

Worksheet time: 5mins

Name
Class
Date
1.

Which method to use to find length of a string?

a)

length()

b)

size()

c)

long()

d)

count()

2.

Which is correct method to convert String into uppercase

a)

changeUpperCase()

b)

convertUpperCase()

c)

toUpper()

d)

toUpperCase()

3.

String x = "10"

String y = "20"

String z = x + y

Console.Writeline(z)

Guess the output.

a)

1020

b)

10 20

c)

30

d)

"10 20"

4.

What will be the output of below code?

String statement = "Outfit of the day";

Console.Writeline(statement.Substring(3))

a)

f

b)

fit of the day

c)

t

d)

tfit of the day

5.

What is the correct relation between length and last index of the string?

a)

last-index is always 1 more than the length

b)

last-index is 1 less than the length (but not always)

c)

last-index is always 1 less than the length

d)

last-index is always equal to the length

6.
String word = "A few good men";
What is word.length()?
a)
14
b)
15
c)
13
7.

String x = "quarantine";

What is the value of x.indexOf("a"); ?

a)

4

b)

3

c)

2

d)

5

8.

String s = "whatever"

What is the value of s.substring(1,3)?

a)

"hate"

b)

"hat"

c)

"whate"

d)

"what"