Question

For precious question, what O/P is produced (do no
0 0
Add a comment Improve this question Transcribed image text
Answer #1

18 previous question is missing so I did not post the answer for 18 th question19 Answer public class sumt public static void main (String [largs) t int v1-15; int v2-7 double sum=v1+v2; int r=v1802; int

copyable code

19.

Answer

public class sum{

     public static void main(String []args){

       int v1=15;

int v2=7;

double sum=v1+v2;

int r=v1%v2;

int larger ;

if(v1>v2)

larger=v1;

else

larger=v2;

System.out.println("the larger value is :"+larger+".sum="+sum+".remainder of v1/v2="+r);

    }

}

sh-4.3$ javac sum.java sh-4.3S java sum the larger value is 15, sum-22.0,remainder of v1/v2-1 sh-4.3$

20 Answer public class majorf public static void main(String [largs) ( int k-2; switch.(k) case 1:System.out.println (Major

copyable code

20.

Answer

public class major{

     public static void main(String []args){

       int k=2;

switch(k)

{

case 1:System.out.println("Major in CS");

break;

case 2:System.out.println("Major in ME");

case 3:System.out.println("Major in CS");

break;

case 4:System.out.println("Major in PM");

break;

default:System.out.println("Invalid Selection");

}

     }

}

sh-4.3s javac major.java sh-4.3 java major Major in ME Major in CS sh-4.3$

21. Answer public class countert public static void main(String [largs) ( int g 5 boolean doit=true; while(dolt) +q ]) Sys

copyable code

21.

Answer

public class counter{

     public static void main(String []args){

       int q=5;

boolean dolt=true;

while(dolt)

{

System.out.print("["+ q +"]");

if(q<0)dolt=false;

q--;

System.out.print("\n At end counter is"+ q+"\n");

}

     }

}

sh-4.3 javac counter.java sh-4.3 java counter At end counter is4[4] At end counter is3[3] At end counter is2[2] At end counte

Add a comment
Know the answer?
Add Answer to:
For precious question, what O/P is produced (do not show the price list), if the user...
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
  • ANS (2) 0R hat output is produced by the following code if user enters these values...

    ANS (2) 0R hat output is produced by the following code if user enters these values for a question asked by the progran .User entered 3 Enter a positive integer value! (enter -1 to end) :3 Enter a positive integer value! (enter -1 to end) five Enter a positive integer value! (enter -1 to end) :7 Enter a positive integer value! (enter -1 to end) :-1 User entered five -User entered 7 ...User entered -1 import java.util.Scanner: class Verify input...

  • cs 2130 - to be written in Java. Below the question part A I will provide...

    cs 2130 - to be written in Java. Below the question part A I will provide the code that is needed to complete the questions. Thank you so much for your help ! // Boolean Matrix Class public class BMat { // Instance variables public int M[][]; public int SIZE; // Boolean matrix constructors public BMat(int s) { SIZE = s; M = new int[SIZE][SIZE]; // Fill M with zeros for(int r = 0; r < SIZE; r++){ for(int c...

  • 2) What are the major products, P to AD produced in the following reactions? Where it...

    2) What are the major products, P to AD produced in the following reactions? Where it states stereochemistry, dashes and wedges must be used to show stereochemistry. Note: for some reaction enantiomers are formed. 15 Marks. One mark for each correct product. Must show stereochemistry and all products for full mark LIAIHA Р 1. CHCCNa 2 H0* 1. (CHSCHMgBr 2. H2O* 1. O 2.H.O. R U two product any order and v 1. CH CHẠMgar 2. H,O* CODE H2SO4 1.0,...

  • 2) What are the major products, P to AD produced in the following reactions? Where it...

    2) What are the major products, P to AD produced in the following reactions? Where it states stereochemistry, dashes and wedges must be used to show stereochemistry. Note: for some reaction enantiomers are formed. 15 Marks. One mark for each correct product. Must show stereochemistry and all products for full mark LIAIHA Р 1. CHCCNa 2 H0* 1. (CHSCHMgBr 2. H2O* 1. O 2.H.O. R U two product any order and v 1. CH CHẠMgar 2. H,O* CODE H2SO4 1.0,...

  • True False Question 2 (3 points) Given a singly linked list with more than two nodes,...

    True False Question 2 (3 points) Given a singly linked list with more than two nodes, to remove the second node from a linked list with only head reference, assume curr - head, next, you do Set curr.next to head.next Oset head. next to curr.next Set head, next to curr Oset head to curr.next TL th Question 3 (3 points) Given the following singly linked list (a list with four nodes), what will be the value stored at the last...

  • 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...

  • 3. What was the total manufacturing cost assigned to Job P? (Do not round intermediate calculations.)...

    3. What was the total manufacturing cost assigned to Job P? (Do not round intermediate calculations.) 4. If Job P included 20 units, what was its unit product cost? (Do not round intermediate calculations. Round your final answer to nearest whole dollar.) 5. What was the total manufacturing cost assigned to Job Q? (Do not round intermediate calculations.) 6. If Job Q included 30 units, what was its unit product cost? (Do not round intermediate calculations. Round your final answer...

  • ssessment,id=215 Converts a physical variable into an electrical signa O converts an analog signal into o...

    ssessment,id=215 Converts a physical variable into an electrical signa O converts an analog signal into o digitol signal O Converts a digitol signol into an anolog signal QUESTION 4 The basic approach to testing D/A converters is to Ο App ya sequence of binary codes coveringthe full rangeofi put vakes to the creati put vhle ooserv ngt eat stonin o O Single-step the device through its full input range while checking the output with a DMM sepe The Check the...

  • QUESTION 7 Which of the following is a valid C++ assignment statement? (assume each letter is...

    QUESTION 7 Which of the following is a valid C++ assignment statement? (assume each letter is a different variable) A.y=b-c B.y +z = x C.x = a bi D.x = -(y*z): Ex = (x + (y z): QUESTION 8 Which of the following is a valid variable name according to C++ naming rules? A 2ndName B.%Last_Name C@Month D#55 Eyear03 QUESTION 9 Which library must be included to enable keyboard input? A kbdin B. cstdlib C input Diostream E lomanip QUESTION...

  • QUESTION 1 What will be displayed as a result of executing the following code? int   x...

    QUESTION 1 What will be displayed as a result of executing the following code? int   x = 5, y = 20; x += 32; y /= 4; cout <<"x = " << x <<"y = " << y; A. x = 32, y = 4 B. x = 9, y = 52 C. x = 37, y = 5 D. x = 160, y = 80 8 points    QUESTION 2 What will be the displayed when the following code...

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
Active Questions
ADVERTISEMENT