Search Header Logo

Strings in Swift

Authored by Shashidhara S

Information Technology (IT)

University

Used 1+ times

Strings in Swift
AI

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

30 sec • 1 pt

Which property of the string is used get number of characters?

length

length()

count

count()

2.

MULTIPLE SELECT QUESTION

45 sec • 3 pts

which method/methods is/are used to find the substrings in a given string?

hasPrefix()

contains()

prefix(n)

getChars(n)

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

We can have an empty character

True

False

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

let name = "Ethan Hunt"

print(name.first)

output is ?

E

Ethan

optional(E)

compiler error

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

let pokemon = "poke\u{0301}mon"

print(Pokemon.count)

output is ?

7

8

14

none

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

let kid = "Miles Morales"

print(kid[kid.index(kid.startIndex, offsetBy:3)]

output is ?

e

Optional(e)

l

optional(l)

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

let scarlet = "Wanda Maximoff"

print(scarlet.substring(to:scarlet.firstIndex(of:" ")!)

output is :

Wanda

W

Maximoff

Compiler Error

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?