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 42
Ngày làm bài: Hôm nay lúc 13:18:15 (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-
You want subclasses in any package to have access to members of a superclass. Which is the most restrictive access that accomplishes this objective?
  A - 
public
  B - 
private
  C - 
protected
  D - 
transient
2-
interface Base 
{
    boolean m1 ();
    byte m2(short s);
}
which two code fragments will compile?
  1. interface Base2 implements Base {}
  2. abstract class Class2 extends Base
    { public boolean m1(){ return true; }}
  3. abstract class Class2 implements Base {}
  4. abstract class Class2 implements Base
    { public boolean m1(){ return (7 > 4); }}
  5. abstract class Class2 implements Base
    { protected boolean m1(){ return (5 > 7) }}
  A - 
1 and 2
  B - 
2 and 3
  C - 
3 and 4
  D - 
1 and 5
3-
class A 
{  
    protected int method1(int a, int b) 
    {
        return 0; 
    } 
}
Which is valid in a class that extends class A?
  A - 
public int method1(int a, int b) {return 0; }
  B - 
private int method1(int a, int b) { return 0; }
  C - 
public short method1(int a, int b) { return 0; }
  D - 
static protected int method1(int a, int b) { return 0; }
4-
What will be the output of the program?
class Test 
{
    public static void main(String [] args) 
    {
        Test p = new Test();
        p.start();
    }

    void start() 
    {
        boolean b1 = false;
        boolean b2 = fix(b1);
        System.out.println(b1 + " " + b2);
    }

    boolean fix(boolean b1) 
    {
        b1 = true;
        return b1;
    }
}

  A - 
true true
  B - 
false true
  C - 
true false
  D - 
false false
5-
What will be the output of the program?
class PassS 
{
    public static void main(String [] args) 
    {
        PassS p = new PassS();
        p.start();
    }

    void start() 
    {
        String s1 = "slip";
        String s2 = fix(s1);
        System.out.println(s1 + " " + s2);
    }

    String fix(String s1) 
    {
        s1 = s1 + "stream";
        System.out.print(s1 + " ");
        return "stream";
    }
}

  A - 
slip stream
  B - 
slipstream stream
  C - 
stream slip stream
  D - 
slipstream slip stream
6-
What will be the output of the program?
class Test 
{
    static int s;
    public static void main(String [] args) 
    {
        Test p = new Test();
        p.start();
        System.out.println(s);
    }

    void start() 
    {
        int x = 7;
        twice(x);
        System.out.print(x + " ");
    }

    void twice(int x) 
    {
        x = x*2;
        s = x;
    }
}

  A - 
7 7
  B - 
7 14
  C - 
14 0
  D - 
14 14
7-
    
import java.awt.*;
class Ticker extends Component 
{
    public static void main (String [] args) 
    {
        Ticker t = new Ticker();
        /* Missing Statements ? */
    }
}
Which two of the following statements, inserted independently, could legally be inserted into missing section of this code?
  1. boolean test = (Component instanceof t);
  2. boolean test = (t instanceof Ticker);
  3. boolean test = t.instanceof(Ticker);
  4. boolean test = (t instanceof Component);
  A - 
1 and 4
  B - 
2 and 3
  C - 
1 and 3
  D - 
2 and 4
8-
public void test(int x) 
{ 
    int odd = 1; 
    if(odd) /* Line 4 */
    {
        System.out.println("odd"); 
    } 
    else 
    {
        System.out.println("even"); 
    } 
}
Which statement is true?
  A - 
Compilation fails.
  B - 
"odd" will always be output.
  C - 
"even" will always be output.
  D - 
"odd" will be output for odd values of x, and "even" for even values.
9-
What will be the output of the program?
int i = 1, j = 10; 
do 
{
    if(i > j) 
    {
        break; 
    } 
    j--; 
} while (++i < 5); 
System.out.println("i = " + i + " and j = " + j);

  A - 
i = 6 and j = 5
  B - 
i = 5 and j = 5
  C - 
i = 6 and j = 4
  D - 
i = 5 and j = 6
10-
What will be the output of the program?
public class Test 
{  
    public static void main(String args[]) 
    { 
        int i = 1, j = 0; 
        switch(i) 
        { 
            case 2: j += 6; 
            case 4: j += 1; 
            default: j += 2; 
            case 0: j += 4; 
        } 
        System.out.println("j = " + j); 
    } 
}

  A - 
0
  B - 
2
  C - 
4
  D - 
6
 
[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 Java - Bài 02
Trắc Nghiệm Thiết Kế Web - Bài 14
Trắc Nghiệm Thiết Kế Web (English) - Bài 01
Trắc Nghiệm ASP.NET (English) - Bài 09
Trắc nghiệm C++ - Bài 13
Trắc Nghiệm Thiết Kế Web Và Flash - Bài 09
Trắc nghiệm XML - Bài 22
Trắc nghiệm XML - Bài 30
Trắc Nghiệm Ngôn Ngữ Lập Trình C ( English ) - Bài 22
Trắc nghiệm Linux - Bài 53
Trắc Nghiệm ASP.NET - Bài 06
Trắc Nghiệm Visual Foxpro - Bài 04
Trắc Nghiệm Thiết Kế Web (English) - Bài 28
Trắc Nghiệm Ngôn Ngữ Lập Trình C ( English ) - Bài 24
Trắc Nghiệm Java - Bài 47
Trắc Nghiệm Java - Bài 07
Trắc Nghiệm C# - Bài 51
Trắc nghiệm Linux - Bài 35
Trắc Nghiệm ASP.NET - Bài 16
Trắc Nghiệm Java - Bài 15
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