Welcome to TestSimulate

Pass Your Next Certification Exam Fast!

Everything you need to prepare, learn & pass your certification exam easily.

365 days free updates. First attempt guaranteed success.

Apple App Development with Swift Certified User (App-Development-with-Swift-Certified-User) Free Practice Test

Question 1
Review the code snippet.

What is the output from each print statement?
Correct Answer:
Answer the question by typing in the box.
10
Explanation:
This question belongs to Swift Programming Language , specifically the domain covering structs, classes, properties, methods, and the difference between structures and classes .
The key point is that Printer is declared as a class :
class Printer {
var copies: Int
init(copies: Int) {
self.copies = copies
}
}
In Swift, classes are reference types . That means when you assign one class instance to another variable, both variables refer to the same object in memory rather than creating a separate copy. Apple's Swift language guide explains that classes are passed by reference, while structures are value types. So in this code:
var printer1 = Printer(copies: 2)
var printer2 = printer1
both printer1 and printer2 point to the same Printer instance.
Next, this line changes the shared object:
printer2.copies = 10
Because printer2 refers to the same instance as printer1, changing printer2.copies also changes printer1.
copies. Therefore, when the code executes:
print(printer1.copies)
the output is 10 .
This question tests one of the most important Swift concepts: classes are reference types , while structs are value types . If Printer had been a struct instead of a class, the result would have been different because assignment would copy the value rather than share the same instance.
Question 2
You have created a view which includes some formatted text:

You decide to extract this formatted text into a subview so that you can reuse the formatting for other texts.
You highlight the Text and choose Extract subview.
You refactor ExtractedView to BigGreenTextView.
You add the line let text: String to the extracted view above the body.
You replace " That ' s all folks " with a reference to text
How should you call this extracted View from the original View?

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

Correct Answer: B
Explanation: Only visible for TestSimulate members. You can sign-up / login (it's free).
Question 5
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.