Tìm kiếm:
TRANG NHÀ
Giới thiệu VNEDU.ORG
Điều khoản và bản quyền
Liên lạc VNEDU
TRẮC NGHIỆM TRỰC TUYẾN
---Công Cụ:---
Soạn Biểu thức
Bảng màu HTML
Ký hiệu đặc biệt 01
Ký hiệu đặc biệt 02
Ký hiệu đặc biệt 03
Ký hiệu đặc biệt 04
Ký hiệu đặc biệt 05
Ký hiệu đặc biệt 06
Ký hiệu đặc biệt 07
Ký hiệu đặc biệt [Toán]
Tin Học   ||  Căn Bản    Văn Phòng    Hệ Thống - Mạng    Phần Mềm Ứng Dụng    Kỹ thuật số    Lập trình    SQL  

Trắc Nghiệm Java - Bài 35
Ngày làm bài: Hôm nay lúc 10:32:31 (Server time)
Số câu hỏi: 10.   Tổng điểm: 10
Yêu cầu hoàn thành: 60 phút.
Thời gian còn lại: 
Cỡ chữ câu hỏi:  Cỡ chữ đáp án:


1-
Which of the following will produce an answer that is closest in value to a double, d, while not being greater than d?
  A - 
(int)Math.min(d);
  B - 
(int)Math.max(d);
  C - 
(int)Math.abs(d);
  D - 
(int)Math.floor(d);
2-
What two statements are true about the result obtained from calling Math.random()?
  1. The result is less than 0.0.
  2. The result is greater than or equal to 0.0..
  3. The result is less than 1.0.
  4. The result is greater than 1.0.
  5. The result is greater than or equal to 1.0.
  A - 
1 and 2
  B - 
2 and 3
  C - 
3 and 4
  D - 
4 and 5
3-
What will be the output of the program?
public class X 
{  
    public static void main(String [] args) 
    {
        try 
        {
            badMethod();  
            System.out.print("A"); 
        }  
        catch (Exception ex) 
        {
            System.out.print("B");  
        } 
        finally 
        {
            System.out.print("C"); 
        } 
        System.out.print("D"); 
    }  
    public static void badMethod() 
    {
        throw new Error(); /* Line 22 */
    } 
}

  A - 
C is printed before exiting with an error message.
  B - 
Compilation fails.
  C - 
ABCD
  D - 
BC is printed before exiting with an error message.
4-
Which four can be thrown using the throw statement?
  1. Error
  2. Event
  3. Object
  4. Throwable
  5. Exception
  6. RuntimeException
  A - 
1, 2, 3 and 4
  B - 
2, 4, 5 and 6
  C - 
2, 3, 4 and 5
  D - 
1, 4, 5 and 6
5-
What will be the output of the program?
public class Test 
{ 
    public static void main (String args[]) 
    {
        String str = NULL; 
        System.out.println(str); 
    } 
}

  A - 
Runtime Exception
  B - 
NULL
  C - 
Code runs but no output
  D - 
Compile Error
6-
Which of the following statements about the hashcode() method are incorrect?
  1. The value returned by hashcode() is used in some collection classes to help locate objects.
  2. The hashcode() method is required to return a positive int value.
  3. The hashcode() method in the String class is the one inherited from Object.
  4. Two new empty String objects will produce identical hashcodes.
  A - 
2 and 3
  B - 
3 and 4
  C - 
1 and 4
  D - 
1 and 2
7-
class Foo 
{
    class Bar{ }
}
class Test 
{
    public static void main (String [] args) 
    {
        Foo f = new Foo();
        /* Line 10: Missing statement ? */
    }
}
which statement, inserted at line 10, creates an instance of Bar?
  A - 
Foo.Bar b = f.new Bar();
  B - 
Bar b = new f.Bar();
  C - 
Bar b = f.new Bar();
  D - 
Foo.Bar b = new Foo.Bar();
8-
What will be the output of the program?
public class HorseTest 
{
    public static void main (String [] args) 
    {
        class Horse 
        {
            public String name; /* Line 7 */
            public Horse(String s) 
            {
                name = s;
            }
        } /* class Horse ends */
        
        Object obj = new Horse("Zippo"); /* Line 13 */
        Horse h = (Horse) obj; /* Line 14 */
        System.out.println(h.name);
    }
} /* class HorseTest ends */

  A - 
