Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Exam (elaborations)

Swift Programming – Practice Questions and Answers for Developer Assessment Preparation

Rating
-
Sold
-
Pages
25
Grade
A
Uploaded on
14-01-2025
Written in
2024/2025

This document contains a collection of practice questions and answers focused on Swift programming, ideal for preparing for developer tests and coding interviews. Topics covered include syntax, optionals, closures, protocols, error handling, and SwiftUI basics. It is suitable for beginner to intermediate learners looking to solidify their Swift knowledge through test-style practice.

Show more Read less
Institution
Course

Content preview

Swift Test Questions
1- How could you setup Live Rendering - *answers *The attribute @IBDesignable lets
Interface Builder perform live updates on a particular view.

2- What is the difference between Synchronous & Asynchronous task - *answers
*Synchronous: waits until the task has completed Asynchronous: completes a task in
background and can notify you when complete

3- What Are B-Trees - *answers *B-trees are search trees that provide an ordered key-
value store with excellent performance characteristics. In principle, each node maintains
a sorted array of its own elements, and another array for its children.

4- What is made up of NSError object - *answers *There are three parts of NSError
object a domain, an error code, and a user info dictionary. The domain is a string that
identifies what categories of errors this error is coming from.

5- What is Enum - *answers *Enum is a type that basically contains a group of related
values in same umbrella.

6- What is bounding box - *answers *Bounding box is a term used in geometry; it refers
to the smallest measure (area or volume) within which a given set of points.

7- Why don't we use strong for enum property in Objective-C - *answers *Because
enums aren't objects, so we don't specify strong or weak here.

8- What is @synthesize in Objective-C - *answers *synthesize generates getter and
setter methods for your property.

9- What is @dynamic in Objective-C - *answers *We use dynamic for subclasses of
NSManagedObject. @dynamic tells the compiler that getter and setters are
implemented somewhere else.

10- Why do we use synchronized - *answers *synchronized guarantees that only one
thread can be executing that code in the block at any given time.

11- What is the difference strong, weaks, read only and copy - *answers *strong, weak,
assign property attributes define how memory for that property will be managed.

Strong means that the reference count will be increased and the reference to it will be
maintained through the life of the object

Weak ( non-strong reference ), means that we are pointing to an object but not
increasing its reference count. It's often used when creating a parent child relationship.
The parent has a strong reference to the child but the child only has a weak reference to
the parent.
Every time used on var
Every time used on an optional type

,Swift Test Questions
Automatically changes itself to nil

Read only, we can set the property initially but then it can't be changed.

Copy, means that we're copying the value of the object when it's created. Also prevents
its value from changing.

12- What is Dynamic Dispatch - *answers *Dynamic Dispatch is the process of
selecting which implementation of a polymorphic operation that's a method or a function
to call at run time. This means, that when we wanna invoke our methods like object
method. but Swift does not default to dynamic dispatch

13- What's Code Coverage - *answers *Code coverage is a metric that helps us to
measure the value of our unit tests.

14- What's Completion Handler - *answers *Completion handlers are super convenient
when our app is making an API call, and we need to do something when that task is
done, like updating the UI to show the data from the API call. We'll see completion
handlers in Apple's APIs like dataTaskWithRequest and they can be pretty handy in
your own code.

The completion handler takes a chunk of code with 3 arguments:(NSData ,
NSURLResponse?, NSError?) that returns nothing: Void. It's a closure.

The completion handlers have to marked @escaping since they are executed some
point after the enclosing function has been executed.

15- How to Prioritize Usability in Design - *answers *Broke down its design process to
prioritize usability in 4 steps:

Think like the user, then design the UX.
Remember that users are people, not demographics.
When promoting an app, consider all the situations in which it could be useful.
Keep working on the utility of the app even after launch.

16- What's the difference between the frame and the bounds - *answers *The bounds
of a UIView is the rectangle, expressed as a location (x,y) and size (width,height)
relative to its own coordinate system (0,0).

The frame of a UIView is the rectangle, expressed as a location (x,y) and size
(width,height) relative to the superview it is contained within.

17- What is Responder Chain - *answers *A ResponderChain is a hierarchy of objects
that have the opportunity to respond to events received.

, Swift Test Questions
18- What is Regular expressions - *answers *Regular expressions are special string
patterns that describe how to search through a string.

19- What is Operator Overloading - *answers *Operator overloading allows us to
change how existing operators behave with types that both already exist.

20- What is TVMLKit - *answers *TVMLKit is the glue between TVML, JavaScript, and
your native tvOS application.

21- What is Platform limitations of tvOS - *answers *First, tvOS provides no browser
support of any kind, nor is there any WebKit or other web-based rendering engine you
can program against. This means your app can't link out to a web browser for anything,
including web links, OAuth, or social media sites.

Second, tvOS apps cannot explicitly use local storage. At product launch, the devices
ship with either 32 GB or 64 GB of hard drive space, but apps are not permitted to write
directly to the on-board storage.

tvOS app bundle cannot exceed 4 GB.

22- What is Functions - *answers *Functions let us group a series of statements
together to perform some task. Once a function is created, it can be reused over and
over in your code. If you find yourself repeating statements in your code, then a function
may be the answer to avoid that repetition.

Pro Tip, Good functions accept input and return output. Bad functions set global
variables and rely on other functions to work.

23- What is ABI - *answers *ABIs are important when it comes to applications that use
external libraries. If a program is built to use a particular library and that library is later
updated, you don't want to have to re-compile that application (and from the end-user's
standpoint, you may not have the source). If the updated library uses the same ABI,
then your program will not need to change. ABI stability will come with Swift 5.0

24- Why is design pattern very important - *answers *Design patterns are reusable
solutions to common problems in software design. They're templates designed to help
you write code that's easy to understand and reuse. Most common Cocoa design
patterns:

Creational: Singleton.
Structural: Decorator, Adapter, Facade.
Behavioral: Observer, and, Memento

25- What is Singleton Pattern - *answers *The Singleton design pattern ensures that
only one instance exists for a given class and that there's a global access point to that

Written for

Course

Document information

Uploaded on
January 14, 2025
Number of pages
25
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

$15.99
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
lizishiru

Get to know the seller

Seller avatar
lizishiru University of Nairobi
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
1 year
Number of followers
0
Documents
349
Last sold
-
High-Quality Summaries and Exam Prep

Welcome to my Stuvia profile! I provide high-quality, well-structured academic materials that are designed to support serious learners in achieving their academic goals. My resources include detailed notes, comprehensive summaries, exam preparations, and study guides that are clear, accurate, and aligned with course objectives. Each document is carefully written to ensure clarity, depth, and reliability—making it easier for you to grasp complex concepts, revise efficiently, and excel in your assessments. By choosing my materials, you can expect: ✅ Accurate and well-researched content ✅ Organized and easy-to-follow structure ✅ Reliable support for exams, assignments, and study sessions My goal is to help students save time, study effectively, and achieve outstanding results.

Read more Read less
0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions