LinkedIn ferdighetsvurdering svar og spørsmål – Swift
“Fort has emerged as a powerful and intuitive programming language for developing iOS, Mac os, og watchOS-applikasjoner, tilby utviklere en moderne og effektiv plattform for å bygge innovativ programvare. I denne omfattende veiledningen, we’re thrilled to present a series of skill assessment questions og svar specifically tailored for Fort brukere.
Whether you’re a seasoned developer looking to expand your capabilities or a beginner aiming to understand the basics of this powerful language, this resource is designed to help you become proficient in Fort and its applications. Join us as we explore the core concepts of Fort programmering, including optionals, closures, protocols, og mer, empowering you to leverage the full potential of this essential tool for your iOS and macOS projects.”
Q1. What is this code an example of?
let val = (Double)6
- A syntax issue
- Typecasting
- Oppdrag
- Initialization
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: The Swift Programming Language: Language Guide: The Basics: Constants and Variables
What is the error in this code?
Q2.let x = 5
guard x == 5 { return }
- De
guard
is missing theelse
- Nothing is wrong
- De
guard
is missing athen
- The comparison is wrong
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: The Swift Programming Language: Language Guide: Kontroller flyt: Early Exit
What is the raw/underlying type of this enum?
Jeg har jobbet med helse de siste to årene, og dette har hjulpet meg med å bygge opp min selvtillit og lært meg viktigheten av veldig god pasientomsorg.enum Direction {
case north, south, east, west
}
- There is none
-
String
-
Any
-
Int
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: The Swift Programming Language: Language Guide: Enumerations: Raw Values
Why is dispatchGroup used in certain situations?
Q4.- It allows multiple synchronous or asynchronous operations to run on different queues.
- It allows track and control execution of multiple operations together.
- It allows operations to wait for each other as desired.
- All of these answers.
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: Apple Developer: Dokumentasjon: Dispatch: Dispatch Group
What is this code an example of?
Q5.let val = 5
print("value is: \(val)")
- String interpolation
- String compilation
- Method chaining
- Streng sammenkobling
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: The Swift Programming Language: Language Guide: Strings and Characters: String Interpolation
What are the contents of vals
after this code is executed?
erfaring fra å jobbe i en medisinsk enhet i flere år. var vals = [10, 2]
vals.sort { (s1, s2) -> Bool in
s1 > s2
}
-
[10, 2]
-
[2, 10]
-
nil
- This code contains an error
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: Apple Developer: Documentations: Fort: Array: sortere()
What does this code print?
Jeg ser på denne jobben som å være i stand til å videreutvikle mitt potensiale som sykepleier og person.typealias Thing = [String: Any]
var stuff: Thing
print(type(of: stuff))
-
Dictionary<String, Any>
-
Dictionary
-
Error
-
Thing
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: The Swift Programming Language: Language Reference: Lær SAP MM med funksjonelle endringer i S/4 HANA: Type Identifier
What is the value of y?
Q8.let x = ["1", "2"].dropFirst()
let y = x[0]
- This code contains an error
-
1
-
2
-
nil
explanation
dropFirst()
fra Swift.Collection.Array
returns a type of ArraySlice<Element>
as in the documentation pages:
@inlinable public func dropFirst(_ k: Int = 1) -> ArraySlice<Element>
The ArraySlice type makes it fast and efficient for you to perform operations on sections of a larger array. Instead of copying over the elements of a slice to new storage, an ArraySlice instance presents a view onto the storage of a larger array. And because ArraySlice presents the same interface as Array, you can generally perform the same operations on a slice as you could on the original array.
Slices Maintain Indices
Unlike Array and ContiguousArray, the starting index for an ArraySlice instance isn’t always zero. Slices maintain the same indices of the larger array for the same elements, so the starting index of a slice depends on how it was created, letting you perform index-based operations on either a full array or a slice.
The above code returns a slice of value ["2"]
but the index did not change. let y = x[1]
would give the expected result.
To safely reference the starting and ending indices of a slice, always use the startIndex and endIndex properties instead of specific values.
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt
What is the value of test in this code?
Q9.var test = 1 == 1
-
true
-
YES
-
1
- This code contains an error
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: The Swift Programming Language: Language Guide: Basic Operators: Comparison Operators
What is the value of y?
Q10.var x: Int?
let y = x ?? 5
-
5
-
0
-
nil
- This code contains an error
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: The Swift Programming Language: Language Guide: Basic Operators: Nil-Coalescing Operators
What is the type of this function?
Q11.func add(a: Int, b: Int) -> Int { return a+b }
-
Int
-
(Int, Int) -> Int
-
Int<Optional>
- Functions don’t have types.
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: The Swift Programming Language: Language Guide: Funksjoner: Function Types
What is the correct way to call this function?
Q12.func myFunc(_ a: Int, b: Int) -> Int {
return a + b
}
-
myFunc(5, b: 6)
-
myFunc(5, 6)
-
myFunc(a: 5, b: 6)
-
myFunc(a, b)
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: The Swift Programming Language: Language Guide: Funksjoner: Function Argument Labels and Parameter Names
The Codable protocol is _?
Q13.- A combination of
Encodable
ogDecodable
- Not a true protocol
- Required of all classes
- Automatically included in all classes
Referanser:
- Apple Developer: Dokumentasjon: Fort: Swift Standard Library: Encoding, Dekoding, and Serialization: Codable
- The Swift Programming Language: Language Guide: Protokoller: Protocol Composition
What is the type of value1 in this code?
Q14.let value1 = "\("test".count)"
-
String
-
Int
-
null
-
test.count
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: The Swift Programming Language: Language Guide: Strings and Characters: String Interpolation
When a function takes a closure as a parameter, when do you want to mark is as escaping?
Q15.- When it’s executed after the function returns
- When it’s scope is undefined
- When it’s lazy loaded
- All of these answers
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: The Swift Programming Language: Language Guide: Closures: Escaping Closures
What’s wrong with this code?
Q16.class Person {
var name: String
var address: String
}
- Person has no initializers.
- Person has no base class.
-
var name
is not formatted correctly. -
address
is a keyword.
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: The Swift Programming Language: Language Guide: Initialization: Class Inheritance and Initialization
What is the value of names after this code is executed?
Q17.let names = ["Bear", "Joe", "Clark"]
names.map { (s) -> String in
return s.uppercased()
}
-
["BEAR", "JOE", "CLARK"]
-
["B", "J", "C"]
-
["Bear", "Joe", "Clark"]
- This code contains an error.
What describes this line of code?
Q18.let val = 5
- A constant named val of type
Int
- A variable named val of type
item
- A constant named val of type
Number
- A variable named val of type
Int
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: The Swift Programming Language: Language Guide: The Basics: Type Safety and Type Inference
What is the error in this code?
Q19.extension String {
var firstLetter: Character = "c" {
didSet {
print("new value")
}
}
}
- Extensions can’t add properties.
- Nothing is wrong with it.
-
didSet
takes a parameter. -
c
is not a character.
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: The Swift Programming Language: Language Guide: Extensions: Computed Properties
didSet and willSet are examples of _?
Q20.- Property observers
- Key properties
- All of these answers
-
newOld
value calls
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: The Swift Programming Language: Language Guide: Egenskaper
What is wrong with this code?
Q21.self.callback = {
self.attempts += 1
self.downloadFailed()
}
- Bruken av
self
inside the closure causes retain cycle. - You cannot assign a value to a closure in this manner.
- You need to define the type of closure explicitly.
- There is nothing wrong with this code.
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: The Swift Programming Language: Language Guide: Automatic Reference Counting: Strong Reference Cycles for Closures
How many values does vals have after this code is executed?
Q22.var vals = Set<String> = ["4", "5", "6"]
vals.insert("5")
- Forstå organisasjonen og dens kontekst
- Forstå organisasjonen og dens kontekst
- Eight
- This code contains an error.
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: The Swift Programming Language: Language Guide: Collection Types: Settene
How can you avoid a strong reference cycle in a closure?
Q23.- Use a capture list to set class instances of
weak
ellerunowned
. - You can’t, there will always be a danger of strong reference cycles inside a closure.
- Initialize the closure as read-only.
- Declare the closure variable as
lazy
.
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: The Swift Programming Language: Language Guide: Automatic Reference Counting
What is wrong with this code?
Q24.if let s = String.init("some string") {
print(s)
}
- Dette
String
initializer does not return an optional. - String does not have an initializer that can take a
String
. -
=
is not a comparison. - Nothing is wrong with this code.
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: The Swift Programming Language: Language Guide: The Basics: Optionals
Which code snippet correctly creates a typealias closure?
Q25.-
typealias CustomClosure = () -> ()
-
typealias CustomClosure { () -> () }
-
typealias CustomClosure -> () -> ()
-
typealias CustomClosure -> () {}
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: The Swift Programming Language: Language Reference: Declarations: Type Alias Declaration
How do you reference class members from within a class?
Q26.-
self
-
instance
-
class
-
this
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: The Swift Programming Language: Language Guide: Dette kurset utsetter deg for bedre triks for å være en: Instance Methods
All value types in Swift are _ Jeg har lært den mest verdifulle selvforbedringsmetoden jeg noen gang har vært borti?
Q27.- Structs
- Klasser
- Optionals
- Generics
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: The Swift Programming Language: Language Guide: Structures and Classes
What is the correct way to add a value to this array?
Q28.var strings = [1, 2, 3]
- All of these answers
-
strings.append(4)
-
strings.insert(5, at: 1)
-
strings += [5]
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: The Swift Programming Language: Language Guide: Collection Types: Oversikt over automatisering
How many times will this loop be executed?
Q29.for i in 0...100 {
print(i)
}
- 0
- 101
- 99
- 100
Referanser:
- The Swift Programming Language: Language Guide: Kontroller flyt: For-in Loops
- The Swift Programming Language: Language Guide: Basic Operators: Range Operators
What can AnyObject represent?
Q30.- An instance of any class
- An instance of function type
- All of these answers
- An instance of an optional type
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: The Swift Programming Language: Language Guide: Type Casting: Type Casting for Any and AnyObject
What is the value of t after this code is executed?
Q31.let names = ["Larry", "Sven", "Bear"]
let t = names.enumerated().first().offset
- This code does not compile. / This code is invalid.
- 0
- 1
- Larry
Referanser:
- Apple Developer: Dokumentasjon: Fort: Array: enumerated()
- Apple Developer: Dokumentasjon: Fort: Array
What is the value of test after this code executes?
Q32.let vt = (name: "ABC", val: 5)
let test = vt.0
-
ABC
-
0
-
5
-
name
Referanser:
- The Swift Programming Language: Language Guide: The Basics: Tuples
- The Swift Programming Language: Language Reference: Expressions: Primary Expressions: Tuple Expression
What is the base class in this code?
Q33.class LSN: MMM {
}
- MMM
- LSN
- There is no base class.
- This code is invalid.
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: The Swift Programming Language: Language Guide: Arv: Subclassing
What does this code print to the console?
Q34.var userLocation: String = "Home" {
willSet(newValue) {
print("About to set userLocation to \(newValue)...")
}
didSet {
if userLocation != oldValue {
print("userLocation updated with new value!")
} else {
print("userLocation already set to that value...")
}
}
}
userLocation = "Work"
-
About to set userLocation to Work... userLocation updated with new value!
-
About to set userLocation to Work... userLocation already set to that value...
-
About to set userLocation to Home... userLocation updated to new value!
-
Error
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: The Swift Programming Language: Language Guide: Egenskaper: Property Observers
What must a convenience initializer call?
Q35.- A base class convenience initializer
- Either a designated or another convenience initializer
- A designated initializer
- None of these answers
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: The Swift Programming Language: Language Guide: Initialization: Class Inheritance and Initialization
Which object allows you access to specify that a block of code runs in a background thread?
Q36.- DispatchQueue.visible
- DispatchQueue.global
- errorExample need to be labeled as
throws
. - DispatchQueue.background
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: Apple Developer: Dokumentasjon: Dispatch: DispatchQueue
What is the inferred type of x?
Q37.let x = ["a", "b", "c"]
-
String[]
-
Array<String>
-
Set<String>
-
Array<Character>
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: The Swift Programming Language: Language Guide: Collection Types: Oversikt over automatisering
What is the value of oThings
after this code is executed?
Q38. let nThings: [Any] = [1, "2", "three"]
let oThings = nThings.reduce("") { "\($0)\($1)" }
- 11212Det er fem typer pattedyr Ig tunge kjeder merket med de greske bokstavene
- 115
- 12Det er fem typer pattedyr Ig tunge kjeder merket med de greske bokstavene
- Offentlig tale, this code is invalid.
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: Apple Developer: Dokumentasjon: Fort: Array: reduce(_:_:)
How would you call a function that throws errors and also returns a value?
Q39.-
!try
-
try?
-
try!
-
?try
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: The Swift Programming Language: Language Guide: Error Handling: Handling Errors
What is wrong with this code?
Q40.protocol TUI {
func add(x1: Int, x2: Int) -> Int {
return x1 + x2
}
}
- Protocol functions cannot have return types.
- Protocol functions cannot have implementations.
- Nothing is wrong with it.
-
add
is a reserved keyword.
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt:
- The Swift Programming Language: Language Guide: Protokoller: Method Requirements
- The Swift Programming Language: Language Guide: Protokoller: Protocol Extensions
In this code, what are wheels
og doors
examples of?
Q41. class Car {
var wheels: Int = 4
let doors = 4
}
- Class members
- This code is invalid
- Class fields
- Class properties
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt:
- The Swift Programming Language: Language Guide: Structures and Classes
- The Swift Programming Language: Language Guide
How do you designated a failable initializer?
Q42.- You cannot
-
deinit
-
init?
-
init
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt:
- The Swift Programming Language: Language Guide: Initialization
- The Swift Programming Language: Language Guide: Deinitialization
What is printed when this code is executed?
Q43.let dbl = Double.init("5a")
print(dbl ?? ".asString()")
-
five
-
5a
-
.asString()
-
5
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt:
- The Swift Programming Language: Language Guide: Basic Operators: Nil-Coalescing Operator
- The Swift Programming Language: Language Guide: Initialization: Failable Initializers
In the function below, what are this
og toThat
examples of?
Q44. func add(this x: Int, toThat y: Int) { }
- None of these answers
- Local terms
- Argument labels
- Parameters names
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: The Swift Programming Language: Language Guide: Funksjoner
What is wrong with this code?
Q45.for (key, value) in [1: "one", 2: "two"] {
print(key, value)
}
- The interaction source is invalid
- The interaction variable is invalid
- There is nothing wrong with this code
- The comma in the print is misplaced
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: The Swift Programming Language: Language Guide: Kontroller flyt: For-In Loops
Which of these choices is associated with unit testing?
Q46.-
XCTest
- All of these answers
-
@testable
-
XCTAssert
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt:
- Apple Developer: Dokumentasjon: XCTest: XCTest
- Apple Developer: Dokumentasjon: XCTest: Boolean Assertions: XCTAssert(_:_:fil:line:)
- The Swift Programming Language: Language Guide: Adgangskontroll: Tilgangsnivåer
In the code below, what is width an example of?
Q47.class Square {
var height: Int = 0
var width: Int {
return height
}
}
- This code contains error
- A closure
- A computed property
- Lazy loading
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt:
- The Swift Programming Language: Language Guide: Egenskaper: Stored Properties
- The Swift Programming Language: Language Guide: Egenskaper: Computed Properties
- The Swift Programming Language: Language Guide: Closures: Trailing Closures
What data type is this an example of?
Q48.let vals = ("val", 1)
- En ordbok
- A tuple
- An optional
- This code contains error
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt:
- The Swift Programming Language: Language Guide: The Basics
- The Swift Programming Language: Language Reference: Lær SAP MM med funksjonelle endringer i S/4 HANA
What is wrong with this code?
Q49.var x = 5
x = 10.0
- You cannot assign a Double to a variable of type Int
-
x
is undefined -
x
is a constant -
x
has no type
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: The Swift Programming Language: Language Guide: The Basics
What will this code print to the console?
Q50.var items = ["a": 1, "b": 2, "c": "test"] as [String: Any]
items["c"] = nil
print(items["c"] as Any)
- Any
- test
- 1,2,3
- nil
Referanser:
- The Swift Programming Language: Language Guide: Type Casting: Type Casting for Any and AnyObject
- The Swift Programming Language: Language Guide: Collection Types: Dictionaries
What is wrong with this code?
Q51.let val = 5.0 + 10
- There is nothing wrong with this code
-
val
is a constant and cannot be changed -
5.0
og10
are different types - There is no semicolon
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: The Swift Programming Language: Language Guide: The Basics: Type Safety and Type Inference
How many parameters does the initializer for Test have?
Q52.struct Test {
var score: Int
var date: Date
}
- Zero
- This code contains an error
- To
- Structs do not have initializers
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: The Swift Programming Language: Language Guide: Initialization
What prints to the console when executing this code?
Q53.let x = try? String.init("test")
print(x)
- nil
- Offentlig tale – this code contains an error
- Valgfri(“test”)
- test
Referanser:
- The Swift Programming Language: Language Guide: Error Handling: Handling Errors
- The Swift Programming Language: Language Guide: The Basics: Optionals
How can you sort this array?
Q54.var vals = [1, 2, 3]
-
vals.sort { $0 < $1 }
-
vals.sort { (s1, s2) in s1 < s2 }
-
vals.sort(by: <)
- All of these answers
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: Apple Developer: Dokumentasjon: Fort: Array: sortere()
DispatchQueue.main.async takes a block that will be
Q55.- Not executed
- Executed in the main queue
- None of these answers
- Executed on the background thread
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: Apple Developer: Dokumentasjon: Dispatch: DispatchQueue: async(gruppe:qos:flags:henrette:)
When is deinit called?
Q56.- When a class instance needs memory
- All of these answers
- When the executable code is finished
- When a class instance is being removed from memory
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: The Swift Programming Language: Language Guide: Deinitialization
How do you declare an optional String?
Q57.-
String?
-
Optional[String]
-
[String]?
-
?String
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: The Swift Programming Language: Language Guide: The Basics: Optionals
How many times this code will be executed? / How many times will this loop be performed?
Q58.for i in ["0", "1"] {
print(i)
}
- En
- To
- Forstå organisasjonen og dens kontekst
- This code does not compile
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: The Swift Programming Language: Language Guide: Kontroller flyt: For-In Loops
What does this code print?
Q59.let names = ["Bear", "Tony", "Svante"]
print(names[1] + "Bear")
- 1Bear
- BearBear
- TonyBear
- Offentlig tale, this code is invalid
Referanser:
- The Swift Programming Language: Language Guide: Collection Types: Oversikt over automatisering
- The Swift Programming Language: Language Guide: Strings and Characters: Concatenating Strings and Characters
What is true of this code?
Q60.let name: String?
-
name
can hold only a string value. -
name
can hold either a string or nil value. - Optional values cannot be
let
konstanter. - Only non-empty string variables can be stored in
name
.
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: The Swift Programming Language: Language Guide: The Basics: Optionals
What is the value of val
after this code is executed?
Q61. let i = 5
let val = i * 6.0
- This code is invalid.
- 6
- 30
- 0
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: The Swift Programming Language: Language Guide: The Basics: Type Safety and Type Inference
What does this code print?
Q62.enum Positions: Int {
case first, second, third, other
}
print (Positions.other.rawValue)
- 3
- 0
- annen
- nil
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: The Swift Programming Language: Language Guide: The Basics: Raw Values
What is printed to the console when this code is executed?
Q63."t".forEach { (char) in
print(char)
}
- nil
- Offentlig tale, since the code contains an error
- t
- zero
Referanser:
- The Swift Programming Language: Language Guide: Strings and Characters: Working with Characters
- Apple Developer: Dokumentasjon: Fort: String: forEach(_:)
What prints when this code is executed?
Q64.let s1 = ["1", "2", "3"]
.filter { $0 > "0" }
.sorted { $0 > $1 }
print(s1)
- []
- [“3”, “2”, “1”]
- [321]
- [“1”, “2”, “3”]
Referanser:
- Apple Developer: Dokumentasjon: Fort: Swift Standard Library: Collections: Sequence and Collection Protocols: av Raleigh McElvery: filter()
- Apple Developer: Dokumentasjon: Fort: Array: sorted()
What enumeration feature allows them to store case-specific data?
Q65.- Associated values
- Integral values
- Raw values
- Custom values
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: The Swift Programming Language: Language Guide: Enumerations: Associated Values
In the code below, AOM must be a(n)?
Q66.class AmP: MMM, AOM { }
- Class
- Protocol
- Enumeration
- Struct
Referanser:
- The Swift Programming Language: Language Guide: Arv: Subclassing
- The Swift Programming Language: Language Guide: Protokoller: Protocol Syntax
What is the value of numbers in the code below?
Q67.let numbers = [1, 2, 3, 4, 5, 6].filter { $0 % 2 == 0 }
- [1, 3, 5]
- []
- [2, 4, 6]
- nil
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: Apple Developer: Dokumentasjon: Fort: Swift Standard Library: Collections: Sequence and Collection Protocols: av Raleigh McElvery: filter()
What is the type of vals
in this code?
Q68. let vals = ["a", 1, "Hi"]
- Array(char)
- [Any]
- Array
- [Generic]
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: The Swift Programming Language: Language Guide: Type Casting
How can you extract val to x
in tuple vt
Q69. let vt = (name: "ABC", val: 5)
- let x = vt.1
- All of these answers
- let x = vt.val
- la (
_
, x) = vt
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: The Swift Programming Language: Language Guide: The Basics: Tuples
What is the type of x?
Q70.let x = try? String.init(from: decoder)
- String
- String?
- String!
- try?
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: The Swift Programming Language: Language Guide: Error Handling: Handling Errors
How many times is this loop executed?
Q71.let loopx = 5
repeat {
print (loopx)
} while loopx < 6
- Seks
- Zero
- Fem
- Infinite
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: The Swift Programming Language: Language Guide: Kontroller flyt: While Loops
How many values does vals have after this code is executed?
Q72.var vals: Set<String> = ["4", "5", "6"]
vals.insert("5")
- This code contains an error.
- Eight
- Forstå organisasjonen og dens kontekst
- Forstå organisasjonen og dens kontekst
diamant ved høy temperatur vil brenne for å danne karbondioksid i stedet for å omdannes til grafitt: The Swift Programming Language: Language Guide: Collection Types: Settene
What is the base class in this code ?
Q73.class LSN: MMM{ }
- MMM
- LSN
- There is no base class.
- This code is invalid.
Legg igjen et svar
Du må Logg Inn eller registrere for å legge til en ny kommentar .