Question
what are the answes

Which yields 2.5? (double)(10/4) (int)(10) / (int)(4) 10/4 (double)(10) / (double)(4)
Considering integer division, determine the result of 13 / 3 4.3 05 4.0 4
Which of the following statements is a valid declaration of a constant integer variable named STEP_SIZE? int STEP_SIZE = 5; O
Which is an invalid identifier? num_Cars1 3numCars O_numCars numCars
Which one is not a programming language. Java D OC++ Ос
Indicate which of the following comments is invalid. Ou Get user input /* Get user input / * Get user input/ /* Get user inpu
Assuming that the variable numDogs has been declared, select the statement which doesnt contain any syntax errors. System.ou
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Question 1 : option 4 is right answer

(double)(10)/(double)(4)

Explanations :

1 þublic class Main 2 - 3 public static void main(String[] args) { 4 System.out.println((double)(10/4)); 5 } 6 } 2.0 ... Prog

(double)(10/4) in this statement first perform the 10/4 which gives 2 then convert into double so Output is 2.0

So option 1 is wrong

1 2 public class Main 3- { 4 public static void main(String[] args) { 5 System.out.println((int)(10)/(int)(4)); 6 7 } } 8 2 .

(int)(10)/(int)(4) In this statement 10 and 4 convert into integers then perform division operation

10/4 = 2 So option 2 is wrong. we need output 2.5

1 þublic class Main 2-{ 3 public static void main(String[] args) { 4. System.out.println(10/4); 5 6} 7 ها 2 ... Program finis

10/4 = 2 So option 3 is wrong

1 public class Main 2 { 3 public static void main(String[] args) { 4 System.out.println((double)(10)/(double)(4)); 5 6 } 7 }

(double)(10)/(double)(4) first 10 and 4 convert to double then perform the division operation

10.0 / 4.0 = 2.5

So option 4 is Right Answer

===================================

Question 2 : Option 4 is right answer

4

1 public class Main 2-{ 3 public static void main(String[] args) { 4 System.out.println(13/3); 5 } 6 } 4 ... Program finished

13/3 = 4

integer division 13/3 = 4

remaining options are wrong

=====================================

Question 3 : Option 2 is right answer

final int STEP_SIZE = 14;

final is used for constant variable. You can not change that value. If you try to change that variable value you will get error.

=============================

Question 4 : Option 2 is right answer

3numCars

An identifier CAN NOT start with a number. So Option 2, 3numCars is invalid

remaining options are valid

===============================

Question 5 : Option 2 right answer

D

D is NOT a programming Language

Java is a programming Language

C++ is a programming Language

C is a programming Language

==========================

Question 6 : Option 4 is right Answer

/* Get user input

// Get user input it is a single line comment it is valid

/* Get user

input */ is is multiline comment valid

/* Get user input */ it is also valid multiline comment

