최신Apple App Development with Swift Certified User - App-Development-with-Swift-Certified-User무료샘플문제
문제1
Review the code snippet.

The code snippet does not compile.
Which two actions will fix the errors? (Choose 2.)
Review the code snippet.

The code snippet does not compile.
Which two actions will fix the errors? (Choose 2.)
정답: B,D
설명: (ExamPassdump 회원만 볼 수 있음)
문제2
Review the code snippet.

What will print after the final line of code is executed?
Review the code snippet.

What will print after the final line of code is executed?
정답:
Answer the question by typing in the box.
2
Explanation:
This question belongs to Swift Programming Language , specifically the objective on variable scope and shadowing .
The code first declares:
let even = 2
This creates a constant named even in the outer scope with the value 2.
Inside the for loop, the code declares another constant with the same name:
let even = num * 2
This inner even exists only inside the loop body. It shadows the outer even, which means that within the loop, the name even refers to the loop's local constant, not the original one. However, that inner constant goes out of scope at the end of each loop iteration.
After the loop finishes, the inner even no longer exists. So when the final line runs:
print(even)
Swift uses the original outer constant, which is still 2.
So the output is:
2
This question tests two important Swift concepts:
* Scope : where a variable or constant can be accessed
* Shadowing : when a local declaration temporarily hides another declaration with the same name Therefore, the correct answer is 2 .
2
Explanation:
This question belongs to Swift Programming Language , specifically the objective on variable scope and shadowing .
The code first declares:
let even = 2
This creates a constant named even in the outer scope with the value 2.
Inside the for loop, the code declares another constant with the same name:
let even = num * 2
This inner even exists only inside the loop body. It shadows the outer even, which means that within the loop, the name even refers to the loop's local constant, not the original one. However, that inner constant goes out of scope at the end of each loop iteration.
After the loop finishes, the inner even no longer exists. So when the final line runs:
print(even)
Swift uses the original outer constant, which is still 2.
So the output is:
2
This question tests two important Swift concepts:
* Scope : where a variable or constant can be accessed
* Shadowing : when a local declaration temporarily hides another declaration with the same name Therefore, the correct answer is 2 .
문제3
Complete the code that conforms to the View protocol by selecting the correct option from each drop-down list.
Note: You will receive partial credit for each correct answer.

Complete the code that conforms to the View protocol by selecting the correct option from each drop-down list.
Note: You will receive partial credit for each correct answer.

정답:

Explanation:

This question belongs to View Building with SwiftUI , especially the domain covering positioning and/or layout a single SwiftUI View with standard Views and modifiers and the foundational structure of a SwiftUI view. In SwiftUI, a custom screen is typically declared as a struct that conforms to the View protocol. Apple's SwiftUI documentation shows the standard pattern:
struct ScreenView: View {
var body: some View {
Text( " Hello " )
}
}
Here, struct is required because SwiftUI views are commonly defined as structures. View is required after the colon because the type must conform to the View protocol. body is the required computed property that returns the content of the view as some View. Apple documents that every conforming View type must provide a body property that describes its content.
So the completed code is:
import SwiftUI
struct ScreenView: View {
var body: some View {
Text( " Hello " )
}
}
This is the canonical SwiftUI view declaration pattern and is one of the most fundamental concepts in App Development with Swift.
문제4
Select the location to set this app to run on an iPhone 14 in the simulator.

Select the location to set this app to run on an iPhone 14 in the simulator.

정답:

Explanation:

This question belongs to Xcode Developer Tools , specifically the domain for building and running an app on the iOS simulator . In Xcode, the place where you choose whether the app runs on a simulator or a connected device is the run destination / scheme destination selector in the toolbar. This control appears near the top center of the Xcode window and displays the current destination, such as a simulator model or device target. To run the app on iPhone 14 , you click that selector and choose iPhone 14 from the available simulator list. Apple's Xcode documentation describes choosing a run destination before building and running the app in Simulator or on a device.
So, for the hotspot, the correct place is the device/simulator dropdown in the top toolbar , not the preview canvas controls, not the project navigator, and not the code editor. That selector determines where the app launches when you press Run.
문제5
For each statement about Navigation in SwiftUI. select True or False.

For each statement about Navigation in SwiftUI. select True or False.

정답:

Explanation:
* You can treat a NavigationLink like a button, and run some Swift code when it is pressed. - False
* NavigationSplitView can be used to do navigation differently on different device sizes. - True
* You can put a header on your present View in a NavigationStack using .navigationTitle. - True
* If you have a NavigationLink that goes to another View with a NavigationLink, you need to declare a NavigationStack at each level. - False This question belongs to View Building with SwiftUI , specifically the objective on creating a multi-view app with navigation stacks, links, and sheets . Statement 1 is False because NavigationLink is primarily a navigation control that pushes or presents a destination in a navigation container; Apple documents it as creating a navigation link that presents a destination, not as a general-purpose action control like Button.
Statement 2 is True because NavigationSplitView is designed for adaptive navigation and can present navigation in different ways depending on platform and available space. Apple documents NavigationSplitView as a container for navigation across multiple columns, and this adaptive behavior is exactly why it is used differently across device sizes.
Statement 3 is True because .navigationTitle(...) sets the navigation title for a view shown inside a navigation container. Apple explicitly describes a view's navigation title as something used to visually display the current navigation state of an interface.
Statement 4 is False because you do not need a separate NavigationStack at every level. Apple describes NavigationStack as the container that manages a stack of views, and NavigationLink pushes additional destinations onto that stack. Nested destinations can keep navigating within the same stack.