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 43
Ngày làm bài: Hôm nay lúc 17:10:13 (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-
import java.io.*;
public class MyProgram 
{
    public static void main(String args[])
    {
        FileOutputStream out = null;
        try 
        {
            out = new FileOutputStream("test.txt");
            out.write(122);
        }
        catch(IOException io) 
        {
            System.out.println("IO Error.");
        }
        finally 
        {
            out.close();
        }
    }
}
and given that all methods of class FileOutputStream, including close(), throw an IOException, which of these is true?
  A - 
This program will compile successfully.
  B - 
This program fails to compile due to an error at line 4.
  C - 
This program fails to compile due to an error at line 6.
  D - 
This program fails to compile due to an error at line 13.
2-
Which statement is true?
  A - 
Catch(X x) can catch subclasses of X where X is a subclass of Exception.
  B - 
The Error class is a RuntimeException.
  C - 
Any statement that can throw an Error must be enclosed in a try block.
  D - 
Any statement that can throw an Exception must be enclosed in a try block.
3-
Which is valid declaration of a float?
  A - 
float f = 1F;
  B - 
float f = 1.0;
  C - 
float f = "1";
  D - 
float f = 1.0d;
4-
What will be the output of the program?
import java.util.*; 
class H 
{
    public static void main (String[] args) 
    { 
        Object x = new Vector().elements(); 
        System.out.print((x instanceof Enumeration)+","); 
        System.out.print((x instanceof Iterator)+","); 
        System.out.print(x instanceof ListIterator); 
    } 
}

  A - 
Prints: false,false,false
  B - 
Prints: false,false,true
  C - 
Prints: false,true,false
  D - 
Prints: true,false,false
5-
What will be the output of the program?
TreeSet map = new TreeSet();
map.add("one");
map.add("two");
map.add("three");
map.add("four");
map.add("one");
Iterator it = map.iterator();
while (it.hasNext() ) 
{
    System.out.print( it.next() + " " );
}

  A - 
one two three four
  B - 
four three two one
  C - 
four one three two
  D - 
one two three four one
6-
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 = new Foo.Bar();
  B - 
Foo.Bar b = f.new Bar();
  C - 
Bar b = new f.Bar();
  D - 
Bar b = f.new Bar();
7-
Which three guarantee that a thread will leave the running state?
  1. yield()
  2. wait()
  3. notify()
  4. notifyAll()
  5. sleep(1000)
  6. aLiveThread.join()
  7. Thread.killThread()
  A - 
1, 2 and 4
  B - 
2, 5 and 6
  C - 
3, 4 and 7
  D - 
4, 5 and 7
8-
Which will contain the body of the thread?
  A - 
run();
  B - 
start();
  C - 
stop();
  D - 
main();
9-
What will be the output of the program?
public class Test 
{  
    public static void main(String[] args) 
    { 
        int x = 0;  
        assert (x > 0) ? "assertion failed" : "assertion passed" ; 
        System.out.println("finished");  
    } 
}

  A - 
finished
  B - 
Compiliation fails.
  C - 
An AssertionError is thrown and finished is output.
  D - 
An AssertionError is thrown with the message "assertion failed."
10-
What will be the output of the program?
public class BoolTest 
{
    public static void main(String [] args) 
    {
        int result = 0;

        Boolean b1 = new Boolean("TRUE");
        Boolean b2 = new Boolean("true");
        Boolean b3 = new Boolean("tRuE");
        Boolean b4 = new Boolean("false");

        if (b1 == b2)  /* Line 10 */
            result = 1;
        if (b1.equals(b2) ) /* Line 12 */
            result = result + 10;
        if (b2 == b4)  /* Line 14 */
            result = result + 100;
        if (b2.equals(b4) ) /* Line 16 */
            result = result + 1000;
        if (b2.equals(b3) ) /* Line 18 */
            result = result + 10000;

        System.out.println("result = " + result);
    }
}

  A - 
0
  B - 
1
  C - 
10
  D - 
10010
 
[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 49
Trắc nghiệm Ngôn Ngữ Lập Trình C++ - Bài 20
Trắc Nghiệm Java - Bài 52
Trắc Nghiệm Thiết Kế Web - Bài 05
Trắc Nghiệm Ngôn Ngữ Lập Trình C ( English ) - Bài 25
Trắc Nghiệm Visual Basic - Bài 34
Trắc nghiệm C++ - Bài 15
Trắc Nghiệm ASP.NET - Bài 23
Trắc Nghiệm Thiết Kế Web - Bài 08
Trắc Nghiệm Ngôn Ngữ Lập Trình C - Bài 23
Trắc Nghiệm Ngôn Ngữ Lập Trình C ( English ) - Bài 57
Trắc nghiệm XML - Bài 03
Trắc Nghiệm Thiết Kế Web (English) - Bài 06
Trắc Nghiệm ASP.NET - Bài 20
Trắc nghiệm Ngôn Ngữ Lập Trình C++ - Bài 24
Trắc Nghiệm C# - Bài 36
Trắc Nghiệm C Sharp - Bài 05
Trắc nghiệm Ngôn Ngữ Lập Trình C++ - Bài 09
Trắc Nghiệm C Sharp - Bài 06
Trắc nghiệm Linux - Bài 65
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