Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

QUESTION 1 The following is the body of the main method of a class. It has a syntax error. value =30; System.out.println(value); True False 10

QUESTION 1 The following is the body of the main method of a class. It has a syntax error. value =30; System.out.println(value); True False 10 points QUESTION 2 Which statement correctly declares a variable tuition of a floating point data type? int tuition; double tuition; tuition float; floating_point tuition; 10 points QUESTION 3 Which of the following are syntactically correct? int number=20; float number; int number; number=20; int number; int number=20; int number =20; 10 points QUESTION 4 What will be output when the following code executes? You may want to test it to help you figure out the correct answer. System.out.println(1-0.9); 0 0.1 0.09999999999999998 0.10000000000000001 10 points QUESTION 5 Study the Java documentation for Math class. The data type of Math.E is ; the data type of Math.PI is . 10 points QUESTION 6 The output of System.out.println(9/5); is The output of System.out.println(9.0/5.0); is 10 points QUESTION 7 Indicate the outputs when the following code executes: int i=5; System.out.println(i++); // output is: System.out.println(i); // output is: 10 points QUESTION 8 Indicate the outputs when the following code executes: int i=5; System.out.println(++i); // output is: System.out.println(i); // output is: 10 points QUESTION 9 Use your computer to test the code for the correct answer. What is the output when the following code executes: System.out.printf("%.1f ", 1-0.9); 10 points QUESTION 10 What is the output generated by the following code ? System.out.printf("%d*%d = %d ", 2, 3, 2*3); 2*3 = 2*3 2.0*3.0 = 6.0 2*3 = 6 A runtime error will be produced. 10 points QUESTION 11 Which of the following will produce this output: 2*pi = 6.28 System.out.printf("%d*pi = %.2f ", 2, 2*Math.PI); System.out.printf("%.0f*pi = %.2f ", 2, 2.0*Math.PI); System.out.printf("%d*%s = %.2f ", 2, "pi", 2*Math.PI); System.out.printf("%d*pi = %d ", 2, 2*Math.PI); 10 points QUESTION 12 Implement Example program 1 in Chapter 2 (pages 45-46, Listing 2.2). Run the implemented program. Copy and paste your source code and the output of your program. For the toolbar, press ALT+F10 (PC) or ALT+FN+F10 (Mac). Path: pWords:0 20 points Click Save and Submit to save and submit. Click Save All Answers to save all answers.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Introduction To Databases And Data Warehouses

Authors: Nenad Jukic, Susan Vrbsky, Svetlozar Nestorov

1st Edition

1943153191, 978-1943153190

More Books

Students also viewed these Databases questions

Question

Who do you know that is a member of a microcultural group?

Answered: 1 week ago