IQIYI 2019 autumn direction of pen strokes Java questions (B)

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/Yuudachi/article/details/101231918

IQIYI 2019 autumn direction of pen strokes Java questions (B)

1. Given a vertex of five eight sides forming a directed graph, the following statement is correct ( C )

A. degrees and each vertex is. 8
B. In terms of adjacency table as a storage structure, the number of nodes adjacent to the table 16
C. into degrees and each vertex is. 8
D. In terms of the adjacency matrix as a storage structure, The number of nonzero matrix elements 16

Analysis: 8 8 <=> edge penetration, of the 8

2. Known binary tree A (B (, D (F , H)), C (, E (G (I)))), whereby the binary tree forest described conversion is correct ( the BD )

A. The forest trees comprising two
B. the timber comprises three trees
C. tree rooted at A has two children
D. tree rooted at A has three children

Here Insert Picture Description

3. internet backbone network protocol BGP routers transmitting data using the transport layer protocol port BGP agreement ( the BC )

A. udp protocol
B. tcp protocol
C. port 179
D. 169 port

In BGP router port 179 for semi-permanent TCP connection to exchange routing information.

4. OS在进行磁盘调度时,要考虑选择合适的算法。此时有6个请求者请求访问磁盘。1号请求者要访问9号柱面6号磁头3号扇区;2号请求者要访问7号柱面5号磁头6号扇区;3号请求者要访问15号柱面20号磁头6号扇区;4号请求者要访问9号柱面4号磁头4号扇区;5号请求者要访问20号柱面9号磁头5号扇区;6号请求者要访问7号柱面15号磁头2号扇区。假设此时磁头位于8号柱面,那么最省时间的响应次序( A C

A. 146235
B. 241356
C. 621435
D. 352614

调度算法:
1.先来先服务:
2.最短寻道时间优先(当前磁头所在磁道距离最近的请求作为下一次服务的对象)
3.扫描算法或电梯调度(当前移动方向向上选择与当前磁头所在磁道距离最近的请求作为下一次服务的对象)
4.循环扫描

5. 下图的UML类结构图表示的是哪种设计模式?( D

Here Insert Picture Description
A. 解释器模式
B. 装饰模式
C. 桥接模式
D. 责任链模式

责任链(Chain of Responsibility)模式的定义:为了避免请求发送者与多个请求处理者耦合在一起,将所有请求的处理者通过前一对象记住其下一个对象的引用而连成一条链;当有请求发生时,可将请求沿着这条链传递,直到有对象处理它为止

6. 以下关于外观模式的叙述中错误是( B C D

A. 外观模式符合单一职责原则
B. 在外观模式中,一个子系统的外部与内部通信通过统一的外观对象进行
C. 在外观模式中,客户类只需要直接与外观对象进行交互
D. 外观模式是迪米特法则的一种具体实现

单一职责原则:一个类/接口/方法只负责一项职责或职能
外观模式:外观(Facade)模式的定义:是一种通过为多个复杂的子系统提供一个一致的接口,而使这些子系统更加容易被访问的模式。该模式对外有一个统一接口,外部应用程序不用关心内部子系统的具体的细节,这样会大大降低应用程序的复杂度,提高了程序的可维护性。
迪米特法则(Law of Demeter )又叫做最少知识原则,也就是说,一个对象应当对其他对象尽可能少的了解。不和陌生人说话。英文简写为: LoD。

7. 下列程序执行后输出结果为( D
 class BaseClass {
 public BaseClass() {}
 {
 System.out.println("I’m BaseClass class");
 }
 static {
 System.out.println("static BaseClass");
 }
 }
 public class Base extends BaseClass {
 public Base() {}
 {
 System.out.println("I’m Base class");
 }
 static {
 System.out.println("static Base");
 }
 public static void main(String[] args) {
 new Base();
 }
 }

A.
static BaseClass
I’m BaseClass class
static Base
I’m Base class

B.
I’m BaseClass class
I’m Base class
static BaseClass
static Base

C.
I’m BaseClass class
static BaseClass
I’m Base class
static Base

D.
static BaseClass
static Base
I’m BaseClass class
I’m Base class

1、静态优先,构造随后 2、无论静态还是构造,先父再子
父类的静态代码块
子类的静态代码块
父类的构造方法
子类的构造方法

8. 在第16行插入哪段代码可以获得一个Point对象的坐标?( D
10. class Line {
11. public class Point { public int x,y;}
12. public Point getPoint() { return new Point(); }
13. }
14. class Triangle {
15. public Triangle() {
16. // insert code here
17. }
18. }

A. Point p = Line.getPoint();
B. Line.Point p = Line.getPoint();
C. Point p = (new Line()).getPoint();
D. Line.Point p = (new Line()).getPoint();

(1)把类定义在另一个类的内部,该类就被称为内部类。
举例:把类B定义在类A中,类B就被称为内部类。
(2)内部类的访问规则
A:可以直接访问外部类的成员,包括私有
B:外部类要想访问内部类成员,必须创建对象
(3)内部类的分类
A:成员内部类
B:局部内部类
C:匿名内部类
(4)成员内部类访问规则
成员内部类不是静态的:
外部类名.内部类名 对象名 = new 外部类名().new 内部类名();
成员内部类是静态的:
外部类名.内部类名 对象名 = new 外部类名.内部类名();
(5)局部内部类
A:局部内部类访问局部变量必须加final修饰。
B:为什么呢?
因为局部变量使用完毕就消失,而堆内存的数据并不会立即消失。
所以,堆内存还是用该变量,而改变量已经没有了。
为了让该值还存在,就加final修饰。
通过反编译工具我们看到了,加入final后,堆内存直接存储的是值,而不是变量名。
(6)匿名内部类(掌握)
A:是局部内部类的简化形式
B:前提
存在一个类或者接口
C:格式:
new 类名或者接口名() {
重写方法;
}
D: nature:
in fact inherited class or subclass that implements the interface anonymous object

9. Expression (short) 10 / 10.2 * 2 after the operation result is what type? ( C )

A. short
B. int
C. double
D. float

Casts a higher priority than + - * /
the Java default to double floating point

Reference links

Trees, forests and binary conversion
https://blog.csdn.net/linraise/article/details/11745559
first-come, first-served https://blog.csdn.net/stpeace/article/details/46492009
shortest seek time priority scan scheduling algorithm or elevator code implementation https://blog.csdn.net/qq_38644549/article/details/80642633
https://blog.csdn.net/qq_38163244/article/details/83182912
design pattern
http: //c.biancheng .net / view / 1383.html
topics address
https://www.nowcoder.com/profile/4821886/test/27939517/372724#summary

Guess you like

Origin blog.csdn.net/Yuudachi/article/details/101231918