1. What will be the output of the program? public class Example { public static void main(String [] args) { double values[] = {-2.3, -1.0, 0.25, 4}; int cnt = 0; for (int x=0; x < values.length; x++) { if (Math.round(values[x] + .5) == Math.ceil(values[x])) { ++cnt; } } System.out.println("same results " + cnt + " time(s)"); } }





Write Comment

Type in
(Press Ctrl+g to toggle between English and the chosen language)

Comments

Tags
Show Similar Question And Answers
QA->There are 50 students in a class. In a class test 22 students get 25 marks each, 18 students get 30 marks each. Each of the remaining gets 16 marks. The average mark of the whole class is :....
QA->In a class of 20 students the average age is 16 years.If the age of the class teacher is added to that of students,the average age of the class becomes 17 years.What is the age of the teacher?....
QA->Twice World Cup Football winners Argentina sacked their coach on April 10, 2017 after a string of poor results. ? Name that coach?....
QA->A static member function can have access to:....
QA->A computer with a 32 bit wide data bus implements its memory using 8 K x 8 static RAM chips. The smallest memory that this computer can have is:....
MCQ->What will be the output of the program? public class Example { public static void main(String [] args) { double values[] = {-2.3, -1.0, 0.25, 4}; int cnt = 0; for (int x=0; x < values.length; x++) { if (Math.round(values[x] + .5) == Math.ceil(values[x])) { ++cnt; } } System.out.println("same results " + cnt + " time(s)"); } }....
MCQ->What will be the output of the program? public class NFE { public static void main(String [] args) { String s = "42"; try { s = s.concat(".5"); / Line 8 / double d = Double.parseDouble(s); s = Double.toString(d); int x = (int) Math.ceil(Double.valueOf(s).doubleValue()); System.out.println(x); } catch (NumberFormatException e) { System.out.println("bad number"); } } }....
MCQ-> In the table below is the listing of players, seeded from highest (#1) to lowest (#32), who are due to play in an Association of Tennis Players (ATP) tournament for women. This tournament has four knockout rounds before the final, i.e., first round, second round, quarterfinals, and semi-finals. In the first round, the highest seeded player plays the lowest seeded player (seed # 32) which is designated match No. 1 of first round; the 2nd seeded player plays the 31st seeded player which is designated match No. 2 of the first round, and so on. Thus, for instance, match No. 16 of first round is to be played between 16th seeded player and the 17th seeded player. In the second round, the winner of match No. 1 of first round plays the winner of match No. 16 of first round and is designated match No. 1 of second round. Similarly, the winner of match No. 2 of first round plays the winner of match No. 15 of first round, and is designated match No. 2 of second round. Thus, for instance, match No. 8 of the second round is to be played between the winner of match No. 8 of first round and the winner of match No. 9 of first round. The same pattern is followed for later rounds as well.If there are no upsets (a lower seeded player beating a higher seeded player) in the first round, and only match Nos. 6, 7, and 8 of the second round result in upsets, then who would meet Lindsay Davenport in quarter finals, in case Davenport reaches quarter finals?
 ....
MCQ->What will be the output of the program? class s1 extends Thread { public void run() { for(int i = 0; i < 3; i++) { System.out.println("A"); System.out.println("B"); } } } class Test120 extends Thread { public void run() { for(int i = 0; i < 3; i++) { System.out.println("C"); System.out.println("D"); } } public static void main(String args[]) { s1 t1 = new s1(); Test120 t2 = new Test120(); t1.start(); t2.start(); } }....
MCQ->What will be the output of the program? public class Test { public static int y; public static void foo(int x) { System.out.print("foo "); y = x; } public static int bar(int z) { System.out.print("bar "); return y = z; } public static void main(String [] args ) { int t = 0; assert t > 0 : bar(7); assert t > 1 : foo(8); / Line 18 / System.out.println("done "); } }....
Terms And Service:We do not guarantee the accuracy of available data ..We Provide Information On Public Data.. Please consult an expert before using this data for commercial or personal use
DMCA.com Protection Status Powered By:Omega Web Solutions
© 2002-2017 Omega Education PVT LTD...Privacy | Terms And Conditions