Answers to Self-Review Exercises (Sections C.1C.13)

C.1

a) sequence, selection, repetition.

b) if...else.

c) sentinel, signal, flag or dummy.

d) strongly typed.

e) prefixed.

C.2

a) False. A set of statements contained within a pair of braces ({ and }) is called a block.

b) False. A repetition statement specifies that an action is to be repeated while some condition remains true.

c) True.

d) True.

e) False. Instance variables of type boolean are given the value false by default.

C.3

a) z = x++ + y;

b)

if ( count > 10 )   System.out.println( "Count is greater than 10" );

c) total -= --x;

d)

q %= divisor;q = q % divisor;

C.4

a)

int sum;int x;

b) x = 1;

c) sum = 0;

d) sum += x; or sum = sum + x;

e) System.out.printf( ...

Get Android™ How to Program, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.