NSMutableDictionary * dic = [[NSMutableDictionary alloc] initWithObjectsAndKeys:@"1",@"2",@"2",@"3",@"3",@"4", nil];
NSArray *arr = [[NSArray alloc] initWithArray:[dic allKeys]];
NSString *str = [[NSString alloc] initWithFormat:[arr objectAtIndex:0],[arr objectAtIndex:1],[arr objectAtIndex:2]];
NSLog(@"%@",str);
结果是:
答案:(C)
71、
下面程序段的输出结果是什么:
NSMutableDictionary * dic = [[NSMutableDictionary alloc] initWithObjectsAndKeys:@"1",@"2",@"1",@"3",@"1",@"4", nil];
NSArray *arr1 = [[NSArray alloc] initWithArray:[dic allKeys]];
NSArray *arr2 = [[NSArray alloc] initWithArray:[dic allValues]];
NSMutableDictionary *dic2 = [[NSMutableDictionary alloc] initWithObjects:arr1 forKeys:arr2];
NSLog(@"%@",dic2);
答案:(C)
78、
下面程序段的输出结果是什么:
NSString * aString = [[NSString alloc] initWithFormat:@"123"];
NSLog(@"%d",aString.retainCount);
aString = @"456";
NSLog(@"%d",aString.retainCount);
[aString release];
aString = @"789";
NSLog(@"%d",aString.retainCount);
答案:(D)
80、
查看下列代码,能正确输出number的选项是:
@interface MyClass : NSObject
{
int number;
}
+(void) printNumber;
@end
@implementation MyClass
+(void) printNumber
{
number =10;
NSLog(@""%d"",number);
}
@end
答案:(D)