[ Quiz Answers | Chapter Index | Main Index ]

Quiz on Chapter 2

This page contains questions on Chapter 2 of Introduction to Programming Using Java. You should be able to answer these questions about studying that chapter. Sample answers to these questions can be found here.

Question 1:

Briefly explain what is meant by the syntax and the semantics of a programming language. Give an example to illustrate the difference between a syntax error and a semantics error.

Question 2:

What does the computer do when it executes a variable declaration statement. Give an example.

Question 3:

What is a type, as this term relates to programming?

Question 4:

One of the primitive types in Java is boolean. What is the boolean type? Where are boolean values used? What are its possible values?

Question 5:

Give the meaning of each of the following Java operators:

a)    ++

b)    &&

c)    !=
Question 6:

Explain what is meant by an assignment statement, and give an example. What are assignment statements used for?

Question 7:

What is meant by precedence of operators?

Question 8:

What is a literal?

Question 9:

In Java, classes have two fundamentally different purposes. What are they?

Question 10:

What is the difference between the statement "x = TextIO.getDouble();" and the statement "x = TextIO.getlnDouble();"

Question 11:

Explain why the value of the expression 2 + 3 + "test" is the string "5test" while the value of the expression "test" + 2 + 3 is the string "test23". What is the value of "test" + 2 * 3 ?

Question 12:

Integrated Development Environments such as Eclipse often use syntax coloring, which assigns various colors to the characters in a program to reflect the syntax of the language. A student notices that Eclipse colors the word String differently from int, double, and boolean. The student asks why String should be a different color, since all these words are names of types. What's the answer to the student's question?


[ Quiz Answers | Chapter Index | Main Index ]