
Apple App Development with Swift Certified User - App-Development-with-Swift-Certified-User Exam Questions
QUESTION NO: 1
Review the code snippet.

Move each item from the list on the left to the correct code segment on the right. You may use each item only once.
Note: You will receive partial credit for each correct response.

Review the code snippet.

Move each item from the list on the left to the correct code segment on the right. You may use each item only once.
Note: You will receive partial credit for each correct response.

Correct Answer:

Explanation:

This question belongs to Swift Programming Language , specifically the domain covering structs, properties, methods, and initializers .
A computed property does not store a value directly. Instead, it returns a value calculated from other data.
That is why description is a computed property: it returns a string based on content.
A memberwise initializer is automatically provided by Swift for structs when their stored properties are initialized through parameters. So Document(content: " Greetings! " ) is using the struct's memberwise initializer.
A type property belongs to the type itself rather than to an instance. In Swift, static var docCount = 0 is a type property because it is declared with static.
An instance method is a function that belongs to an instance of the struct or class. The display() method uses the instance's content, so it is an instance method.
A type method is a method declared with static and belongs to the type itself. So static func increment() is a type method because it changes the shared type property docCount.
QUESTION NO: 2
You have a set of Views within a ZStack that produce the screen below:

Arrange the lines of code that will make up the ZSlack so that the View appears as shown.

You have a set of Views within a ZStack that produce the screen below:

Arrange the lines of code that will make up the ZSlack so that the View appears as shown.

Correct Answer:

Explanation:

This question belongs to View Building with SwiftUI , specifically stacking views and applying modifiers. A ZStack layers views from back to front, so the first item becomes the background and later items appear on top. To match the screenshot, the black background must be the back layer, so Color.black goes first. The large white circle sits above that, so Circle() followed by .foregroundStyle(.white) comes next. Finally, the red heart image sits on top of the circle, so Image(systemName: " heart " ).resizable() followed by .
foregroundStyle(.red).frame(width: 200, height: 200) must be last. SwiftUI's Image.resizable() allows the symbol image to scale to the frame you apply, and foregroundStyle sets the visible color styling for the shape and symbol.
So the intended structure is:
ZStack {
Color.black
Circle()
.foregroundStyle(.white)
Image(systemName: " heart " ).resizable()
.foregroundStyle(.red)
.frame(width: 200, height: 200)
}
This produces a black background, a white circular shape, and a centered red heart on top, exactly as shown.
QUESTION NO: 3
You are creating or updating human resource records for your employees. For each identifier, select whether it is a Constant or a Variable Note: You will receive partial credit for each correct answer.

You are creating or updating human resource records for your employees. For each identifier, select whether it is a Constant or a Variable Note: You will receive partial credit for each correct answer.

Correct Answer:

Explanation:
* age - Variable
* birthDate - Constant
* socialSecurityNumber - Constant
* salary - Variable
* currentDepartment - Variable
This question belongs to Swift Programming Language , specifically the objective on demonstrating when to use constants and variables . In Swift, a constant is declared with let and is used for values that should not change after they are set. A variable is declared with var and is used for values that may change over time.
Birth date is a constant because a person's date of birth does not change. Social security number is also a constant because it is intended to be a fixed identifier for that employee record. By contrast, age is a variable because it changes over time. Salary is a variable because compensation can be adjusted. Current department is also a variable because an employee may transfer to another department.
This matches Swift best practice: use let for fixed data and var for mutable data. So in a human resources record, identifiers that are permanent should be constants, while values that can change during employment should be variables.
QUESTION NO: 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.

Correct Answer:

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.
QUESTION NO: 5
Which property wrapper allows you to read data from the system or device settings?
Which property wrapper allows you to read data from the system or device settings?
Correct Answer: D
Explanation: Only visible for Pass4Test members. You can sign-up / login (it's free).




