Java: KIỂM TRA KIẾN THỨC JAVA.LANG

Các khóa học qua video:
Python SQL Server PHP C# Lập trình C Java HTML5-CSS3-JavaScript
Học trên YouTube <76K/tháng. Đăng ký Hội viên
Viết nhanh hơn - Học tốt hơn
Giải phóng thời gian, khai phóng năng lực

Các câu hỏi

1. The_________________method is called by the garbage collector on an object when it is identified to have no more references pointing to it.

(A)

final()

(C)

destroy()

(B)

finalize()

(D)

notify()

Choose answer:

(A)

A

(C)

C

(B)

B

(D)

D

2. Which of the following statements about Quantifiers are true?

(A)

The greedy quantifiers are termed ‘greedy’ because they force the matcher to read the entire input string before to attempting the first match.

(B)

The possessive quantifiers start at the beginning of the input string and then, reluctantly read one character at a time looking for a match.

(C)

The last thing that Greedy quantifiers try is the entire input string.

(D)

The possessive quantifiers always eat the entire input string, trying recursively for a match.

Choose answer:

(A)

B,C

(C)

A,C

(B)

B,D

(D)

A,B

3. Match the following Pattern constants with the corresponding embedded flag expressions.

Constant

Embedded Flag Expressions

a.

Pattern.CASE_INSENSITIVE

1.

(?m)

b.

Pattern.COMMENTS

2.

(?s)

c.

Pattern.MULTILINE

3.

(?i)

d.

Pattern.DOTALL

4.

(?x)

Choose answer:

(A)

a-4, b-3, c-2, d-1

(C)

a-3, b-4, c-1, d-2

(B)

a-3, b-1, c-4, d-1

(D)

a-2, b-4, c-1, d-3

4. Which of the following input strings will find a match for the regular expression b[^at]\S?

(A)

bar

(C)

beg

(B)

bet

(D)

bat

Choose answer:

(A)

B,C

(C)

A,C

(B)

B,D

(D)

A,B

5. Consider the following code.

import java.util.StringTokenizer;

public class Tokenizer {
  public static void main(String[] args) {
    StringTokenizer st = new StringTokenizer("Java, is, object:oriented", ":");
    while (st.hasMoreTokens()) System.out.println(st.nextToken());
  }
}

What will be the output of the code?

(A)

Java,is,object,oriented

(C)

Java,is,object

oriented

 

 

(B)

Java is object

oriented

 

 

(D)

 

Java,is

Object-oriented

6. Match the following garbage collection approaches with the corresponding description.

GC Approach

Description

a.

Serial

1.

Copies or evacuates live objects to a different

memory area.

b.

Concurrent

2.

Works on only one thing at a time.

c.

Non-compacting

3.

Executes one or more garbage collection tasks simultaneously with the execution of the application.

d.

Copying

4.

Releases the space utilized by garbage objects in-

place.

Choose answer:

(A)

a-4, b-3, c-2, d-1

(C)

a-3, b-4, c-1, d-2

(B)

a-3, b-1, c-4, d-1

(D)

a-2, b-3, c-4, d-1

Answers

1.

B

2.

D

3.

C

4.

A

5.

C

6.

D

» Tiếp: Thừa kế (Inheritant)
« Trước: Hàm xử lý chuỗi (String)
Các khóa học qua video:
Python SQL Server PHP C# Lập trình C Java HTML5-CSS3-JavaScript
Học trên YouTube <76K/tháng. Đăng ký Hội viên
Viết nhanh hơn - Học tốt hơn
Giải phóng thời gian, khai phóng năng lực
Copied !!!