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 14
Ngày làm bài: Hôm nay lúc 18:37:10 (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-
interface DoMath 
{
    double getArea(int rad); 
}
interface MathPlus 
{
    double getVol(int b, int h); 
}
/* Missing Statements ? */
which two code fragments inserted at end of the program, will allow to compile?
  1. class AllMath extends DoMath { double getArea(int r); }
  2. interface AllMath implements MathPlus { double getVol(int x, int y); }
  3. interface AllMath extends DoMath { float getAvg(int h, int l); }
  4. class AllMath implements MathPlus { double getArea(int rad); }
  5. abstract class AllMath implements DoMath, MathPlus { public double getArea(int rad) { return rad * rad * 3.14; } }
  A - 
1 only
  B - 
2 only
  C - 
3 and 5
  D - 
1 and 4
2-
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
3-
/* Missing statements ? */
public class NewTreeSet extends java.util.TreeSet
{
    public static void main(String [] args) 
    {
        java.util.TreeSet t = new java.util.TreeSet();
        t.clear();
    }
    public void clear() 
    {
        TreeMap m = new TreeMap();
        m.clear();
    }
}
which two statements, added independently at beginning of the program, allow the code to compile?
  1. No statement is required
  2. import java.util.*;
  3. import.java.util.Tree*;
  4. import java.util.TreeSet;
  5. import java.util.TreeMap;
  A - 
1 only
  B - 
2 and 5
  C - 
3 and 4
  D - 
3 and 4
4-
Which three statements are true?
  1. The default constructor initialises method variables.
  2. The default constructor has the same access as its class.
  3. The default constructor invokes the no-arg constructor of the superclass.
  4. If a class lacks a no-arg constructor, the compiler always creates a default constructor.
  5. The compiler creates a default constructor only when there are no other constructors for the class.
  A - 
1, 2 and 4
  B - 
2, 3 and 5
  C - 
3, 4 and 5
  D - 
1, 2 and 3
5-

package testpkg.p1;
public class ParentUtil 
{
    public int x = 420;
    protected int doStuff() { return x; }
}

package testpkg.p2;
import testpkg.p1.ParentUtil;
public class ChildUtil extends ParentUtil 
{
    public static void main(String [] args) 
    {
        new ChildUtil().callStuff();
    }
    void callStuff() 
    {
        System.out.print("this " + this.doStuff() ); /* Line 18 */
        ParentUtil p = new ParentUtil();
        System.out.print(" parent " + p.doStuff() ); /* Line 20 */
    }
}
which statement is true?
  A - 
The code compiles and runs, with output this 420 parent 420.
  B - 
If line 18 is removed, the code will compile and run.
  C - 
If line 20 is removed, the code will compile and run.
  D - 
An exception is thrown at runtime.
6-
What will be the output of the program?
class PassA 
{
    public static void main(String [] args) 
    {
        PassA p = new PassA();
        p.start();
    }

    void start() 
    {
        long [] a1 = {3,4,5};
        long [] a2 = fix(a1);
        System.out.print(a1[0] + a1[1] + a1[2] + " ");
        System.out.println(a2[0] + a2[1] + a2[2]);
    }

    long [] fix(long [] a3) 
    {
        a3[1] = 7;
        return a3;
    }
}

  A - 
12 15
  B - 
15 15
  C - 
3 4 5 3 7 5
  D - 
3 7 5 3 7 5
7-
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
8-
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
9-
What will be the output of the program?
class BitShift 
{
    public static void main(String [] args) 
    {
        int x = 0x80000000;
        System.out.print(x + " and  ");
        x = x >>> 31;
        System.out.println(x);
    }
}

  A - 
-2147483648 and 1
  B - 
0x80000000 and 0x00000001
  C - 
-2147483648 and -1
  D - 
1 and -2147483648
10-
What will be the output of the program?
class Equals 
{
    public static void main(String [] args) 
    {
        int x = 100;
        double y = 100.1;
        boolean b = (x = y); /* Line 7 */
        System.out.println(b);
    }
}

  A - 
true
  B - 
false
  C - 
Compilation fails
  D - 
An exception is thrown at runtime
 
[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 Basic - Bài 03
Trắc Nghiệm Ngôn Ngữ Lập Trình C ( English ) - Bài 19
Trắc Nghiệm Ngôn Ngữ Lập Trình C ( English ) - Bài 54
Trắc Nghiệm Visual Basic - Bài 29
Trắc Nghiệm Pascal - Bài 15
Trắc Nghiệm Ngôn Ngữ Lập Trình C ( English ) - Bài 32
Trắc Nghiệm C++ - Bài 01
Trắc Nghiệm Ngôn Ngữ Lập Trình C ( English ) - Bài 49
Trắc Nghiệm Visual Basic - Bài 13
Trắc Nghiệm Java - Bài 48
Trắc Nghiệm Thiết Kế Web (English) - Bài 43
Trắc Nghiệm Java - Bài 45
Trắc Nghiệm Ngôn Ngữ Lập Trình C ( English ) - Bài 75
Trắc Nghiệm ASP.NET - Bài 23
Trắc nghiệm Linux ( English ) - Bài 24
Trắc nghiệm Ngôn Ngữ Lập Trình C++ - Bài 02
Trắc Nghiệm Pascal - Bài 11
Trắc nghiệm Ngôn Ngữ Lập Trình C++ - Bài 58
Trắc nghiệm XML - Bài 29
Trắc Nghiệm ASP.NET (English) - Bài 17
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