Tin Học >> Lập trình >> Java
|| C#
C++
Visual Basic
Visual Foxpro
C
Java
Pascal
Thiết Kế Web
ASP.NET
XML
CSS
PHP
Có 55 bài trong 6 trang (10 bài/trang) và bạn đang ở trang 5.
What will be the output of the program? class Test { public static void main(String [] args) { int x=20; String sup = (x < 15) ? "small" : (x < 22)? "tiny" : "huge"; System.out.println(sup); } } A. small B. tiny C. huge D. Compilation fails....... What will be the output of the program? class Test { public static void main(String [] args) { int x= 0; int y= 0; for (int z = 0; z < 5; z++) { if (( ++x > 2 ) && (++y > 2)) { x++; } } System.out.println(x + " " + y); } } ........... interface DoMath { double getArea(int rad); } interface MathPlus { double getVol(int b, int h); } /* Missing Statements ? */ which two code fragments inserted at end of the program, will allow to compile? class AllMath extends DoMath { double getArea(int r); } interface AllMath implements MathPlus { double getVol(int x, int y); } interface AllMath extends DoMath { float getAvg(int h, int l); } class AllMath implements MathPlus { double getArea(int rad); } abstract class AllMath implements DoMath, MathPlus { public double getArea(int rad) { return rad * rad * 3.14; } } A. 1 only B. 2 only C. 3 and 5 D. 1 and 4....... What will be the output of the program? class A { final public int GetResult(int a, int b) { return 0; } } class B extends A { public int GetResult(int a, int b) {return 1; } } public class Test { public static void main(String args[]) { B b = new B(); System.out.println("x = " + b.GetResult(0, 1)); } } A. x = 0 B. x = 1 C. Compilation fails. D. An exception is thrown at runtime........ Which three are valid method signatures in an interface? private int getArea(); public float getVol(float x); public void main(String [] args); public static void main(String [] args); boolean setFlag(Boolean [] test); A. 1 and 2 B. 2, 3 and 5 C. 3, 4, and 5 D. 2 and 4...... In the given program, how many lines of output will be produced? public class Test { public static void main(String [] args) { int [] [] [] x = new int [3] [] []; int i, j; x[0] = new int[4][]; x[1] = new int[2][]; x[2] = new int[5][]; for (i = 0; i < x.length; i++) { for (j = 0; j < x[i].length; j++) { x[i][j] = new int [i + j + 1]; System.out.println("size = " + x[i][j].length); } } } } A. 7 B. 9 C. 11 D. 13 E. Compilation fails.......... Which one is a valid declaration of a boolean? A. boolean b1 = 0; B. boolean b2 = 'false'; C. boolean b3 = false; D. boolean b4 = Boolean.false(); E. boolean b5 = no;...... Which three are valid declarations of a float? float f1 = -343; float f2 = 3.14; float f3 = 0x12345; float f4 = 42e7; float f5 = 2001.0D; float f6 = 2.81F; A. 1, 2, 4 B. 2, 3, 5....... Which four options describe the correct default values for array elements of the types indicated? int -> 0 String -> "null" Dog -> null char -> '\u0000' float -> 0.0f boolean -> true A. 1, 2, 3, 4 B. 1, 3, 4, 5 C. 2, 4, 5, 6 D. 3, 4, 5, 6........ Which one of these lists contains only Java programming language keywords? A. class, if, void, long, Int, continue B. goto, instanceof, native, finally, default, throws C. try, virtual, throw, final, volatile, transient D. strictfp, constant, super, implements, do..... Cho biết kết quả sau khi biên dịch và thi hành chương trình sau: 1 : public class Conditional{ 2 : public static void mai n(String[] args){ 3 : int x = 4; 4 : System.out.println("value is " + 5 : ((x > 4 ? 99.99 : 9)); 6 : } 7 : } [a]--Kết quả là: value is 99.99 [b]--Kết quả là: value is 9 [c]--Kết quả là: value is 9.0 [d]--Lỗi biên dịch tại dòng số 5..... Cho biết kết quả sau khi thực hiện chương trình sau: 1 : public class Xor{ 2 : public static void main(String[] args){ 3 : byte b = 10;//00001010 4 : byte c = 15;//00001111 5 : b = (byte)(b ^ c); 6 : System.out.println("b contains " + b); 7 : } 8 : } [a]--Kết quả là: b contains 10 [b]--Kết quả là: b contains 5 [c]--Kết quả là: b contains 250 [d]--Kết quả là: b contains 245.... Nếu 1 frame dùng bộ quản lý trình bày (layout manager) mặc định và không chứa bất kỳ panel nào bên trong thì tất cả những components bên trong frame là cùng kích thước (ngang, dọc) ? [a]--Đúng [b]--Sai.... Nếu 1 frame dùng bộ quản lý trình bày (layout manager) là GridLayout và không chứa bất kỳ panel hay container nào khác bên trong nó thì tất cả những components khi đưa vào trong frame này có cùng kích thước như nhau (ngang, dọc)? [a]--Đúng [b]--Sai.... |