What Are Strong And Weak References Why Are They Important And How Can They Be Used To Help Control Memory Management And Avoid Memory Leaks
By default, any variable that points to another object does so with what is referred to as a strong reference. A retain cycle occurs when two or more objects have reciprocal strong references . Any such objects will never be destroyed by ARC . Even if every other object in the application releases ownership of these objects, these objects will continue to exist by virtue of those mutual strong references. This therefore results in a memory leak.
Reciprocal strong references between objects should therefore be avoided to the extent possible. However, when they are necessary, a way to avoid this type of memory leak is to employ weak references. Declaring one of the two references as weak will break the retain cycle and thereby avoid the memory leak.
To decide which of the two references should be weak, think of the objects in the retain cycle as being in a parent-child relationship. In this relationship, the parent should maintain a strong reference its child, but the child should not maintain maintain a strong reference its parent.
For example, if you have Employer and Employee objects, which reference one another, you would most likely want to maintain a strong reference from the Employer to the Employee object, but have a weak reference from the Employee to thr Employer.
Where Will You Be 5 Years From Now
This Apple interview question shows how invested you are in Apple. After all, Apple is a big-picture, look-to-the-future, tech company. So, what are your long-term goals at Apple? What are you looking for in this job?
If this is an entry-level position, but sure to mention how you want to move up and take on more responsibility. Remember, Apple carefully vets each candidate through multiple interviews, which usually involves months of recruiting. They want to know that the time that theyve invested will be worth it for you and for them.
Now for a couple of strange interview questions that Apple loves to test your logic, strategic thinking, problem-solving, and math.
Explain What A Modem/router Is And Its Functions To An 8
Similar to the RAM question, your answer should be simple and summarize the overall function without getting too technical.
An 8-year-old likely knows what the Internet is. A modem is a box that gets the Internet from the Internet company into your home. A router shares the Internet with more computers. Some routers have Wi-Fi, which lets other devices, such as tablets and cellphones, get Internet without a wire.
Read Also: Prepare For System Design Interview
Apple Store Interview Questions
Tell us about yourself?
- Its okay to talk about your hobbies and interests but keep it brief. Try and focus on related work experience such as customer service and sales. Remember having related work experience will put you ahead of the competition.
How would you deal with an irate customer?
- The most important step is to listen to the customer and sympathize with their issue. Tell them you understand their frustration and that their time is valuable. Then, reassure the irate customer that you will do your best to fix the problem and if you cant solve it you will escalate the problem to find the best possible solution.
What would you do if the customer came in and their iPhone didnt work?
- Make sure the battery life on the phone is adequate.
- Reboot or restart the phone.
- Recommending updating their software.
Name three accessibility features on the iPhone?
- Several accessibility features on the iPhone are voice over, hearing aids, software TTY, reading support, and switch control
How many Apple products do you own?
- Hopefully, you own several as it will help you answer questions they may ask you about Apple products.
What is the best customer service experience you have had at Apple?
- This question is personal but for me, there is always plenty of staff available to help in a friendly manner. Also, Apple was the first to have receipts emailed to me rather than printed I hate paper receipts 🙂
You Have 100 Coins Laying Flat On A Table Each With A Head Side And A Tail Side 10 Of Them Are Heads Up 90 Are Tails Up You Cant Feel See Or In Any Other Way Find Out Which Side Is Up Split The Coins Into Two Piles Such That There Are The Same Number Of Heads In Each Pile
Take any ten coins and make a second pile. The first pile of 90 coins is called Pile A, and the 10 coins is called Pile B.
In Pile A, there are x heads, since we dont know how many there are. Therefore, that would also mean that Pile A has 90-x tails.
In Pile B, there are 10-x heads, since we know that there are 10 heads in total and x of them are in Pile A. So, the rest, or 10-x, are in Pile B. To find out the number of tails in Pile B, we can solve 10 coins heads = x tails.
Algebra just showed that Pile A has x heads, and Pile B has x tails. So, if we flip all the coins in Pile B, there will be x heads in Pile B, making the same number in both piles.
These problem-solving math questions are not intended to be memorized. Plus, if the hiring manager sees that youve seen the problem before, theyll likely be less than impressed when you solve them.
Also Check: Interview Questions For A Cfo
What Is The Difference Between Atomic And Nonatomic Properties Which Is The Default For Synthesized Properties When Would You Use One Vs The Other
Properties specified as atomic are guaranteed to always return a fully initialized object. This also happens to be the default state for synthesized properties so, while its a good practice to specify atomic to remove the potential for confusion, if you leave it off, your properties will still be atomic. This guarantee of atomic properties comes at a cost to performance, however. If you have a property for which you know that retrieving an uninitialized value is not a risk , then setting it to nonatomic can gain you a bit of performance.
Apply to Join Toptal’s Development Network
The debugger console will log Application was launched at: because the global startTime variable has not yet been set. The initialize method of an Objective-C class is only called right before the first message is sent to that class. On the other hand, any load methods defined by Objective-C classes will be called as soon as the class is added to the Objective-C runtime.
There are a couple different ways to solve this problem.
Way to Solve #1: Changing initialize to load will yield the desired result .
Way to Solve #2, thanks to commenter John, there is another way: create another class method on your created class. Lets call this new method getStartTime, and all it does is return our global startTime object.
Now we change our NSLog line to:
Preparing For The Higher Level Interview
This type of interview is difficult to prepare for because the best answers tend to come from experience. While you can read about these topics online, its hard to truly create a strong opinion if you havent tried them out yourself. In general, the best and most insightful answers to these questions come from describing how you handled real-life situations.
My recommendation to prepare for these is to:
Recommended Reading: System Design Interview Prep
Your Approach To The Behavioral Interview
It can be quite difficult and stressful to try to come up with these examples at the interview itself, so here are some ways to prepare:
To do well in this interview, you need to get comfortable telling your stories in a compelling way. This means practicing out loud. It will help you understand where you get stuck, what you forget and how you can improve. But dont memorize them that will definitely backfire. Instead, become comfortable discussing them from multiple angles!
One last word of wisdom on this topic is that not all examples have to be related to your previous employment. They can also be examples from your personal projects, family life or community engagement. Pick the examples that best represent you!
Find All Palindrome Substrings
The goal of this exercise is to find the palindrome substrings of a given string.
Problem statement: Given a string, find all non-single letter substrings that are palindromes. The string given is “aabbbaa”.
Try it yourself below before checking the solution.
For each letter in the input string, start expanding to the left and right while checking for even and odd length palindromes. Move to the next letter if we know a palindrome doesnt exist there.
We expand one character to the left and right and compare. If both are equal, we print out the palindrome substring.
Runtime complexity: Polynomial,
Recommended Reading: Interview Questions To Ask A Cfo
Answer The Phone Professionally
How you answer your telephone is important since it may be the first impression the interviewer gets of you. Make a habit of always answering your phone professionally if you’re looking for work.
While some phone interviews are scheduled, sometimes recruiters may call unexpectedly. A recruiter may also call during an unscheduled time to set up an interview or to confirm or change an interview time.
There Are Three Boxes One Contains Only Apples One Contains Only Oranges And One Contains Both Apples And Oranges The Boxes Have Been Incorrectly Labeled Such That No Label Identifies The Actual Contents Of The Box It Labels Opening Just One Box And Without Looking In The Box You Take Out One Piece Of Fruit By Looking At The Fruit How Can You Immediately Label All Of The Boxes Correctly
You should open the box labeled Apples and Oranges. Since the labels are incorrect, you know that the box must contain either only apples or only oranges.
In other words, if you take out an orange from that box, you know that it is the Oranges Only box.
The remaining box that was labeled Oranges Only can only be mixed or have apples only. The remaining box that was labeled Apples Only can only be mixed or have oranges only.
However, since the first box that you picked from is the Oranges Only box, the Apples Only box must contain the Apples and Oranges.
With Oranges Only and Apples and Oranges eliminated, the last box, incorrectly labeled Oranges Only, must be Apples Only.
It is recommended to draw out a picture to explain your thought process and the process of elimination.
Read Also: Mailscoop Io
Video: Mock Interview With Apple Engineer
The on-site was a full day of about 5-6 technical interviews, with a few behavioral questions here and there. The technical questions related directly to the team’s work and were not the typical general CS questions.
The on-site consisted of one hour interviews every hour , and we’re all very technical. I was asked to solve various problems , as well as explain the various projects I worked on in my most recent position. All in all, I’d say it was too bad as I had prepared by practicing algorithms , and brushing up on some objective-c.
There is a lot of coding on a laptop with the screen projected and also a lot of white board coding and system design. The questions were not extremely tough but makes you think in terms of DS and Algorithms. The lunch turned out to be a very technical interview in itself but now the entire team is shooting questions at you.
The Computer Science Fundamentals Interview
You may find that the computer science fundamentals interview quite challenging. To prepare for it, youll need to practice and memorize solutions to arbitrary logical riddles that will hardly ever appear in your day-to-day work life. Alas, many companies employ it, because it produces an outcome thats easy to objectively evaluate.
With the right mindset, solving these problems can also be quite fun and addictive!
The general topics that this interview covers are:
- Data Structures
- Time and Space Complexity
Recommended Reading: Questions To Ask A Cfo
What Is Your Favorite Apple Product And Why
While this question is fairly straightforward on the surface, it accomplishes more than you might think. Along with giving the hiring manager a chance to discover your level of familiarity with Apple products, it also lets them gauge your enthusiasm for your favorite.
But its also an exceptional opportunity for you. Along with showcasing your passion for a product, you can showcase relevant skills or traits if you approach it properly.
Plus, you can adjust your answer to align with the job you want to land, which may make you look like a stronger candidate.
While Im a fan of several Apple products, Id have to say my favorite is the Apple Watch. It enables me to be more efficient both in my personal and professional lives. The ability to stay apprised of incoming messages and respond to them without having to dig out another device lets me work faster. Plus, receiving calendar reminders through the watch is great for time management, ensuring I stay on target even on the busiest days.
The Apple Hiring Process
Apple gets to hire an applicant as a permanent or temporary staff, after the applicant must have passed through the hiring process of the company.
The Apples hiring process consists of the following stages:
Sending an application to Apple is the initial thing to do when applying for a job at the company.
It is usually an online form that will require some vital information from you, in order for you to continue the hiring process.
The online form will request for your education and academic results, plus your work experience .
This should be done at Apples official site.
Moreover, you might need to provide answers to some motivational questions that you will be asked when filling the application form.
Examples of these motivational questions are:
- What motivated you to seek for a job at apple?
- Why did apply for this role?
It is advisable to have an appropriate and correct answer to these questions, since they are very important.
2. Apple Telephone Interview
After your online application has been reviewed by the recruiting personnel, Apple will invite you to their office for the first round interview.
This is an opportunity for you to exhibit you skills, knowledge and passions that make you an appropriate candidate for the job.
This interview will be conducted via the phone and it will be based on competence. The company recommends that an applicant to consider past projects he or she has worked on, in your academic and professional experiences.
Don’t Miss: What To Wear For An Interview Women
Explain The Different Types Of Ios Application States
The different iOS application states are:
- Not running state: when the app has not been launched or was running but was terminated by the system.
- Inactive state: when the app is running in the foreground but is currently not receiving events. An app stays in this state briefly as it transitions to a different state. The only time it stays inactive is when the user locks the screen or the system prompts the user to respond to some event such as a phone call or SMS message.
- Active state: when the app is running in the foreground and is receiving events. This is the normal mode for foreground apps.
- Background state: when the app is in the background and executing code. Most apps enter this state briefly on their way to being suspended. However, an app that requests extra execution time can remain in this state for some time. Also, an app being launched directly into the background enters this state instead of the inactive state.
- Suspended state: A suspended app remains in memory but does not execute any code. When a low-memory condition occurs, the system may purge suspended apps without notice to make more space for the foreground app.
Phone Interview Questions To Ask Your Top Job Candidates
As a hiring manager, you know what a good resume and cover letter look like. You also know that despite their promises, they might fail to deliver the candidate you need. The phone interview questions you ask during this first round of vetting will be a critical piece of winnowing the field and making a successful hire.
Time always matters, so you should be both efficient and strategic during this initial call. Questions for a screening interview will touch on whether a candidate’s hard skills, experience, education and certifications are right for the open position. But as you check off the boxes, follow these phone interview tips to pay attention to soft skills and how the candidate presents during the call. At the end of a phone screen interview, you want to be confident a candidate can do the job and also mesh well with your organizational culture.
Open-ended, in-depth questions arent necessary at this stage of the hiring process. A screening interview is typically a 15- to 30-minute phone call. Your objective here is to narrow your list of top candidates to the handful you want to consider for formal interviews. Thats when you can go deep.
Read on for some phone interview questions to ask during this first call, tips for what to look for including red flags and what comes after.
Read Also: Top 10 Behavioral Questions