2.9 of 5 742 reviews Duluth, GA 5000+ Employees

NCR Software Developer--IOS Position Interview Question

I interviewed in Atlanta, GA and was asked:
"Write a function that takes in an array of strings and outputs a dictionary with the first character of each string as the key and the remaining characters as the object."
Add Tags [?]
Answer Flag Question

Part of a Software Developer--IOS Position Interview Review - one of 192 NCR Interview Reviews

Answers & Comments

of 0
NSArray *array=[NSArray arrayWithObjects:@"rama",@"bhanu",@"sudha",@"vagdevi",@"Devi",nil];
    NSMutableDictionary *dict=[[NSMutableDictionary alloc] init];
    for(NSString *s in array){
        NSString *key=[s substringToIndex:1];
        NSString *obj=[s substringWithRange:NSMakeRange(1,[s length]-1)];
        [dict setValue:obj forKey:key];

NSLog(@"The new dictionary is \n %@",dict);
- Rama Ambati on Jun 11, 2012 Flag Response

To comment on this question, Sign In with Facebook or Sign Up

Tags are like keywords that help categorize interview questions that have something in common.

Glassdoor is your free inside look at NCR interview questions and advice. All interview reviews posted anonymously by NCR employees and interview candidates.