/* Get user input it is Invalid Comment

===========================

Question 7 : Option 4 is right answer

System.out.print(numDogs);

1 public class Main 2-{ 3 public static void main(String[] args) { 4 System.out.print(Amy // Michael) 5 6 } input } Compila

Semicolon ; is missing at end of print statement. So option 1 is wrong

1 public class Main 2 - { 3 public static void main(String[] args) { 4 int numDogs = 10; 5 system.print(numDogs); 6 ها input

out is missing in print Statement So option 2 is wrong

1 public class Main 2 - 3 public static void main(String[] args) { 4 int numDogs = 10;| 5 System.out.print(NumDogs); 6 } inpu

numDogs is declared, but NumDogs NOT declared. SO option 3 is wrong

1 public class Main 2. { 3 public static void main(String[] args) { 4 int numDogs = 10; 5 System.out.print(numDogs);|| 6 } 10

No error in option 4 So option 4 is right answer.

Note : If you have any doubt please comment.

Please give a up vote

Thank you....

Add a comment
Know the answer?
Add Answer to:
what are the answes Which yields 2.5? (double)(10/4) (int)(10) / (int)(4) 10/4 (double)(10) / (double)(4) Considering...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • whats the answers Assuming that the variable numDogs has been declared, select the statement which doesn't...

    whats the answers Assuming that the variable numDogs has been declared, select the statement which doesn't contain any syntax errors. System.out.print("Amy // Michao1") System.print(numDogs); System.out.print(NumDogs) System.out.print(numDogs); Which of the following statements is a valid declaration of a constant integer variable named STEP_SIZE? int STEP SIZE = 5; final int STEP SIZE - 14: double STEP_SIZE = 5; final STEP_SIZE = 10; If the goal output is: Say "Hello" what needs to be written inside of the parenthesis in the print...

  • Which of the following are valid array declarations? a. int[] array- new int[10]; b. double [array...

    Which of the following are valid array declarations? a. int[] array- new int[10]; b. double [array double[10]; c. charl charArray "Computer Science"; None of the above Analyze the following code: class Test public static void main(Stringl] args) System.out.println(xMethod(10); public static int xMethod(int n) System.out.println("int"); return n; public static long xMethod(long n) System.out.,println("long"); return n The program displays int followed by 10 The program displays long followed by 10. The program does not compile. None of the above. tions 3-4 are...

  • 9) 10 pts. What is the final result that will be stored in "a? double a...

    9) 10 pts. What is the final result that will be stored in "a? double a = 3. double b = 12. double c = 4 .; a 3. For 10 & 11 use the following function prototype: void Funl (int a, float c, double d); 10) 5 pts. Write the function call. Include the variable definitions. 11) 5 pts. Write the function header with an empty function body. 12) 5 pts The following code does NOT get a runtime...

  • Assignment: Write a program that prompts the user to enter 10 numbers, and then displays the...

    Assignment: Write a program that prompts the user to enter 10 numbers, and then displays the mean and standard deviation of these numbers I already have the source code all done. I just need this translated into a flowchart. Again I just need the flowchart, not any source code. I have already provided the source code below. Need Flowchart version of my code Here is the source code: public class Mean_Standard_Deviation {    public static void main(String[] args) {   ...

  • Step 4: Add code that discards any extra entries at the propmt that asks if you...

    Step 4: Add code that discards any extra entries at the propmt that asks if you want to enter another score. Notes from professor: For Step 4, add a loop that will validate the response for the prompt question:       "Enter another test score? (y/n): " This loop must only accept the single letters of ‘y’ or ‘n’ (upper case is okay). I suggest that you put this loop inside the loop that already determines if the program should collect...

  • *****language : java****** ceate a class RightTriangle with three instance variables of type double called base,...

    *****language : java****** ceate a class RightTriangle with three instance variables of type double called base, height, and hypotenuse and three instance variables of type int called ID, xLoc and yLoc. Also add a static variable of type double called scaleFactor. This should be initialized to a default value of 1. Then define an appropriate constructor that takes initial values for all instance variables except hypotenuse and sets the values of all instance variables including calculating the hypotenuse. Then define...

  • what are the answers Which detects if x is in the range -4 to +4? (x...

    what are the answers Which detects if x is in the range -4 to +4? (x < -5) AND (* < 5) O (x >-5) AND (* < 5) O (X <-5) OR (x < 5) O (x > -5) OR (* < 5) If the final else branch executes, what must userNum have been? Type "unknown" if appropriate. if (userNum < 9) { > else if (userNum > 11) -- > else { ... // userNum if this executes...

  • Java Code please read comments and add the code to required lines....LINE 1 to LINE 5...

    Java Code please read comments and add the code to required lines....LINE 1 to LINE 5 ********************************************************************** * Program Summary: This program demonstrates these basic Java concepts: * - Creating an array based on user input * - Accessing and displaying elements of the array * * The program should declare an array to hold 10 integers. * The program should then ask the user for an integer. * The program should populate the array by assigning the user-input integer...

  • Consider the following Java method: public static ArrayList<Integer nums ArrayList<Integer values new ArrayList<Integer0; for(int i=10; i<30;...

    Consider the following Java method: public static ArrayList<Integer nums ArrayList<Integer values new ArrayList<Integer0; for(int i=10; i<30; i-i+3) if(i%) values.add(i); return values: What is returned after the method call nums()? a. [12] b. [13] c. [14] d. [15] e. [16] O Which of the following represents the final output of the code segment below? int k: int[]A; A new int[3]: fork-0; k<A.length;k++) A[k]-A.length-k; forſk-0; k<A.length-1; k++) A[k+1]-A[k) for(int i-0;i<A.length;i++) System.out.print(A[i]+" "); a. 222 O b. 333 c. 444 d. 555 O...

  • Topics: About Java What is a compiler, and what does it do? Characteristics of the languageStrongly...

    Topics: About Java What is a compiler, and what does it do? Characteristics of the languageStrongly typed and statically typed Everything has a data type & data types must be declared Case sensitive Object oriented System.out.print() vs. System.out.println() How to use the Scanner class to obtain user input Data typesWhat are they? Know the basic types like: int, double, boolean, String, etc. Variables What is a variable? Declarations Initialization Assignment Constants Reserved words like: What is a reserved word? Examples:...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT