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 49
Ngày làm bài: Hôm nay lúc 07:12:23 (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 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 - 
1 and 2
  B - 
2 and 3
  C - 
3 and 4
  D - 
1 and 4
2-
What will be the output of the program?
public class TestObj 
{
    public static void main (String [] args) 
    {
        Object o = new Object() /* Line 5 */
        {
            public boolean equals(Object obj) 
            {
                return true;
            } 
        }      /* Line 11 */
        
        System.out.println(o.equals("Fred"));
    }
}

  A - 
It prints "true".
  B - 
It prints "Fred".
  C - 
An exception occurs at runtime.
  D - 
Compilation fails
3-
Which of the following will directly stop the execution of a Thread?
  A - 
wait()
  B - 
notify()
  C - 
notifyall()
  D - 
exits synchronized code
4-
Which class or interface defines the wait(), notify(),and notifyAll() methods?
  A - 
Object
  B - 
Thread
  C - 
Runnable
  D - 
Class
5-
What will be the output of the program?
public class ThreadDemo 
{ 
    private int count = 1; 
    public synchronized void doSomething() 
    { 
        for (int i = 0; i < 10; i++) 
            System.out.println(count++); 
    } 
    public static void main(String[] args) 
    { 
        ThreadDemo demo = new ThreadDemo(); 
        Thread a1 = new A(demo); 
        Thread a2 = new A(demo); 
        a1.start(); 
        a2.start(); 
    } 
} 
class A extends Thread 
{ 
    ThreadDemo demo; 
    public A(ThreadDemo td) 
    { 
        demo = td; 
    } 
    public void run() 
    { 
        demo.doSomething(); 
    } 
}

  A - 
It will print the numbers 0 to 19 sequentially
  B - 
It will print the numbers 1 to 20 sequentially
  C - 
It will print the numbers 1 to 20, but the order cannot be determined
  D - 
The code will not compile.
6-
Which two can be used to create a new Thread?
  1. Extend java.lang.Thread and override the run() method.
  2. Extend java.lang.Runnable and override the start() method.
  3. Implement java.lang.Thread and implement the run() method.
  4. Implement java.lang.Runnable and implement the run() method.
  5. Implement java.lang.Thread and implement the start() method.
  A - 
1 and 2
  B - 
2 and 3
  C - 
1 and 4
  D - 
3 and 4
7-
The following block of code creates a Thread using a Runnable target:
Runnable target = new MyRunnable();
Thread myThread = new Thread(target);
Which of the following classes can be used to create the target, so that the preceding code compiles correctly?
  A - 
public class MyRunnable extends Runnable{public void run(){}}
  B - 
public class MyRunnable extends Object{public void run(){}}
  C - 
public class MyRunnable implements Runnable{public void run(){}}
  D - 
public class MyRunnable implements Runnable{void run(){}}
8-
public class Myfile 
{ 
    public static void main (String[] args) 
    {
        String biz = args[1]; 
        String baz = args[2]; 
        String rip = args[3]; 
        System.out.println("Arg is " + rip); 
    } 
}
Select how you would start the program to cause it to print: Arg is 2
  A - 
java Myfile 222
  B - 
java Myfile 1 2 2 3 4
  C - 
java Myfile 1 3 2 2
  D - 
java Myfile 0 1 2 3
9-
What will be the output of the program?
int i = (int) Math.random();

  A - 
i = 0
  B - 
i = 1
  C - 
Value of i is undetermined
  D - 
Statement causes a compile error
10-
What will be the output of the program?
class A 
{ 
    public A(int x){} 
} 
class B extends A { } 
public class test 
{ 
    public static void main (String args []) 
    {
        A a = new B(); 
        System.out.println("complete"); 
    } 
}

  A - 
It compiles and runs printing nothing
  B - 
Compiles but fails at runtime
  C - 
Compile Error
  D - 
Prints "complete"
 
[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 Thiết Kế Web (English) - Bài 06
Trắc nghiệm XML - Bài 24
Trắc nghiệm Ngôn Ngữ Lập Trình C++ - Bài 07
Trắc nghiệm Linux ( English ) - Bài 29
Trắc Nghiệm Java - Bài 55
Trắc nghiệm Ngôn Ngữ Lập Trình C++ - Bài 10
Trắc Nghiệm Thiết Kế Web (English) - Bài 15
Trắc Nghiệm Visual Basic - Bài 02
Trắc Nghiệm Thiết Kế Web Và Flash - Bài 04
Trắc Nghiệm Pascal - Bài 10
10 Câu Hỏi Trắc nghiệm Về ASP.NET - Phần 01
Trắc Nghiệm Ngôn Ngữ Lập Trình C ( English ) - Bài 15
Trắc nghiệm XML - Bài 08
Trắc Nghiệm Ngôn Ngữ Lập Trình C ( English ) - Bài 68
Trắc Nghiệm Thiết Kế Web (English) - Bài 04
Trắc Nghiệm C Sharp - Bài 10
Trắc nghiệm C++ - Bài 11
Trắc Nghiệm ASP.NET (English) - Bài 05
Trắc Nghiệm Thiết Kế Web Và Flash - Bài 11
Trắc Nghiệm Ngôn Ngữ Lập Trình C ( English ) - Bài 25
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