MCQs > IT & Programming > Cocoa Programming For Mac OS X MCQs > Basic Cocoa Programming for Mac OS X MCQs

Basic Cocoa Programming for Mac OS X MCQ

1. Which of the following is a valid Uniform Type Identifier?

Answer

Correct Answer: public.jpeg

Note: This Question is unanswered, help us to find answer for this one

2.

Is the following code correct?

NSMutableArray *a = [NSMutableArray new];

// do something with a

[a release];

Answer

Correct Answer: Yes

Note: This Question is unanswered, help us to find answer for this one

3.

Is the following code correct?

NSMutableArray *a = [[NSMutableArray new] autorelease];

// do something with a

[a release];

Answer

Correct Answer: Yes

Note: This Question is unanswered, help us to find answer for this one

4.

Is the following code correct?

NSMutableArray *a = [NSMutableArray array];

// do something with a

[a release];

Answer

Correct Answer: No

Note: This Question is unanswered, help us to find answer for this one

5.

Is the following code correct?

NSRect a = NSMakeRect(0, 1, 2, 3) + NSMakeRect(0, 1, 2, 3);

Answer

Correct Answer: No

Note: This Question is unanswered, help us to find answer for this one

6.

If you call interpretKeyEvents:, which of the following method is likely to be called?

Answer

Correct Answer: insertText

Note: This Question is unanswered, help us to find answer for this one

7.

What will be the output of the following code?

NSRect rect = NSMakeRect(0, 0, 10, 10);
NSRect *rect2 = malloc(sizeof(*rect2));
if(!rect2) {
    NSLog(@"Not enough memory.");
    exit(EXIT_FAILURE);
}

*rect2 = rect;

printf("%d\n", rect.size.width);

Answer

Correct Answer: 0

Note: This Question is unanswered, help us to find answer for this one

8.

Is NSRunLoop thread safe?

Answer

Correct Answer: No

Note: This Question is unanswered, help us to find answer for this one

9.

Can an object marked for autorelease be retained?

Answer

Correct Answer: Yes

Note: This Question is unanswered, help us to find answer for this one

10.

Fill the blank
NSView : <> : NSObject

Answer

Correct Answer: NSResponder

Note: This Question is unanswered, help us to find answer for this one

11.

Can you use NSLock on a POSIX mutex?

Answer

Correct Answer: No

Note: This Question is unanswered, help us to find answer for this one

12.

What kind of memory management mechanisms can Cocoa uses?

Answer

Correct Answer: Garbage collection
Reference counting
Manual memory management

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

13.

Which of the following retrieves the application main bundle?

Answer

Correct Answer: [NSBundle mainBundle]

Note: This Question is unanswered, help us to find answer for this one

14.

Is it possible to create events and dispatch them to the application?

Answer

Correct Answer: Yes

Note: This Question is unanswered, help us to find answer for this one

15.

What is Cocoa?

Answer

Correct Answer: A framework

Note: This Question is unanswered, help us to find answer for this one

16.

Is the following code correct?
- (void)myMethod:(NSString **)s {
*s = [[NSString alloc] init];
}

Answer

Correct Answer: Yes

Note: This Question is unanswered, help us to find answer for this one

17.

What is true regarding notifications?

Answer

Correct Answer: The object posting the notification does not even have to know whether the observer exists
An object may receive any message you like from the notification center, not just the predefined delegate method

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

18.

What threading API should be used in Cocoa?

Answer

Correct Answer: NSThread

Note: This Question is unanswered, help us to find answer for this one

19.

Is the following code valid?
NSRect r;
r.size = NSMakeSize(10,10);
r.origin = NSMakePoint(-5, -5);

Answer

Correct Answer: Yes

Note: This Question is unanswered, help us to find answer for this one

20.

Where is the (0,0) coordinate located on the screen?

Answer

Correct Answer: top-left

Note: This Question is unanswered, help us to find answer for this one

21.

Can NSBundle be used to load Java code?

Answer

Correct Answer: Yes

Note: This Question is unanswered, help us to find answer for this one

22.

Fill the blank.
NSNotification : <> : NSObject

Answer

Correct Answer: Nothing is required to fill the blank

Note: This Question is unanswered, help us to find answer for this one

23.

Is there a double click event?

Answer

Correct Answer: No

Note: This Question is unanswered, help us to find answer for this one

