Ch. 2 – Java Fundamentals

Your page rank:

Total word count: 735
Pages: 3

Calculate the Price

- -
275 words
Looking for Expert Opinion?
Let us have a look at your work and suggest how to improve it!
Get a Consultant

Which one of the following would contain the translated Java byte code for a program named Demo?


To compile a program named First, use the following command:


A Java program must have at least one of these:

Class definition

In Java, the beginning of a comment is marked with:


The term ___________ typically refers to the device that displays console output.

Standard output device

In Java, ___________ must be declared before they can be used.


This is a value that is written into the code of a program


When the (+) operator is used with strings, it is known as the:

String concatenation operator

Which of the following is NOT a rule that must be followed when naming identifiers?

Identifiers can contain spaces.

Which of the following cannot be used as identifiers in Java?

Key words

In Java, it is standard practice to capitalize the first letter of:

Class names

Which of the following is not a primitive data type?


Which of the following is valid?

float w; w = 1.0f;

The boolean data type may contain values in the following range of values:

True or False

Character literals are enclosed in _____; string literals are enclosed in _____.

Single quotes; Double quotes

What is the result of the following expression? 10 + 5 * 3 – 20


What is the result of the following expression? 25 / 4 + 4 * 10 % 3


In the following Java statement what value is stored in the variable name?

String name = "John Doe";

The memory address where "John Doe" is located

Which of the following is not a valid comment statement?

*/ comment 3 /*

When saving a Java source file, save it with an extension of:


Every Java application program must have:

a method named "main"

To print "Hello, world" on the monitor, use the following Java statement:

System.out.println("Hello, world");

To display the output on the next line, you can use the println method or use this escape sequence in the print method.


This is a named storage location in the computer’s memory.


Variables are classified according to their:

Data type

The primitive data types only allow a(n) _____ to hold a single value.


If x has been declared an int, which of the following statements is invalid?

x = 1,000; NO COMMAS!

Given the declaration double r;, which of the following statements is invalid?

r = 2.9X106;

Variables of the boolean data type are useful for:

Evaluating true/false conditions

What is the result of the following expression? 25 – 7 * 3 + 12 / 3


What is the result of the following expression? 17 % 3 * 2 – 12 + 15


This is a variable whose content is read only and cannot be changed during the program’s execution.

Named constant

Which of the following is a valid Java statement?

String str = "John Doe";

Which of the following does NOT describe a valid comment in Java?

Multi-line comments, start with */ and end with /*

Which of the following statements correctly creates a Scanner object for keyboard input?

Scanner keyboard = new Scanner(;

Which Scanner class method reads an int?


Which Scanner class method reads a String?


Which one of the following methods would you use to convert a string to a double?


TRUE/FALSE: A Java program will not compile unless it contains the correct line numbers.


TRUE/FALSE: All Java statements end with semicolons.


TRUE/FALSE: Java is a case-insensitive language.


TRUE/FALSE: Although the dollar sign is a legal identifier character, you should not use it because it is normally used for special purposes.


TRUE/FALSE: Assuming that pay has been declared a double, the following statement is valid.
pay = 2,583.44;


TRUE/FALSE: Named constants are initialized with a value, that value cannot be changed during the execution of the program.


TRUE/FALSE: A variable’s scope is the part of the program that has access to the variable.


TRUE/FALSE: In Java the variable named total is the same as the variable named Total.


TRUE/FALSE: Class names and key words are examples of variables.


TRUE/FALSE: Both character literals and string literals can be assigned to a char variable.


TRUE/FALSE: If the compiler encounters a statement that uses a variable before the variable is declared, an error will result.


TRUE/FALSE: Programming style includes techniques for consistently putting spaces and indentation in a program so visual cues are created.


Share This

More flashcards like this

NCLEX 10000 Integumentary Disorders

When assessing a client with partial-thickness burns over 60% of the body, which finding should the nurse report immediately? a) ...

Read more


A client with amyotrophic lateral sclerosis (ALS) tells the nurse, "Sometimes I feel so frustrated. I can’t do anything without ...

Read more

NASM Flashcards

Which of the following is the process of getting oxygen from the environment to the tissues of the body? Diffusion ...

Read more

Unfinished tasks keep piling up?

Let us complete them for you. Quickly and professionally.

Check Price

Successful message