Programming and Problem Solving with Java

(やまだぃちぅ) #1

90


Answers
1.Syntax is the set of rules that defines valid constructs in a programming language.2.Meaningful identifiers
make the code easier to debug and maintain.3.The actual value of the primitive type is stored in the variable.
4.A class in Java defines an object that can be instantiated. In the abstract sense, a class describes an object in
a problem.5.Objects in Java represent objects in the general sense through code that simulates their behavior.
6.It is a primitive type.7.The use of the reserved word final.8.The memory address where the object’s data is
stored.9.The argument values are copied into the parameter variables of the method and the method is exe-
cuted. When it returns, execution resumes with the next statement. 10. A public class containing a method
named main.11.The use of the reserved word voidinstead of a class name or type name.12.Unless your last
name is hyphenated, it probably is a valid Java identifier.13.final charZED = 'Z';
14.charletter;
String street;
15.street = "Elm";16.street = street + " Street";17.A class heading consists of modifiers, the reserved
word class, and a name. The body is a block.18.A method heading consists of modifiers, the reserved word
void, a name, and a parameter list. The body is a block.
19.System.out.print("Introduction to Programming and Problem Solving with Java");
20.newName()
21.String address; // Employee's street address,
// including apartment
or
String address; /* Employee's street address,
including apartment */
22.The answer is Abraham Lincoln

Exam Preparation Exercises


1.Mark the following identifiers either valid or invalid.
Valid Invalid
a. item#1 ______ ______
b. data ______ ______
c. y ______ ______
d. 3Set ______ ______
e. PAY_DAY ______ ______
f. bin–2 ______ ______
g. num5 ______ ______
h. Sq Ft ______ ______

T


E


A


M


F


L


Y


Team-Fly®

Free download pdf