24.

What is a toll-free bridged class?

Answer

Correct Answer: A class that can be interchanged with another class bycasting

Note: This Question is unanswered, help us to find answer for this one

25.

Can resources be localized?

Answer

Correct Answer: Yes

Note: This Question is unanswered, help us to find answer for this one

26.

How can you move a view?

Answer

Correct Answer: By changing the frame with setFrame:

Note: This Question is unanswered, help us to find answer for this one

27.

Why is CGFloat recommenced to be used instead of float?

Answer

Correct Answer: For 64bit compatibility

Note: This Question is unanswered, help us to find answer for this one

28.

Which of the following creates an autoreleased array?

Answer

Correct Answer: [NSMutableArray array];

Note: This Question is unanswered, help us to find answer for this one

29.

What is NSViewHeightSizable constant used for?

Answer

Correct Answer: Autoresizing

Note: This Question is unanswered, help us to find answer for this one

30.

Can POSIX thread be used in Cocoa?

Answer

Correct Answer: Yes

Note: This Question is unanswered, help us to find answer for this one

31.

Is it correct to have sibling views overlapping?

Answer

Correct Answer: No

Note: This Question is unanswered, help us to find answer for this one

32.

What method should be called before you are able to draw in the drawRect: method of a view?

Answer

Correct Answer: None

Note: This Question is unanswered, help us to find answer for this one

33.

Can a notified object find out from where the notification is coming? (Sending Object)

Answer

Correct Answer: No

Note: This Question is unanswered, help us to find answer for this one

34.

In a typical Cocoa application, do you have to manage your runloop yourself?

Answer

Correct Answer: No

Note: This Question is unanswered, help us to find answer for this one

35.

Does Cocoa support 64bits?

Answer

Correct Answer: Yes

Note: This Question is unanswered, help us to find answer for this one

36.

What is a notification?

Answer

Correct Answer: An object that encapsulates information about an event

Note: This Question is unanswered, help us to find answer for this one

37.

Is the following code valid?
NSSize s = NSMakeSize(10, 10);
int values[20];
values[s.height] = 5;

Answer

Correct Answer: Compile error

Note: This Question is unanswered, help us to find answer for this one

38.

Can you detach threads in Cocoa?

Answer

Correct Answer: Yes

Note: This Question is unanswered, help us to find answer for this one

39.

Can NSDistributedNotificationCenter be used to communicate between multiple machines?

Answer

Correct Answer: No

Note: This Question is unanswered, help us to find answer for this one

40.

Which of the following classes manages the computer’s global notifications?

Answer

Correct Answer: NSDistributedNotificationCenter

Note: This Question is unanswered, help us to find answer for this one

41.

Fill the blank
NSMutableArray : <> : NSObject

Answer

Correct Answer: NSArray

Note: This Question is unanswered, help us to find answer for this one

42.

What method should be called before you are able to draw outside the drawRect: method of a view?

Answer

Correct Answer: lockFocus

Note: This Question is unanswered, help us to find answer for this one

43.

If you spawn a thread with POSIX thread api, will Cocoa be notified?

Answer

Correct Answer: No

Note: This Question is unanswered, help us to find answer for this one

44.

What is NSRect?

Answer

Correct Answer: A structure

Note: This Question is unanswered, help us to find answer for this one

45.

Fill the blank.
NSCountedSet : <> : NSObject

Answer

Correct Answer: NSMutableSet : NSSet

Note: This Question is unanswered, help us to find answer for this one

46.

How is a GUI usually created in Cocoa?

Answer

Correct Answer: With interface builder

Note: This Question is unanswered, help us to find answer for this one

47.

What is the normal way of handling cocoa events?

Answer

Correct Answer: By implementing NSResponder methods in subclasses

Note: This Question is unanswered, help us to find answer for this one

48.

Where should application resources be usually put?

Answer

Correct Answer: Within the application’s bundle

Note: This Question is unanswered, help us to find answer for this one

49.

Which of the following platforms supports Cocoa?

Answer

Correct Answer: Mac OSX

Note: This Question is unanswered, help us to find answer for this one

50.

Can an object be the delegate of multiple objects?

Answer

Correct Answer: Yes

Note: This Question is unanswered, help us to find answer for this one

51.

How wide is unichar on a 32bit machine?

Answer

