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 48
Ngày làm bài: Hôm nay lúc 18:59:21 (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 cause a compiler error?
  A - 
int[ ] scores = {3, 5, 7};
  B - 
int [ ][ ] scores = {2,7,6}, {9,3,45};
  C - 
String cats[ ] = {"Fluffy", "Spot", "Zeus"};
  D - 
boolean results[ ] = new boolean [] {true, false, true};
2-
Which three are valid method signatures in an interface?
  1. private int getArea();
  2. public float getVol(float x);
  3. public void main(String [] args);
  4. public static void main(String [] args);
  5. boolean setFlag(Boolean [] test);
  A - 
1 and 2
  B - 
2, 3 and 5
  C - 
3, 4, and 5
  D - 
2 and 4
3-
What will be the output of the program?
class Super 
{ 
    public Integer getLength() 
    {
        return new Integer(4); 
    } 
} 

public class Sub extends Super 
{ 
    public Long getLength() 
    {
        return new Long(5); 
    } 

    public static void main(String[] args) 
    { 
        Super sooper = new Super(); 
        Sub sub = new Sub(); 
        System.out.println( 
        sooper.getLength().toString() + "," + sub.getLength().toString() ); 
    } 
}

  A - 
4, 4
  B - 
4, 5
  C - 
5, 4
  D - 
Compilation fails.
4-
What will be the output of the program?
class Test 
{
    public static void main(String [] args) 
    {
        int x= 0;
        int y= 0;
        for (int z = 0; z < 5; z++) 
        {
            if (( ++x > 2 ) && (++y > 2)) 
            {
                x++;
            }
        }
        System.out.println(x + " " + y);
    }
}

  A - 
5 2
  B - 
5 3
  C - 
6 3
  D - 
6 4
5-
What will be the output of the program?
int i = l, j = -1; 
switch (i) 
{
    case 0, 1: j = 1; /* Line 4 */
    case 2: j = 2; 
    default: j = 0; 
} 
System.out.println("j = " + j); 

  A - 
j = -1
  B - 
j = 0
  C - 
j = 1
  D - 
Compilation fails.
6-
What will be the output of the program?
for(int i = 0; i < 3; i++) 
{ 
    switch(i) 
    { 
        case 0: break; 
        case 1: System.out.print("one "); 
        case 2: System.out.print("two "); 
        case 3: System.out.print("three "); 
    } 
} 
System.out.println("done");

  A - 
done
  B - 
one two done
  C - 
one two three done
  D - 
one two three two three done
7-
What will be the output of the program?
boolean bool = true; 
if(bool = false) /* Line 2 */
{
    System.out.println("a"); 
} 
else if(bool) /* Line 6 */
{
    System.out.println("b"); 
} 
else if(!bool) /* Line 10 */
{
    System.out.println("c"); /* Line 12 */
} 
else 
{
    System.out.println("d"); 
}

  A - 
a
  B - 
b
  C - 
c
  D - 
d
8-
What will be the output of the program?
class Exc0 extends Exception { } 
class Exc1 extends Exc0 { } /* Line 2 */
public class Test 
{  
    public static void main(String args[]) 
    { 
        try 
        {  
            throw new Exc1(); /* Line 9 */
        } 
        catch (Exc0 e0) /* Line 11 */
        {
            System.out.println("Ex0 caught"); 
        } 
        catch (Exception e) 
        {
            System.out.println("exception caught");  
        } 
    } 
}

  A - 
Ex0 caught
  B - 
exception caught
  C - 
Compilation fails because of an error at line 2.
  D - 
Compilation fails because of an error at line 9.
9-
public class MyProgram 
{
    public static void throwit() 
    {
        throw new RuntimeException();
    }
    public static void main(String args[])
    {
        try 
        {
            System.out.println("Hello world ");
            throwit();
            System.out.println("Done with try block ");
        }
        finally 
        {
            System.out.println("Finally executing ");
        }
    }
}
Ưhich answer most closely indicates the behavior of the program?
  A - 
The program will not compile.
  B - 
The program will print Hello world, then will print that a RuntimeException has occurred, then will print Done with try block, and then will print Finally executing.
  C - 
The program will print Hello world, then will print that a RuntimeException has occurred, and then will print Finally executing.
  D - 
The program will print Hello world, then will print Finally executing, then will print that a RuntimeException has occurred.
10-
Which interface provides the capability to store objects using a key-value pair?
  A - 
Java.util.Map
  B - 
Java.util.Set
  C - 
Java.util.List
  D - 
Java.util.Collection
 
[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 XML - Bài 05
Trắc Nghiệm Thiết Kế Web Và Flash - Bài 05
Trắc Nghiệm ASP.NET (English) - Bài 06
Trắc nghiệm Ngôn Ngữ Lập Trình C++ - Bài 53
Trắc nghiệm Ngôn Ngữ Lập Trình C++ - Bài 37
Trắc Nghiệm C# - Bài 44
Trắc Nghiệm Ngôn Ngữ Lập Trình C ( English ) - Bài 58
Trắc Nghiệm Ngôn Ngữ Lập Trình C ( English ) - Bài 85
Trắc Nghiệm Pascal - Bài 03
Trắc nghiệm Ngôn Ngữ Lập Trình C++ - Bài 39
Trắc Nghiệm Visual Basic - Bài 38
Trắc nghiệm XML - Bài 26
Trắc Nghiệm C++ - Bài 09
Trắc Nghiệm Visual Basic - Bài 04
Trắc Nghiệm Thiết Kế Web (English) - Bài 45
Trắc Nghiệm C# - Bài 53
Trắc Nghiệm Thiết Kế Web Và Flash - Bài 09
Trắc nghiệm Linux - Bài 35
Trắc Nghiệm C++ - Bài 01
Trắc Nghiệm Visual Basic - Bài 39
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