Which of the following are valid java identifiers
Course:- Management Information Sys
Reference No.:- EM131424275

Assignment Help
Expertsmind Rated 4.9 / 5 based on 47215 reviews.
Review Site
Assignment Help >> Management Information Sys


1- Think Java: Chapter 1, 2, 3, 8.

2.OCA: Chapter 1, 2, 3

Exercise on paper: (1 points each)

1. Write Java statements that accomplish each of the following tasks:

a) Display the message "Enter an integer: ", leaving the cursor on the same line.

b) Assign the product of variables b and c to variable a.

c) Use a comment to state that a program performs a sample payroll calculation.

2.Which of the following Java statements contain variables whose values are modified?

a) p = i + j + k + 7;

b) System.out.println("variables whose values are modified");

c) System.out.println("a = 5");

d) value = input.nextInt();

3. Given that y = ax3 + 7, which of the following are correct Java statements for this equation?

a) y = a * x * x * x + 7;

b) y = a * x * x * (x + 7);

c) y = (a * x) * x * (x + 7);

d) y = (a * x) * x * x + 7;

e) y = a * (x * x * x) + 7;

f) y = a * x * (x * x + 7);

Following assignments are from OCA: Oracle®Certified Associate Java® SE 8 Programmer I

Ch1- Review Questions

(hint: try out in your java program if not sure)

4.Which of the following are valid Java identifiers? (Choose all that apply)

A. A$B

B. _helloWorld

C. true

D. java.lang

E. Public

F. 1980_s

5.What is the output of the following program?

1: public class WaterBottle {

2: private String brand;

3: private boolean empty;

4: public static void main(String[] args) {

5: WaterBottlewb = new WaterBottle();

6: System.out.print("Empty = " + wb.empty);

7: System.out.print(", Brand = " + wb.brand);

8: } }

G. Line 6 generates a compiler error.

H. Line 7 generates a compiler error.

I. There is no output.

J. Empty = false, Brand = null

K. Empty = false, Brand =

L. Empty = null, Brand = null

6.In the following code block, which of the following are true?

4: short numPets = 5;

5: intnumGrains = 5.6;

6: String name = "Scruffy";

7: numPets.length();

8: numGrains.length();

9: name.length();

(Choose all that apply)

M. Line 4 generates a compiler error.

N. Line 5 generates a compiler error.

O. Line 6 generates a compiler error.

P. Line 7 generates a compiler error.

Q. Line 8 generates a compiler error.

R. Line 9 generates a compiler error.

S. The code compiles as is.

Put your comment

Ask Question & Get Answers from Experts
Browse some more (Management Information Sys) Materials
Search the Internet or the library and find a real-world example of each of the four types of computer crime. Write a 5 page (1800 words) paper using APA Style. Discuss the
The organization should develop a comprehensive Business Continuity Plan. A formal risk assessment should be undertaken in order to determine the requirements for the Business
Computer security is not an issue for organizations alone. Anyone whose personal computer is connected to a network or the Internet faces a potential risk of attack. Identify
The project is to build an Under Armour store at an overseas location in an US base in Kadena, Japan. Develop a three-level WBS (project level, milestone level, and task level
Issues a status message to the customer, and generates a shipping order to the warehouse, which fills the order. When the order is shipped, the customer is billed. The syste
Discuss why HCI is important and has evolved to ensure that the needs of different kinds of users are taken into account in computer systems. Discuss the application of speec
Research an open source software project. Examples of open source projects are listed on page 123 of your textbook. You are not restricted to the open source projects liste
The cause of a patient's health can be very closely related to their individual attributes. For example, a person with a family history of high blood pressure or mental illn