Correct Answer: 16bit

Note: This Question is unanswered, help us to find answer for this one

52.

Can you use malloc/free in a Cocoa application?

Answer

Correct Answer: Yes

Note: This Question is unanswered, help us to find answer for this one

53.

Fill the blank.
NSButton : <> : NSObject

Answer

Correct Answer: NSControl : NSView : NSResponder

Note: This Question is unanswered, help us to find answer for this one

54.

What is an observer?

Answer

Correct Answer: An object registered with the notification center

Note: This Question is unanswered, help us to find answer for this one

55.

Can poll() be used to fetch Cocoa events?

Answer

Correct Answer: No

Note: This Question is unanswered, help us to find answer for this one

56.

What class should be used to load resources?

Answer

Correct Answer: NSBundle

Note: This Question is unanswered, help us to find answer for this one

57.

Is it mandatory to create an NSAutoreleasePool in a Cocoa application?

Answer

Correct Answer: No

Note: This Question is unanswered, help us to find answer for this one

58.

Is NSString mutable?

Answer

Correct Answer: No

Note: This Question is unanswered, help us to find answer for this one

59.

In which language is Cocoa written?

Answer

Correct Answer: Objective-C

Note: This Question is unanswered, help us to find answer for this one

60.

Under Mac OS X 10.5, CGRect, CGSize and CGPoint have the same structure as NSRect, NSSize and
NSPoint respectively. Is it true?

Answer

Correct Answer: Yes

Note: This Question is unanswered, help us to find answer for this one

61. The ________ object is the application's main controlling object.

Answer

Correct Answer: NSApp

Note: This Question is unanswered, help us to find answer for this one

62. A ______ object sends a message automatically to a target when an on-screen object is manipulated.

Answer

Correct Answer: control

Note: This Question is unanswered, help us to find answer for this one

63. Which does not belong in web infrastructure:

Answer

Correct Answer: Mainframe

Note: This Question is unanswered, help us to find answer for this one

64. Which one is not a Navigator in Xcode?

Answer

Correct Answer: Assistant Navigator

Note: This Question is unanswered, help us to find answer for this one

65. ________ are NOT a Cocoa event.

Answer

Correct Answer: Repeating events

Note: This Question is unanswered, help us to find answer for this one

66. What does the Interface Builder in Xcode do?

Answer

Correct Answer: Code reuse of the views classes

Note: This Question is unanswered, help us to find answer for this one

67. The Mac OS X _______ replaces the Mac OS 9 Application menu.

Answer

Correct Answer: Dock

Note: This Question is unanswered, help us to find answer for this one

68. _______ is not a subclass of NSResponder.

Answer

Correct Answer: NSEvent

Note: This Question is unanswered, help us to find answer for this one

69. The ______ is a section of code that reads events and performs appropriate functions for those events.

Answer

Correct Answer: event loop

Note: This Question is unanswered, help us to find answer for this one

70. The ________ is a framework that contains all the objects needed to implement a graphical event-driven user interface.

Answer

Correct Answer: Application Kit

Note: This Question is unanswered, help us to find answer for this one

71. The Mac OS X graphical user interface (GUI) is called _________.

Answer

Correct Answer: Aqua

Note: This Question is unanswered, help us to find answer for this one

72. True or False? NSNumber objects cannot be changed after initialization.

Answer

Correct Answer: True

Note: This Question is unanswered, help us to find answer for this one

73. NSDocument class is used for ______.

Answer

Correct Answer: saving the contents of a window into a file

Note: This Question is unanswered, help us to find answer for this one

74. A Cocoa ______ is a message and a corresponding object sent to an application in response to some action taken by the user.

Answer

Correct Answer: event

Note: This Question is unanswered, help us to find answer for this one

75. True or False? Memory management is completely automatic.

Answer

Correct Answer: False

Note: This Question is unanswered, help us to find answer for this one

76. ______ is NOT a type of Mac OS X on-screen window.

Answer

Correct Answer: Cursor Window

Note: This Question is unanswered, help us to find answer for this one

77. In Xcode, what does the Identity Inspector do?

Answer

Correct Answer: Set the properties of an object

Note: This Question is unanswered, help us to find answer for this one

78. _______ class allows you to journal events in your application.

Answer

Correct Answer: NSLog

Note: This Question is unanswered, help us to find answer for this one

79. _______ is the object persistence framework included with Foundation Kit.

Answer

Correct Answer: Core Data

Note: This Question is unanswered, help us to find answer for this one

80. ______ is Apple's computing infrastructure that consists of Mach, Unix services, and Mac OS X networking and filesystems.

Answer

Correct Answer: Darwin

Note: This Question is unanswered, help us to find answer for this one

81. ______ class will implement a mutex.

Answer

Correct Answer: NSLock

Note: This Question is unanswered, help us to find answer for this one

82. Which control can the user add a small piece of data?

Answer

Correct Answer: UITextField

Note: This Question is unanswered, help us to find answer for this one

83. In the XCode window, the _____ lists files, search results, and build settings.

Answer

Correct Answer: Project View

Note: This Question is unanswered, help us to find answer for this one

84. True or False? Objective-C is a static typed language.

Answer

Correct Answer: False

Note: This Question is unanswered, help us to find answer for this one

85. In the Interface Builder, the _______ contains stock items in Cocoa that you can drag-and-drop into your application.

Answer

Correct Answer: Library Palette

Note: This Question is unanswered, help us to find answer for this one

86. Which control wold you want to use as a data source?

Answer

Correct Answer: UITableView

Note: This Question is unanswered, help us to find answer for this one

87. True or False? Objective-C does not have a constructor or destructor.

Answer

Correct Answer: True

Note: This Question is unanswered, help us to find answer for this one

88. Objective-C uses the concept of ______ which allows modifications to an existing class in-place.

Answer

Correct Answer: categories

Note: This Question is unanswered, help us to find answer for this one

89. In Objective-C, methods are represented by a ______ which is a string describing the method to call.

Answer

Correct Answer: selector

Note: This Question is unanswered, help us to find answer for this one

90. What does GCD stand for?

Answer

Correct Answer: Grand Central Dispatch

Note: This Question is unanswered, help us to find answer for this one

91. True or False? Cocoa allows you to move objects in the main nib to other separate nibs to improve load performance.

Answer

Correct Answer: True

Note: This Question is unanswered, help us to find answer for this one

92. The most commonly used debugger used with Cocoa is ______.

Answer

Correct Answer: GDB

Note: This Question is unanswered, help us to find answer for this one

93. A property:

Answer

Correct Answer: sets getter/setter methods

Note: This Question is unanswered, help us to find answer for this one

94. What are atomic and nonatomic associated with?

Answer

Correct Answer: Multithreading

Note: This Question is unanswered, help us to find answer for this one

95. True or False? A Cocoa program may not be compiled from a command-line prompt.

Answer

Correct Answer: False

Note: This Question is unanswered, help us to find answer for this one

96. The "NS" in NSObject stands for:

Answer

Correct Answer: Next Step

Note: This Question is unanswered, help us to find answer for this one

97. True or False? Objective-C classes are objects.

Answer

Correct Answer: True

Note: This Question is unanswered, help us to find answer for this one

98. Imutable objects can't be__:

Answer

Correct Answer: changed

Note: This Question is unanswered, help us to find answer for this one

99. A _________ file stores all information about an application's user interface objects.

Answer

Correct Answer: nib

Note: This Question is unanswered, help us to find answer for this one

100. Whenever you customize an existing class, it is called:

Answer

Correct Answer: subclassing

Note: This Question is unanswered, help us to find answer for this one

101. What does the term "nil" mean in reference to a variable?

Answer

Correct Answer: No object is in reference to the variable

Note: This Question is unanswered, help us to find answer for this one

102. True or False? NSDictionary objects can be changed after initialization.

Answer

Correct Answer: False

Note: This Question is unanswered, help us to find answer for this one

103. OOP stands for Object Oriented Programming. It is used for:

Answer

Correct Answer: Code reuse

Note: This Question is unanswered, help us to find answer for this one

104. The ________ is a framework that defines a base layer of Objective-C classes.

Answer

Correct Answer: Foundation Kit

Note: This Question is unanswered, help us to find answer for this one

105. Application ______ are stored in a file with a .icns extension.

Answer

Correct Answer: icons

Note: This Question is unanswered, help us to find answer for this one

106. Which objects are NOT part of Cocoa framework?

Answer

Correct Answer: NSApple

Note: This Question is unanswered, help us to find answer for this one

