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.

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

6.

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

7.

Is NSRunLoop thread safe?

Answer

Correct Answer: No

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

8.

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

9.

Fill the blank
NSView : <> : NSObject

Answer

Correct Answer: NSResponder

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

10.

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

11.

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

12.

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

13.

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

14.

What is Cocoa?

Answer

Correct Answer: A framework

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

15.

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

16.

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

17.

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

18.

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

19.

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

20.

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

21.

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

22.

Is there a double click event?

Answer

Correct Answer: No

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

23.

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

24.

Can resources be localized?

Answer

Correct Answer: Yes

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

25.

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

26.

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

27.

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

28.

What is NSViewHeightSizable constant used for?

Answer

Correct Answer: Autoresizing

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

29.

Can POSIX thread be used in Cocoa?

Answer

Correct Answer: Yes

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

30.

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

31.

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

32.

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

33.

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

34.

Does Cocoa support 64bits?

Answer

Correct Answer: Yes

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

35.

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

36.

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

37.

Can you detach threads in Cocoa?

Answer

Correct Answer: Yes

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

38.

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

39.

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

40.

Fill the blank
NSMutableArray : <> : NSObject

Answer

Correct Answer: NSArray

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

41.

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

42.

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

43.

What is NSRect?

Answer

Correct Answer: A structure

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

44.

Fill the blank.
NSCountedSet : <> : NSObject

Answer

Correct Answer: NSMutableSet : NSSet

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

45.

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

46.

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

47.

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

48.

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

49.

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

50.

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

51.

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

52.

Fill the blank.
NSButton : <> : NSObject

Answer

Correct Answer: NSControl : NSView : NSResponder

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

53.

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

54.

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

55.

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

56.

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

57.

Is NSString mutable?

Answer

Correct Answer: No

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

58.

In which language is Cocoa written?

Answer

Correct Answer: Objective-C

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

59.

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

60. 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

61. 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

62. Which does not belong in web infrastructure:

Answer

Correct Answer: Mainframe

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

63. 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

64. ________ are NOT a Cocoa event.

Answer

Correct Answer: Repeating events

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

65. 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

66. 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

67. _______ is not a subclass of NSResponder.

Answer

Correct Answer: NSEvent

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

68. 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

69. 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

70. 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

71. 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

72. 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

73. 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

74. 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

75. ______ 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

76. 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

77. _______ 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

78. _______ 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

79. ______ 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

80. ______ class will implement a mutex.

Answer

Correct Answer: NSLock

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

81. 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

82. 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

83. 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

84. 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

85. 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

86. 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

87. 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

88. 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

89. What does GCD stand for?

Answer

Correct Answer: Grand Central Dispatch

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

90. 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

91. 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

92. A property:

Answer

Correct Answer: sets getter/setter methods

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

93. What are atomic and nonatomic associated with?

Answer

Correct Answer: Multithreading

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

94. 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

95. The "NS" in NSObject stands for:

Answer

Correct Answer: Next Step

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

96. 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

97. Imutable objects can't be__:

Answer

Correct Answer: changed

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

98. 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

99. 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

100. 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

101. 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

102. 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

103. 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

104. 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

105. 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

106. 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

107. ________ 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

108. 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

109. 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

110. 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

111. 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

112. 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

113. 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

114. 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

115. 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

116. What IDE does iOS use?

Answer

Correct Answer: Xcode

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

117. 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

118. _______ 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

119. 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

120. 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

121. 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

122. 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

123. Does the current iOS version support multitasking?

Answer

Correct Answer: Yes

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

124. 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

125. 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

126. Which statement is correct:

Answer

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

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

127. 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

128. ______ 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

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

Answer

Correct Answer: XCode

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

130. What is protocol?

Answer

Correct Answer: Part of classes interface

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

131. 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

132. __________ 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

search
Cocoa Programming For Mac OS X Subjects