Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1) Which one of the following statements is true? (1 pt.) A) int, double char, short, long, float, and String are primitive data types B)
1) Which one of the following statements is true? (1 pt.) A) int, double char, short, long, float, and String are primitive data types B) int,char, short, long, and String are primitive data types but double and float are not C) int, char, double, float, and String are primitive data types but short and long are not D) int, char, short, long, double, and float are primitive data types but String is not. 2) Which of the following is an incorrect rule when naming identifiers (such as variables)? (1 pt.) A) Identifiers can contain one space. B) Uppercase and lowercase characters are distinct. C) After the first character, you may use the letters a-z, A-Z, the underscore, a dollar sign, or digits 0-9. D) The first character must be one of the letters a-z, A-Z, and underscore or a dollar sign. 3) On a new java program; (4 pts) a) declare a string variable named largestPlanet and initialize it to "Jupiter". b) What does largestPlanet.length() return? Answer: c) What is the index of last character in largestPlanet? Answer: d) What does largestPlanet.charAt(4) return? Answer: 4) Which of the following are not valid assignment statements in java? (2 pts) a. total = 9; b. 72 = amount; c. profit = 129 d. character = 'W; 5) What is the output of the following java program? (2 pts) public class question5 { public static void main(String[] args) { int cost = 10; int items = 5 float tax = 3.5F; System.out.println("total cost: " + (cost * items + tax)); } } a) total cost: 85 b) total cost: (10 * 5+ 3.5F) c) total cost: 53.5 d) "total cost: " 85F|
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started