Quiz: iOS
iOS questions from real interviews as a quiz, with an explanation for every option.
Try it: 5 questions
Loading…
Sample questions
What is
applicationWillResignActivetypically used for in the iOS app lifecycle?- Pause tasks that should not run while the app is inactive.
- Resume the app after it returns from the background.
- Launch the app the first time a user opens it.
- Clean up resources immediately before the app terminates.
What distinguishes a unidirectional data flow from a bidirectional one?
- A unidirectional flow uses only synchronous calls, while a bidirectional flow uses asynchronous ones.
- A unidirectional flow is possible only in Redux, while a bidirectional flow is possible only in MVC.
- In a unidirectional flow, data moves one way; in a bidirectional flow, changes can travel back as well.
- In a unidirectional flow, only the view is updated, while in a bidirectional flow, only the model is updated.
What is reflection in programming, and what is it used for in Swift?
- Checking types only at compile time to prevent dynamic access to data.
- Automatically converting any object to JSON without inspecting its properties.
- The ability to inspect types and object data at runtime, for example with
Mirror. - Changing an app’s source code during the build based on object values.
Which statements about data flow and state management in SwiftUI are correct? Select all that apply.
@EnvironmentObjectmakes an observable object available through a View hierarchy without passing it through every parameter.@Statestores a View's local state, while@Bindinglets a child View change the state it is connected to.@Bindingcreates an independent copy of state, so changes in a child View do not affect the parent View.@StateObjecttypically creates and stores anObservableObjectin a View, while@ObservedObjectobserves an object passed to it.@ObservedObjectcreates and stores an observable object, while@StateObjectonly receives one from a parent.
Which Core Data classes directly describe the structure of a data model? Choose three.
NSManagedObjectNSEntityDescriptionNSManagedObjectContextNSAttributeDescriptionNSManagedObjectModel
What is a URL primarily used for on the internet?
- A protocol that encrypts data sent between a client and a server
- An address a client can use to locate and request a resource
- A data format a browser uses to render a page
- An identifier that guarantees a file is unique on every device
How do AVFoundation and user input handling differ in iOS?
- AVFoundation handles taps and key presses, while input handling is responsible for media playback and recording.
- Both APIs are for handling audio and video, but AVFoundation is used only for recording.
- AVFoundation manages the app interface, while input handling provides access to the camera and microphone.
- AVFoundation works with audio and video, while input handling deals with user events such as taps and key presses.
Which practices help avoid strong reference cycles in Swift when using ARC? Select three.
- Capture
selfas[weak self]when a closure is stored by the object. - Use strong references in both directions so neither object is deallocated.
- Use
unownedif the object is guaranteed to remain alive while the reference is used. - Declare a delegate reference as
weakif it could complete a cycle. - Capture
selfin a stored closure without a capture list.
- Capture
How does a Capacity Array typically manage memory when elements exceed its current capacity?
- It reserves exactly as much memory as the array will ever need in advance.
- It allocates a larger array and copies the elements; growing capacity reduces how often this happens.
- It stores each new element in a separate memory location, so existing elements never need to be copied.
- When full, it removes some older elements to make room in the same array.
What does
git cherry-pick <commit>do in the current branch?- Applies the selected commit’s changes and creates a new commit
- Moves the selected commit from one branch to another
- Creates a branch pointing to the selected commit
- Merges every commit from another branch into the current one