107. Which one is NOT a UI control in Xcode?

Answer

Correct Answer: ASP Textbox

Note: This Question is unanswered, help us to find answer for this one

108. ________ is used to create application interfaces and make connections between interface objects.

Answer

Correct Answer: Interface Builder

Note: This Question is unanswered, help us to find answer for this one

109. Which objects do NOT exist in the Cocoa framework?

Answer

Correct Answer: NSRedman

Note: This Question is unanswered, help us to find answer for this one

110. Which Cocoa class is used to create a string?

Answer

Correct Answer: NSString

Note: This Question is unanswered, help us to find answer for this one

111. What does a debugger do?

Answer

Correct Answer: Helps finds errors in your code.

Note: This Question is unanswered, help us to find answer for this one

112. AutoReleasePool BEST refers to:

Answer

Correct Answer: Memory Management

Note: This Question is unanswered, help us to find answer for this one

113. What framework(s) make up Cocoa?

Answer

Correct Answer: AppKit and Foundation

Note: This Question is unanswered, help us to find answer for this one

114. The Cocoa Framework is OOP. Why is that helpful?

Answer

Correct Answer: OOP allows the coder to reuse and customize existing objects into their new code.

Note: This Question is unanswered, help us to find answer for this one

115. True or False? Cocoa uses the Model-View-Controller (MVC) design pattern.

Answer

Correct Answer: True

Note: This Question is unanswered, help us to find answer for this one

116. There is only one computer you can code IOS on. Which is it?

Answer

Correct Answer: Mac

Note: This Question is unanswered, help us to find answer for this one

117. The Cocoa API for iOS is called?

Answer

Correct Answer: Cocoa Touch

Note: This Question is unanswered, help us to find answer for this one

118. What IDE does iOS use?

Answer

Correct Answer: Xcode

Note: This Question is unanswered, help us to find answer for this one

119. Which extension file is NOT in use in Xcode?

Answer

Correct Answer: Possesion.aspx

Note: This Question is unanswered, help us to find answer for this one

120. _______ provides Cocoa as its object-oriented appliciation programming interface (API).

Answer

Correct Answer: Apple

Note: This Question is unanswered, help us to find answer for this one

121. All of Cocoa's built in classes start with:

Answer

Correct Answer: NS

Note: This Question is unanswered, help us to find answer for this one

122. True or False? The two most important Mac OS X developer tools are XCode (formerly Project Builder) and Interface Builder.

Answer

Correct Answer: True

Note: This Question is unanswered, help us to find answer for this one

123. What is the proper statement?

Answer

Correct Answer: label.text = @"Hello World";

Note: This Question is unanswered, help us to find answer for this one

124. Which objects DO exist in the Cocoa framework?

Answer

Correct Answer: NSLog

Note: This Question is unanswered, help us to find answer for this one

125. Does the current iOS version support multitasking?

Answer

Correct Answer: Yes

Note: This Question is unanswered, help us to find answer for this one

126. Which language are iOS apps coded in?

Answer

Correct Answer: Objective-C

Note: This Question is unanswered, help us to find answer for this one

127. Before you can begin,you must download and install the ____.

Answer

Correct Answer: iOS SDK

Note: This Question is unanswered, help us to find answer for this one

128. Which statement is correct:

Answer

Correct Answer: NSColor* houseColor = [housePaintObj color];

Note: This Question is unanswered, help us to find answer for this one

129. Which is the correct statement:

Answer

Correct Answer: #import <UIKit/UIKit.h>

Note: This Question is unanswered, help us to find answer for this one

130. ______ is the root class for most classes in the Objective-C class hierarchy.

Answer

Correct Answer: NSObject

Note: This Question is unanswered, help us to find answer for this one

131. _______ is Cocoa's integrated development environment (IDE).

Answer

Correct Answer: XCode

Note: This Question is unanswered, help us to find answer for this one

132. What is protocol?

Answer

Correct Answer: Part of classes interface

Note: This Question is unanswered, help us to find answer for this one

133. A ________ is a list of information read by applications while they are launching.

Answer

Correct Answer: property list

Note: This Question is unanswered, help us to find answer for this one

134. __________ is NOT one of the Cocoa Objective-C object libraries.

Answer

Correct Answer: Touch Kit

Note: This Question is unanswered, help us to find answer for this one