MD2-7.1- Interface and Abstract Class

MD2-7.1- Interface and Abstract Class

University

10 Qs

quiz-placeholder

Similar activities

Past perfect

Past perfect

University

15 Qs

Transitions Practice

Transitions Practice

7th Grade - University

11 Qs

StoryCorps

StoryCorps

University

14 Qs

Vocabulary

Vocabulary

University

10 Qs

The Internet

The Internet

University

15 Qs

Cinemas - TOEIC tests / #2-Advanced level

Cinemas - TOEIC tests / #2-Advanced level

University

10 Qs

Unit 6

Unit 6

University

10 Qs

MD2-7.1- Interface and Abstract Class

MD2-7.1- Interface and Abstract Class

Assessment

Quiz

English

University

Practice Problem

Medium

Created by

kiếm mãi

Used 33+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Chọn dòng mã lệnh sai sau:

abstract class Hinh{}

class Tron extends Hinh{}

abstract class DaGiac extends Hinh{}

class TamGiac extends DaGiac{}

class ChuNhat extends DaGiac{}

a. Hinh h1 = new Tron()

b. Hinh h2 = new DaGiac()

c. Hinh h4 = new ChuNhat()

d. Hinh h3 = new TamGiac()

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Chọn dòng mã lệnh sai sau? abstract class Hinh{} class TamGiac extends Hinh{}

a. TamGiac h3 = new TamGiac();

b. TamGiac h4 = new TamGiac();

c. Hinh h1 = new Hinh()

d. Hinh h2 = new TamGiac()

3.

MULTIPLE CHOICE QUESTION

30 sec • 5 pts

Chọn dòng mã lệnh sau sẽ phát sinh lỗi khi dịch:

abstract class Hinh{}

class Tron extends Hinh{}

abstract class DaGiac extends Hinh{}

class TamGiac extends DaGiac{}

class ChuNhat extends DaGiac{}

Hinh h1 = new Tron()

Hinh h2 = new TamGiac()

Hinh h3 = new ChuNhat()

a. DaGiac h4 = h2;

b. h2 = h3;

c. Tron h6 = (Tron)h1;

d. Hinh h5 = h1;

4.

MULTIPLE SELECT QUESTION

45 sec • 5 pts

Giả sử có 2 lớp NhanVien và TruongPhong được khai báo như sau. Hãy chọn dòng mã lệnh phát sinh lỗi lúc dịch? 

package rikkei.soft.vn

public class NhanVien {

public String hoTen;

protected double luong;

public NhanVien(String hoTen, double luong) { }

void xuat() { }

private double getThuNhap() { return 0; } }

package rikkei.soft.jpn

public class TruongPhong extends NhanVien {

public double trachNhiem;

public TruongPhong(String hoTen, double luong, double trachNhiem) {

super(hoTen, luong);

this.trachNhiem = trachNhiem }

public void xuat() { super.hoTen = "Tuấn"; super.luong = 500; super.xuat();

double thuNhap = super.getThuNhap();

}

}

a. double thuNhap = super.getThuNhap()

b. super.xuat()

c. super.hoTen = "Tuấn"

d. super.luong = 500

5.

MULTIPLE CHOICE QUESTION

30 sec • 5 pts

Khai báo lớp đúng là:

a. abstract class Parent{abstract void method(){}}

b. abstract class Parent{private abstract void method();}

c. class Parent{abstract void method();}

d. abstract class Parent{abstract void method();}

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Phát biểu sai về từ khóa abstract là:

a. Từ khóa abstract cũng được sử dụng để định nghĩa cho trường

b. Không thể sử dụng new để tạo đối tượng từ lớp trừu tượng.

c. Từ khóa abstract được sử dụng để định nghĩa lớp và phương thức trừu tượng

d. Lớp chứa phương thức trừu tượng thì lớp đó phải là lớp trừu tượng.

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

 

Phát biểu đúng về lớp và phương thức trừu tượng là:

a. Từ khóa private và abstract không thể khai báo cùng nhau

b. Tất cả các đáp án trên đều đúng

c. Từ khóa public và abstract không thể khai báo cùng nhau

d. Từ khóa protected và abstract không thể khai báo cùng nhau

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?