Danh mục

Test Corejava

Số trang: 7      Loại file: doc      Dung lượng: 4.00 KB      Lượt xem: 15      Lượt tải: 0    
Hoai.2512

Hỗ trợ phí lưu trữ khi tải xuống: 1,000 VND Tải xuống file đầy đủ (7 trang) 0
Xem trước 2 trang đầu tiên của tài liệu này:

Thông tin tài liệu:

Test Corejava 1) Which of the following is a correct signature for the main method? a) static void main(String[] args[]) c) public void main(String[] args) *b) public static void main(String[] args) d) public static void main(Strings[] args) 2) What
Nội dung trích xuất từ tài liệu:
Test Corejava Test Corejava 1) Which of the following is a correct signature for the main method? [0.5] a) static void main(String[] args[]) c) public void main(String[] args) *b) public static void main(String[] args) d) public static void main(Strings[] args)2) What value does readLine() return when it has reached the end of the file? [0.5] a) 1 c) 0 b) -1 *d) null 3) Which of the Boolean expressions below is incorrect? (choose 2) [0.5]*a) (true) && (3 => 4) c) (x > 0) || (x < 0)b) !(x > 0) && (x > 0) *d) (x != 0) || (x = 0)4) To declare an int variable number with initial value 2, you write [0.5] a) int number = 2L; *c) int number = 2; b) int number = 2l; d) Int number = 2.0;5) What value does read () return when it has reached the end of the file? [0.5] a) 1 c) 0 *b) -1 d) Null6) Which of these data type requires the largest amount of memory? [0.5] a) Float c) short *b) Double d) byte7) Suppose x=0 and y=0 what is x after evaluating the expression (y >=0) || (x++ > 0)? [1] a) 1 *c) 0 b) -1 d) null8) Suppose x = 1, y = -1, and z = 1. What is the printout of the following statement? [0.5] if (x > 0) if (y > 0) System.out.println(“x > 0 and y > 0”); else if (z > 0) System.out.println(“x < 0 and z > 0”); a) x > 0 and y > 0; c) x 0; d) None of the above.9) What is y after the following switch statement is executed? [0.5]2002 / Sem 1 – ACCP 2003 Q.P. Page 1 of 7 x = 3; switch (x+3) { case 6: y = 0; case 7: y = 1; default: y += 2; } a) 1 c) 0 b) 2 *d) 310) What is sum after the following loop terminates? [1] int sum = 0; int item = 0; do { item++; sum += item; if (sum > 7) break; } while (item < 6); *a) 10 c) 6 b) 5 d) 8 11) Analyze the following code: [0.5] public class Test { public static void main (String args[]) { int i = 0; for (i=0; i ++z; } a) The if condition should use a prefix *c) There is a missing } before the else. operator instead of a postfix operator.*b) The if condition must be a boolean d) There is no break statement to allow control expression, not a numeric expression. to transfer out of the if statement.13) Which of the following modifiers must be present for a method inside the main class [1] to be called inside the main method? a) public *c) static b) private d) None of the above is necessary.14) Which of the following are illegal identifiers? (choose 2) [1] *a) 2variable c) _whatavariable b) variable2 d) _3_ e) $anothervar *f) #myvar15) What are the three ways in which a thread can enter the waiting state?(choose 3) [0.5] *a) Sleep() *c) Suspend() *b) Wait() d) Start() e) Stop()16) Which of the following are true about the finally clause of a try-catch-finally [0.5] statement? a) It is only executed after a catch clause has executed b) It is only executed after a catch clause has not executed *c) It is always executed unless its thread terminates d) It is only executed if an exception is thrown17) Which layout manager can divide the container into a grid ? [0.5] a) CardLayout c) BorderLayout b) FlowLayout *d) GridLayout18) Which of the following will output -4.0 [1] a) System.out.println(Math.floor(-4.7)); *c) System.out.println(Math.ceil(-4.7)); b) Syste ...

Tài liệu được xem nhiều: