当前位置:网站首页>Nowcoder (5 choices)
Nowcoder (5 choices)
2022-07-27 18:23:00 【zh_ Tnis】
1、 Which of the following is the advantage of array over linked list ?
- right key : D
A Convenient deletion
B Convenient insertion
C Variable length
D Small storage space
analysis :
1: The memory space of array is less than that of linked list .
2: Array supports random access , Linked list does not have the property of random access .
3: Insert and delete are linked lists better than arrays , The array needs to move the element after the deleted or inserted position .
2、 Array A[0…5 , 0…6] Each element of accounts for 5 Bytes , Store it in column priority at the starting address of 1000 In the memory unit of , The element A[5 , 5] The address for ?
- right key A
A 1175
B 1180
C 1205
D 1210
analysis :
1: Note that it is stored by column . So the address should be : ( Line length * ( Column - 1) + Place of action - 1) * Unit length + Initial address (6 * (6 - 1) + 6 - 1) * 5 + 1000 = 1175 It's about replacing , The row is the position of the element in the row or column .
2:a[5][5] It's No 6 Xing di 6 Elements ( Subscript from 0 At the beginning ) The row and column are 6. Don't remember the formula , The first 6 Xing di 6 Elements are stored in columns, with 5 Columns complete columns , Add the number 6 There is 5 Elements . So there are 6 * (6 - 1) + 6 - 1 Elements .
3、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. }
In the 16 Line insert which code can get a Point Coordinates of objects ?( )
- right key D
A Point p = Line.getPoint();
B Line.Point p = Line.getPoint();
C Point p = (new Line()).getPoint();
D Line.Point p = (new Line()).getPoint();
analysis :
1: Define another class in the class , Call it an inner class .
2: In the inner class , You can access the properties and methods of internal classes at any time , But external classes need to create objects to access .
3: The classification of internal classes are 1 Member inner class 2 Local inner classes 3 Anonymous inner class
4: Member internal class access rules
Member inner class is not static :
External class name . Internal class name Object name = new External class name ().new Internal class name ();
Member inner classes are static :
External class name . Internal class name Object name = new External class name . Internal class name ();
5: Local inner classes
A: Local internal classes must add... To access local variables final modification .
B: Why? ?
Because local variables disappear when they are used , And the data in the heap doesn't immediately disappear .
therefore , Heap memory still uses this variable , And the change variable is gone .
In order for the value to still exist , Just add final modification .
Through the decompilation tool, we see , Join in final after , Heap memory stores values directly , Not variable names .
:6: Anonymous inner class ( master )
A: Is a simplified form of a local inner class
B: Premise
There is a class or interface
C: Format :
new Class name or interface name () {
Rewriting methods ;
}
D: The essence : In fact, it is an anonymous object that inherits the class or implements the interface .
4、 What modifiers can local inner classes use to decorate ?
- right key :CD
A public
B private
C abstract
D final
This picture is made by others , It is of great help to this problem .

5、 In the length of n Of the sequence table i(1≤i≤n+1) Insert an element at a location , The number of moves of the element is ?
- right key A
A n-i+1
B n-i
C i
D i-1
analysis :
Because in i Insert an element at , That is to say, the original linked list i Position plus all elements behind yourself move back once , That is to say n+1-i Time .
边栏推荐
- The latest advanced interview questions for big factories are necessary
- [learning notes] classification of locks in the database
- Bubble sorting in JS
- Golang customize once. When error occurs, reset it for the second time
- Year end summary template
- NowCoder(5选)
- 图形界面编程
- Multi thread import data and generate error files for redis storage
- 力压谷歌、英伟达!阿里含光800芯片再获权威测试世界第一
- Deep learning: Gan case exercise -minst handwritten digits
猜你喜欢

浅论分布式训练中的recompute机制

深度学习:GAN案例练习-minst手写数字
![[learning notes] advanced version of MySQL database - index optimization, slow query, locking mechanism, etc](/img/7a/7497a73b435c3ed4fa0f3a3e908298.jpg)
[learning notes] advanced version of MySQL database - index optimization, slow query, locking mechanism, etc

WPF makes login interface

文件路径读取

数据库的常用命令2
![[MIT 6.S081] Lab8: locks](/img/9f/0ff7a0226837a3c420f49e6da8209f.png)
[MIT 6.S081] Lab8: locks

GIS数据漫谈(五)— 地理坐标系统

Set up SSO based on SAML 2.0 in salesforce and enable JIT user provisioning (between SF orgs / between SF org and experience cloud / other IDPs)

What every Salesforce developer should know about Dates and Times in Apex
随机推荐
[MIT 6.S081] Lab 11: networking
zabbix6.0的安装部署
收藏!0 基础开源数据可视化平台 FlyFish 大屏开发指南
华为Mate30 Pro 5G拆解:自研芯片占比过半,美系芯片依然存在!
Local development using LWC in salesforce
Three consecutive high-frequency interview questions of redis online celebrity: cache penetration? Cache breakdown? Cache avalanche?
[MIT 6.S081] Lec 4: Page tables 笔记
注释中的{@code}、{@Link} 与<p>等标签
深度学习:GAN优化方法-DCGAN案例
文件路径读取
邮件安全运营难?Coremail携手云商店打造企业邮箱办公新生态!
数据库的常用命令2
二叉树概念
浅论分布式训练中的recompute机制
英特尔发布新一代Movidius VPU:性能提升10倍,功耗仅30W
多表查询
【学习笔记】MySQL数据库高级版 - 索引优化、慢查询、锁机制等
联发科首款5G SoC来了!A77+G77+APU3.0,11月26日正式发布!
@Scheduled and quartz
Year end summary template