quick quiz on objective-c

15
Computer Science Large Practical: Quick quiz on Objective-C Stephen Gilmore School of Informatics Friday 19th October, 2012 Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 19th October, 2012 1 / 15

Upload: stephen-gilmore

Post on 25-Dec-2014

1.799 views

Category:

Education


4 download

DESCRIPTION

A quick quiz to point out some of the differences between Objective-C and Java.

TRANSCRIPT

Page 1: Quick quiz on Objective-C

Computer Science Large Practical:

Quick quiz on Objective-C

Stephen Gilmore

School of Informatics

Friday 19th October, 2012

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 19th October, 2012 1 / 15

Page 2: Quick quiz on Objective-C

Question: Does this program print Yes, No or neither?

shot 2012-10-19 at 09.47.10.png

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 19th October, 2012 2 / 15

Page 3: Quick quiz on Objective-C

Answer: it prints Yes.

shot 2012-10-19 at 09.47.10.png

. . . it prints Yes.

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 19th October, 2012 3 / 15

Page 4: Quick quiz on Objective-C

Question: Does this program print Yes, No or neither?

shot 2012-10-19 at 09.48.50.png

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 19th October, 2012 4 / 15

Page 5: Quick quiz on Objective-C

Answer: it prints No.

shot 2012-10-19 at 09.48.50.png

. . . it prints No.

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 19th October, 2012 5 / 15

Page 6: Quick quiz on Objective-C

Question: Does this program print Yes, No or neither?

shot 2012-10-19 at 09.49.52.png

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 19th October, 2012 6 / 15

Page 7: Quick quiz on Objective-C

Answer: neither, it throws an exception.

shot 2012-10-19 at 09.49.52.png

. . . neither, it throws an exception.

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 19th October, 2012 7 / 15

Page 8: Quick quiz on Objective-C

Question: Does this program print Yes, No or neither?

shot 2012-10-19 at 09.50.17.png

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 19th October, 2012 8 / 15

Page 9: Quick quiz on Objective-C

Answer: it prints No.

shot 2012-10-19 at 09.50.17.png

. . . it prints No.

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 19th October, 2012 9 / 15

Page 10: Quick quiz on Objective-C

Question: Does this program print Yes, No or neither?

shot 2012-10-19 at 10.23.38.png

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 19th October, 2012 10 / 15

Page 11: Quick quiz on Objective-C

Answer: it prints No, because we are using pointer equality

shot 2012-10-19 at 10.23.38.png

. . . it prints No, because we are using pointer equality

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 19th October, 2012 11 / 15

Page 12: Quick quiz on Objective-C

Question: Does this program print Yes, No or neither?

shot 2012-10-19 at 10.24.29.png

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 19th October, 2012 12 / 15

Page 13: Quick quiz on Objective-C

Answer: it prints Yes, because we are using contentequality

shot 2012-10-19 at 10.24.29.png

. . . it prints Yes, because we are using content equality

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 19th October, 2012 13 / 15

Page 14: Quick quiz on Objective-C

Question: Does this program print Yes, No or neither?

shot 2012-10-19 at 10.41.28.png

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 19th October, 2012 14 / 15

Page 15: Quick quiz on Objective-C

Answer: neither, it throws an exception because we forgotto call init

shot 2012-10-19 at 10.41.28.png

. . . neither, it throws an exception because we forgot to call init

Stephen Gilmore (School of Informatics) Computer Science Large Practical Friday 19th October, 2012 15 / 15