0% found this document useful (0 votes)
79 views7 pages

Graded Quiz Unit 6 - Home

CS 4405 Quizzes

Uploaded by

deronsammy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
79 views7 pages

Graded Quiz Unit 6 - Home

CS 4405 Quizzes

Uploaded by

deronsammy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Time left 0:19:12

Question 1
Not yet answered
Marked out of 1.00

What will the type of sampleBook be with respect to the following Swift code?
struct Swift: Book {
var author: String
}
Let sampleBook = Swift(author: "Taylor")

a. Swift
b. Book
c. This code will not compile
d. String

Clear my choice

Question 2
Not yet answered
Marked out of 1.00

Which of the following is true about computed properties in Swift?

a. Their value is computed at runtime.


b. They cannot be declared in the extensions.
c. These properties are only provided by classes and structs.
d. Their value is computed at compile time.

Clear my choice
Question 3
Not yet answered
Marked out of 1.00

What will be the output of the following Swift code snippet?


let greetings = "Hello there!"
print(greetings[greetings.startIndex])

a. Hello there!
b. Hello
c. H
d. incorrect code

Clear my choice

Question 4
Not yet answered
Marked out of 1.00

What will be the output of the below Swift code?


class Bird {
var canFly: Bool?
}
var ostrich = Bird()
let canFly = ostrich.canFly ?? false
print(canFly)

a. ""
b. false
c. Null
d. This code will not compile

Clear my choice
Question 5
Not yet answered
Marked out of 1.00

What IDE is used to develop native applications for Apple devices?

a. IntelliJ
b. Xcode
c. Android Studio
d. Swift playgrounds

Clear my choice

Question 6
Not yet answered
Marked out of 1.00

Exceptions in Kotlin are thrown using the_____ expression.

a. try
b. throw
c. fire
d. trigger

Clear my choice

Question 7
Not yet answered
Marked out of 1.00

In Kotlin, generics is a concept that allows defining class methods that can be used on different data types.

Select one:
True
False
Question 8
Not yet answered
Marked out of 1.00

What will be the output of the following Swift code snippet?


var arr = [1,2,3,4]
for element in arr {
print(element, terminator: " ")
}

a. 1 2 3 4
b. 1,2,3,4
c. [1 2 3 4]
d. [1,2,3,4]

Clear my choice

Question 9
Not yet answered
Marked out of 1.00

Which of the following is a built-in exception in Kotlin?

a. IOException
b. DivisionByZeroException
c. NegativeIndexException
d. InvaidInputException

Clear my choice

Question 10
Not yet answered
Marked out of 1.00

Swift classes inherit from a universal base class.

Select one:
True
False
Question 11
Not yet answered
Marked out of 1.00

What will be the output of the following Swift code?


struct Person {
var name: String
}
var person1 = Person(name: "Person1")
var person2 = person1
person1.name = "Taylor"
print(person2.name)

a. Null
b. Taylor
c. ""
d. Person1

Clear my choice

Question 12
Not yet answered
Marked out of 1.00

Which of the following keyword is used to declare a variable in the Swift programming language?

a. val
b. var
c. let
d. Variable

Clear my choice
Question 13
Not yet answered
Marked out of 1.00

What will be the output of the following Swift code snippet?


var greetings = "Hello"
greetings = "Hey there"
print(greetings)

a. Hello
b. Hello Hey there
c. Hey there
d. It will raise a syntax error

Clear my choice

Question 14
Not yet answered
Marked out of 1.00

Which of the following keywords is used for exception handling in Kotlin?

a. trigger
b. block
c. launch
d. try

Clear my choice

Question 15
Not yet answered
Marked out of 1.00

Identify the keyword (in Swift) that is used to give the ability to a structured method to modify its properties within the structure.

a. malleable
b. mode
c. modify
d. mutating

Clear my choice

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy