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 52
Ngày làm bài: Hôm nay lúc 06:05:56 (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-
What will be the output of the program?
class Super
{ 
    public int i = 0; 

    public Super(String text) /* Line 4 */
    {
        i = 1; 
    } 
} 

class Sub extends Super
{
    public Sub(String text)
    {
        i = 2; 
    } 

    public static void main(String args[])
    {
        Sub sub = new Sub("Hello"); 
        System.out.println(sub.i); 
    } 
}

  A - 
0
  B - 
1
  C - 
2
  D - 
Compilation fails.
2-
What will be the output of the program?
class Base
{ 
    Base()
    {
        System.out.print("Base");
    }
} 
public class Alpha extends Base
{ 
    public static void main(String[] args)
    { 
        new Alpha(); /* Line 12 */
        new Base(); /* Line 13 */
    } 
}

  A - 
Base
  B - 
BaseBase
  C - 
Compilation fails
  D - 
The code runs with no output
3-
What will be the output of the program?
import java.util.*;
public class NewTreeSet2 extends NewTreeSet 
{
    public static void main(String [] args) 
    {
        NewTreeSet2 t = new NewTreeSet2();
        t.count();
    }
}
protected class NewTreeSet
{
    void count() 
    {
        for (int x = 0; x < 7; x++,x++ ) 
        {
            System.out.print(" " + x);
        }
    }
}

  A - 
0 2 4
  B - 
0 2 4 6
  C - 
Compilation fails at line 2
  D - 
Compilation fails at line 10
4-
Which two statements are true for any concrete class implementing the java.lang.Runnable interface?
  1. You can extend the Runnable interface as long as you override the public run() method.
  2. The class must contain a method called run() from which all code for that thread will be initiated.
  3. The class must contain an empty public void method named run().
  4. The class must contain a public void method named runnable().
  5. The class definition must include the words implements Threads and contain a method called run().
  6. The mandatory method must be public, with a return type of void, must be called run(), and cannot take any arguments.
  A - 
1 and 3
  B - 
2 and 4
  C - 
1 and 5
  D - 
2 and 6
5-
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 - 
ABCD
  B - 
Compilation fails.
  C - 
C is printed before exiting with an error message.
  D - 
BC is printed before exiting with an error message.
6-
What will be the output of the program?
public class X 
{  
    public static void main(String [] args) 
    {
        try 
        {
            badMethod(); /* Line 7 */
            System.out.print("A"); 
        } 
        catch (Exception ex) /* Line 10 */
        {
            System.out.print("B"); /* Line 12 */
        } 
        finally /* Line 14 */
        {
            System.out.print("C"); /* Line 16 */
        }  
        System.out.print("D"); /* Line 18 */
    } 
    public static void badMethod() 
    {
        throw new RuntimeException(); 
    } 
}

  A - 
AB
  B - 
BC
  C - 
ABC
  D - 
BCD
7-
Which interface does java.util.Hashtable implement?
  A - 
Java.util.Map
  B - 
Java.util.List
  C - 
Java.util.HashTable
  D - 
Java.util.Collection
8-
What will be the output of the program?
package foo; 
import java.util.Vector; /* Line 2 */
private class MyVector extends Vector 
{
    int i = 1; /* Line 5 */
    public MyVector() 
    { 
        i = 2; 
    } 
} 
public class MyNewVector extends MyVector 
{
    public MyNewVector () 
    { 
        i = 4; /* Line 15 */
    } 
    public static void main (String args []) 
    { 
        MyVector v = new MyNewVector(); /* Line 19 */
    } 
}

  A - 
Compilation will succeed.
  B - 
Compilation will fail at line 3.
  C - 
Compilation will fail at line 5.
  D - 
Compilation will fail at line 15.
9-
What two statements are true about properly overridden hashCode() and equals() methods?
  1. hashCode() doesn't have to be overridden if equals() is.
  2. equals() doesn't have to be overridden if hashCode() is.
  3. hashCode() can always return the same value, regardless of the object that invoked it.
  4. equals() can be true even if it's comparing different objects.
  A - 
1 and 2
  B - 
2 and 3
  C - 
3 and 4
  D - 
1 and 3
10-
Which three are methods of the Object class?
  1. notify();
  2. notifyAll();
  3. isInterrupted();
  4. synchronized();
  5. interrupt();
  6. wait(long msecs);
  7. sleep(long msecs);
  8. yield();
  A - 
1, 2, 4
  B - 
2, 4, 5
  C - 
1, 2, 6
  D - 
2, 3, 4
 
[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 Visual Foxpro - Bài 07
Trắc Nghiệm Java - Bài 33
Trắc Nghiệm Java - Bài 36
Trắc Nghiệm Ngôn Ngữ Lập Trình C ( English ) - Bài 17
Trắc Nghiệm C Sharp - Bài 06
Trắc Nghiệm Thiết Kế Web (English) - Bài 48
Trắc Nghiệm Thiết Kế Web (English) - Bài 10
Trắc nghiệm XML - Bài 06
Trắc Nghiệm Thiết Kế Web (English) - Bài 46
Trắc Nghiệm C++ - Bài 04
Trắc Nghiệm Visual Basic - Bài 19
Trắc Nghiệm Visual Basic - Bài 39
Trắc Nghiệm ASP.NET - Bài 14
Trắc nghiệm Linux ( English ) - Bài 30
Trắc Nghiệm Pascal - Bài 27
Trắc Nghiệm Java - Bài 01
Trắc Nghiệm ASP.NET (English) - Bài 17
Trắc Nghiệm ASP.NET - Bài 06
Trắc Nghiệm Thiết Kế Web Và Flash - Bài 32
Trắc Nghiệm C Sharp - Bài 29
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