State whether each of the following is true or false. If false, explain why.
a). An algorithm is a procedure for solving a problem in terms of the actions to execute and the order in which these actions execute.
b). A set of statements contained within a pair of parentheses is called a block.
c). A selection statement specifies that an action is to be repeated while some condition remains true.
d). A nested control statement appears in the body of another control statement.
e). Java provides the arithmetic compound assignment operators +=, -=, *=, /= and %= for abbreviating assignment expressions.
f). The primitive types (boolean, char, byte, short, int, long, float and double) are portable across only Windows platforms.
g).Specifying the order in which statements (actions) execute in a program is called program control.
h). The unary cast operator (double) creates a temporary integer copy of its operand.
i). Instance variables of type boolean are given the value TRue by default.
j).Pseudocode helps a programmer think out a program before attempting to write it in a programming language.
Write four different Java statements that each add 1 to integer variable x.
a). An algorithm is a procedure for solving a problem in terms of the actions to execute and the order in which these actions execute.
True
b). A set of statements contained within a pair of parentheses is called a block.
False
A block is a set of statements enclosed in curly braces.
c). A selection statement specifies that an action is to be repeated while some condition remains true.
False
The select statement indicates what action should be performed if some condition is true, and what should happen if the condition is not true.
d). A nested control statement appears in the body of another control statement.
True
e). Java provides the arithmetic compound assignment operators +=, -=, *=, /= and %= for abbreviating assignment expressions.
True
f). The primitive types (boolean, char, byte, short, int, long, float and double) are portable across only Windows platforms.
False
Java is a platform independent language, primitive types will work the same on all systems.
g).Specifying the order in which statements (actions) execute in a program is called program control.
True
h). The unary cast operator (double) creates a temporary integer copy of its operand.
False
Converts the value on the right to double.
i). Instance variables of type boolean are given the value TRue by default.
False
By default, it is not initialized with anything.
j).Pseudocode helps a programmer think out a program before attempting to write it in a programming language.
True
x += 1;
x = x + 1;
x++;
++x;
Comments
Leave a comment