An exception occurs at runtime at line 10.
  B - 
Compilation fails because of an error on line 7.
  C - 
It prints "Zippo".
  D - 
Compilation fails because of an error on line 13.
9-
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 - 
Compilation fails.
  B - 
x = 1
  C - 
x = 0
  D - 
An exception is thrown at runtime.
10-
What will be the output of the program?
class SC2 
{
    public static void main(String [] args) 
    {
        SC2 s = new SC2();
        s.start();
    }

    void start() 
    {
        int a = 3;
        int b = 4;
        System.out.print(" " + 7 + 2 + " ");
        System.out.print(a + b);
        System.out.print(" " + a + b + " ");
        System.out.print(foo() + a + b + " ");
        System.out.println(a + b + foo());
    }

    String foo() 
    {
        return "foo";
    }
}

  A - 
9 7 7 foo 7 7foo
  B - 
72 34 34 foo34 34foo
  C - 
9 7 7 foo34 34foo
  D - 
72 7 34 foo34 7foo
 
[Người đăng: Thành Lãm - ST]
Ghé thăm Kênh của Vị Sư "hai lần chết đi sống lại"
Tu Si Chau Soc Thon

https://www.youtube.com/channel/UCoyC9WTTVR-M3qpTKKEXGnQ

Chau Soc Thon Official Channel


Phong Bảo Official
Phong Bao Official
Xem Nhiều nhất
Trắc Nghiệm Pascal - Bài 20
Trắc Nghiệm ASP.NET - Bài 12
Trắc Nghiệm Ngôn Ngữ Lập Trình C - Bài 16
Trắc Nghiệm ASP.NET - Bài 01
Trắc Nghiệm ASP.NET - Bài 03
Trắc nghiệm C++ - Bài 18
Trắc Nghiệm C# - Bài 53
Trắc Nghiệm ASP.NET - Bài 02
Trắc Nghiệm C# - Bài 42
Trắc Nghiệm Java - Bài 01
Trắc Nghiệm ASP.NET - Bài 04
Trắc Nghiệm Pascal - Bài 22
Trắc Nghiệm ASP.NET - Bài 13
Trắc Nghiệm ASP.NET - Bài 09
Trắc Nghiệm ASP.NET - Bài 08
Trắc nghiệm PHP - Bài 01
Trắc Nghiệm ASP.NET - Bài 06
Trắc Nghiệm ASP.NET - Bài 11
Trắc Nghiệm ASP.NET - Bài 05
Trắc Nghiệm ASP.NET - Bài 23
Đề Xuất
Trắc Nghiệm Ngôn Ngữ Lập Trình C ( English ) - Bài 34
Trắc Nghiệm Ngôn Ngữ Lập Trình C ( English ) - Bài 17
Trắc Nghiệm Java - Bài 25
Trắc Nghiệm Thiết Kế Web - Bài 01
Trắc nghiệm Linux - Bài 36
Trắc Nghiệm Ngôn Ngữ Lập Trình C ( English ) - Bài 81
Trắc Nghiệm Ngôn Ngữ Lập Trình C - Bài 22
Trắc Nghiệm Java - Bài 39
Trắc Nghiệm Ngôn Ngữ Lập Trình C - Bài 04
Trắc Nghiệm ASP.NET (English) - Bài 23
Trắc Nghiệm Thiết Kế Web - Bài 09
Trắc nghiệm Linux ( English ) - Bài 32
Trắc Nghiệm Pascal - Bài 20
Trắc Nghiệm C# - Bài 35
Trắc Nghiệm Ngôn Ngữ Lập Trình C - Bài 15
Trắc Nghiệm Visual Basic - Bài 14
Trắc nghiệm Linux ( English ) - Bài 30
Trắc Nghiệm Ngôn Ngữ Lập Trình C ( English ) - Bài 74
Trắc Nghiệm Ngôn Ngữ Lập Trình C - Bài 05
Trắc Nghiệm Ngôn Ngữ Lập Trình C - Bài 20
Phát triển hệ thống: TRƯƠNG HỮU ĐỨC - Phiên bản 3.0 - © Copyright 2013 - 2024 - VNEDU.ORG

free counters