当前位置:网站首页>Exercise arrangement 2.10, 11
Exercise arrangement 2.10, 11
2022-07-07 08:28:00 【aaacome】
1. When doing unit tests for programs in traditional object-oriented languages , Frequently used mock object .Mock The number of reflections the object passes through . Which of the following features of object-oriented is destroyed by reflection to the greatest extent ?
analysis :** Reflection breaks the encapsulation of code , Break the original access modifier access restrictions **
5. The following code runs and the result is ?
analysis :1. In the static statement block x Is a local variable , Does not affect static variables x Value
2.x and y Is a static variable , The default initial value is 0, Belong to the current class , Its worth changing will affect the operation of the whole class .
3.java The autoincrement operation is nonatomic
main In the method :
perform x– after x=-1
call myMethod Method ,x perform x++ The result is -1( after ++), but x=0,++x result 1,x=1 , be y=0
x+y+ ++x, Execute first x+y, The result is 1, perform ++x The result is 2, The final result is 3
3. The size is MAX In a circular queue ,f Is the position of the current header element ,r Is the position of the current tail element ( The position of the last element ), Then at any time , The number of elements in the queue is
analysis :
4. The output of the following code is ?
analysis : Static blocks are not initialized first , It's a static domain
The static field contains static variables 、 Static blocks and static methods , Among them, static variables and static blocks need to be initialized . The initialization order of the two of them depends on their positions !
The initialization order is t1 t2 A static block
5. About OutOfMemoryError, The following statement is correct ()?
analysis : About this question ,《 In depth understanding of java virtual machine 》 About OOM(OutOfMemory) Explanation of the problem
A: An overflow caused by the runtime constant pool , Set up -XX:MaxPermSize Can solve this problem ,
B: An error caused by insufficient heap space , Problems are rare , Solutions and C identical ,
C: Belong to java Heap memory problem , The general method is through memory image analysis tools , Yes Dump The generated heap to store snapshots for analysis , The point is to make sure that objects in memory are necessary , That is, to judge whether there is a memory leak , There is still a memory overflow , If it is a memory column , Check the leaking object with tools GC Roots Reference chain information , Can accurately determine the location of the leaked code , No leakage , You should check the heap parameters of the virtual machine , If you can continue to increase , You can set -Xmx solve the problem
D:java.lang.OutOfMemoryError: nativeGetNewTLA When the virtual machine cannot allocate new thread local space (Thread Local Area) Error message at the time of , This error is the thread requesting a new TLA When the , This exception usually only occurs in jRockit virtual machine , Only too absolute .
1. If the adjacency table of a directed graph is i Single linked list is empty , Is the first i The outgoing degree of vertices is zero .( )
analysis :
v3 The degree of 0
4. Judge the correctness of the following sentences :MFC in CString Is a type safe class .
analysis : Type safety is not a type , It is a specification about type operation .
Such as : Do not allow different types of data to be converted to each other
int Num =3;
string Str=“3”;
Num =Str; // wrong
Num=int.Parse(Str);// Yes
Type safety requires different types of data that can be converted to each other during conversion Explicit conversion
5. The correct one in the following description of heap is ()
analysis : The filtering times of a complete binary tree constructed by keyword sequence depends on the source binary tree sequence , therefore Ⅳ error .
2.AOE The net should be a ( )
analysis : In a directed acyclic graph , Use vertices to represent activities , Use the directed edge to indicate the order in which activities begin , This kind of graph is called AOV The Internet ;AOV The network can reflect the sequence of tasks ( A topological sort ).
3.c++ among , The error in the following array definition is ( )
analysis :B The content to the right of the equal sign of the answer is three rows and two columns , Conflict with the definition of two rows and three columns , So choose B
5. The following statement about the graph is wrong ()
analysis :A. Graph is a more generalized tree , There are also leaf nodes . C. DFS,BFS The results are different , It depends on the rules , Such as the first Left rear right , First right then left . D. The topological sequence
边栏推荐
- 单场带货涨粉10万,农村主播竟将男装卖爆单?
- AVL平衡二叉搜索树
- Infix keyword infix expression and the use of generic extension function in kotlin
- Understanding of out covariance, in inversion and invariance in kotlin
- Zcmu--1396: queue problem (2)
- eBPF Cilium实战(1) - 基于团队的网络隔离
- Bayes' law
- Give full play to the wide practicality of maker education space
- GFS distributed file system
- Explore creativity in steam art design
猜你喜欢
[quick start of Digital IC Verification] 11. Introduction to Verilog testbench (VTB)
Application of slip ring of shipborne radar antenna
Automatic upgrading of database structure in rainbow
Train your dataset with swinunet
Using helm to install rainbow in various kubernetes
云原生存储解决方案Rook-Ceph与Rainbond结合的实践
Coquette data completes the cloud native transformation through rainbow to realize offline continuous delivery to customers
Caractéristiques de bisenet
Ebpf cilium practice (2) - underlying network observability
解析创新教育体系中的创客教育
随机推荐
Bayes' law
Splunk查询csv lookup table数据动态查询
提高企业产品交付效率系列(1)—— 企业应用一键安装和升级
Implement your own dataset using bisenet
iptables 之 state模块(ftp服务练习)
在 Rainbond 中一键安装高可用 Nacos 集群
Deit learning notes
Using helm to install rainbow in various kubernetes
Domain specific language / DSL in kotlin
单场带货涨粉10万,农村主播竟将男装卖爆单?
A method for quickly viewing pod logs under frequent tests (grep awk xargs kuberctl)
Rainbond 5.7.1 支持对接多家公有云和集群异常报警
轻松上手Fluentd,结合 Rainbond 插件市场,日志收集更快捷
GFS distributed file system
OpenVSCode云端IDE加入Rainbond一体化开发体系
POJ - 3784 Running Median(对顶堆)
The field value in Splunk subquery fuzzy matching CSV is*
[quick start of Digital IC Verification] 14. Basic syntax of SystemVerilog learning 1 (array, queue, structure, enumeration, string... Including practical exercises)
Automatic upgrading of database structure in rainbow
eBPF Cilium实战(2) - 底层网络可观测性