当前位置:网站首页>Select problem set 3
Select problem set 3
2022-06-24 01:57:00 【There's not enough brains】
One 、
1、 If you want to listen TCP port 9000, How should the server side create socket? B
A:new Socket(“localhost”,9000);
B:new ServerSocket(9000);
C:new Socket(9000);
D:new ServerSocket(“localhost”,9000);
ServerSocket(int port): Server binding port number , transfer accept() Listen for client connections , It returns a... In a connection queue socket.
Socket(InetAddress address , int port) Is to create a client to connect to the host socket flow ,InetAddress Is used to record the host class ,port Designated port
2、jre The criterion for judging whether the program is finished is A
A: All foreground threads have finished executing
B: All background threads have finished executing :
C: All threads are finished
D: It has nothing to do with the above
The background thread is the daemon thread , The foreground thread is the user thread .
The guardian thread : It refers to the thread that provides a general service in the background when the program is running , This thread is not necessary . At the same time, the thread priority of guard threads is very low .JVM Medium GC Thread is a guardian thread , as long as JVM start-up ,GC The thread starts .
There is little difference between user threads and daemon threads , The only difference is , If the user thread has exited , Only the daemon thread is left , that JVM Just quit .
3、 The following statement is after arithmetic operation and logical operation i and j The result is D
int i=0;
int j=0;
if((++i>0)||(++j>0)){
// Print out i and j Value .
}
A:i=0;j=0
B:i=1;j=1
C:i=0;j=1
D:i=1;j=0
|| And && All are short circuit functions :
The former , Expression one is true , Expression 2 does not execute .
the latter , The expression is false , Expression 2 does not execute .
4、instanceof Operator can be used to determine whether an object is :C
A: An instance of a class
B: An instance of a class that implements the specified interface
C: All right
D: An instance of a subclass
instance yes java Binary operator of , Used to determine whether the object on his left is the right class ( Interface , abstract class , Parent class ) Example
Two 、
1、 The following statement is correct
A: Instance methods can call instance methods of a superclass directly
B: Instance methods can call class methods of a superclass directly 、
C: The instance method can directly call the instance method of the subclass
D: The instance method can directly call the instance method of this class
A: The instance method can call the instance method of the parent class , But you need to pay attention to the modifier . If the method in the parent class is private modification , Subclasses cannot inherit and access .
B、 There is also the problem of modifiers /
C、 The parent class accesses the child class , need new An object can be accessed , No direct access to .
2、 Variable a It's a 64 Signed integers , The initial value is 16 The base number is represented by :0Xf000000000000000; Variable b It's a 64 Signed integers , The initial value is 16 The base number is represented by :0x7FFFFFFFFFFFFFFF. be a-b The result of using 10 What is the hexadecimal representation ?()
0x7FFFFFFFFFFFFFFF+1=0X8000000000000000
a-b=0Xf000000000000000-0X8000000000000000+1
=0X7000000000000001
=16^(15*7+16)+1
=2^607+1
3、 What happens when the following code is compiled and run A
public class TestDemo{
private int count;
public static void main(String[] args) {
TestDemo test=new TestDemo(88);
System.out.println(test.count);
}
TestDemo(int a) {
count=a;
}
}
A: Compile run through , The output is 88
B: Compile time error ,count Variables define private variables
C: Compile time error ,System.out.println Method is called test Not initialized
D: There is no output when compiling and executing
In the constructor count=a amount to this.count=a,this It can be omitted
count The modifier for is private, stay main Method to access .
4、 The result of the following procedure is :C
class X{
Y y=new Y();
public X(){
System.out.print("X");
}
}
class Y{
public Y(){
System.out.print("Y");
}
}
public class Z extends X{
Y y=new Y();
public Z(){
System.out.print("Z");
}
public static void main(String[] args) {
new Z();
}
}
A:ZYXX
B:ZYXY
C:YXYZ
D:XYZX
Initialization process :
Initializing static member variables and static code blocks in the parent class
Initializing static member variables and static code blocks in subclasses
Initializing common member variables and code blocks of the parent class , Then execute the construction method of the parent class
Initializing common member variables and code blocks of subclasses , Then execute the construction method of subclass
3、 ... and 、
1、 Consider this simple example , Let's see reflection How it works .
import java.lang.reflect.*;
public class DumpMethods {
public static void main(String args[]) {
try {
Class c = Class.forName(args[0]);
Method m[] = c.getDeclaredMethods();
for (int i = 0; i < m.length; i++)
System.out.println(m[i].toString());
} catch (Throwable e) {
System.err.println(e);
}
}
}
among "c.getDeclaredMethods" The role of is : D
A: Get the public method object of the class
B: Get all public method names of the class
C: Get all method objects of the class
D: None of the above options are correct
c.getDeclaredMethods Get a list of all the methods defined in this class
2、java The character type of is Unicode coding scheme , Every Unicode Code occupation () A bit . B
A:8
B:16
C:32
D:64
Each character takes 2 Bytes , That is to say 16 A bit
3、 There are the following 4 statement :
Integer i01=59;
int i02=59;
Integer i03=Integer.valueOf(59);
Integer i04=new Integer(59);
The following output is false Yes. : C
A:System.out.println(i01i02);
B:System.out.println(i01i03);
C:System.out.println(i03i04);
D:System.out.println(i02i04);
4、 Here's about java In the description of the package , The right is :
A: The main function of encapsulation is to hide the internal implementation details , Enhance program security
B: Packaging doesn't make much sense , Therefore, try not to use it in coding
C: If the subclass inherits the parent , For methods encapsulated in the parent class , Subclasses can still be called directly
D: You can only encapsulate methods in one class , Attributes cannot be encapsulated
Encapsulation is mainly about hiding internal code
Inheritance is mainly about reusing existing code
Polymorphism is mainly about rewriting the behavior of objects
Four 、
1、 The first node does not use the single chain list , The team head pointer points to the team head node , The end of the team pointer points to the end of the team node , During the operation of leaving the team C
A: Only modify the team head pointer
B: Modify only the end of line pointer
C: Team head 、 The pointer at the end of the line may have to be changed
D: Team head 、 The pointer at the end of the line has to be changed
When there is only the last element left in the queue , Deleting this element requires the queue to be empty , You need a team leader 、 The tail of the team changes .
2、 Suppose you only have 100Mb Of memory , Need to be right 1Gb Sort the data of , The most suitable algorithm is A
A: Merge sort
B: Insertion sort
C: Quick sort
D: Bubble sort
Memory only 100MB, And the data has 1GB, So there must be no way to put it into memory for sorting at one time . Can only be sorted externally , Outer sort usually uses multiway merge sort . That is, the original file is decomposed into multiple parts that can be loaded into memory at one time , Call each part into memory to sort , Then merge and sort the sorted sub files .
5、 ... and 、
1、 A binary tree has 399 Nodes , Among them is 199 The individual degree is 2 The node of , Then the number of leaf nodes in the binary tree is B
A: There is no such binary tree
B:200
C:198
D:199
According to the basic properties of binary tree , For any binary tree , Degree is 0 The node of ( Leaf node ) The ratio is always 2 One more node
2、 The common method to solve the conflict problem in hash method is D
A: Digital analysis 、 The method of elimination 、 Square with the middle method
B: Digital analysis 、 The method of elimination 、 Linear detection method
C: Digital analysis 、 Linear detection method 、 Multiple hashing
D: Linear detection method 、 Multiple hashing 、 Chain address
The construction method of hash function : Digital analysis 、 Square with the middle method 、 The method of removing the remaining is to remove the remaining 、 Piecewise addition
The way to deal with conflict : Open address method ( Including linear detection 、 Second detection 、 Pseudo random detection )、 Chain address 、 Multiple hashing
3、 Let the number of vertices of an undirected graph be n, Then the graph has at most ( ) side .B
A:n-1
B:n(n-1)/2
C:n2
D:n(n+1)/2
Connected graph , At least N-1 side , At most N(N-1)/2 side .
边栏推荐
- Web user experience design promotion practice
- Custom form dynamic form form designer process engine design scheme
- Tencent host security (cloud mirror) arsenal: a sword to kill mining Trojans binaryai engine
- Ppt layout design how to make pages not messy
- Analysis report on operation situation and development trend of global and Chinese diisobutyl aluminum hydride (Dibah) industry 2022-2028
- How to use voice synthesis? Can voice synthesis modify the voice?
- Tcapulusdb Jun · industry news collection
- 2、 Shell position variable
- Talk about 15 tips of SQL optimization
- Five things programmers need to consider when developing with low code – thenewstack
猜你喜欢

It's too difficult for me. Ali has had 7 rounds of interviews (5 years of experience and won the offer of P7 post)

BIM model example

Stm32g474 infrared receiving based on irtim peripherals
![[SQL injection 12] user agent injection foundation and Practice (based on burpsuite tool and sqli labs LESS18 target machine platform)](/img/c8/f6c2a62b8ab8fa88bd2b3d8f35f592.jpg)
[SQL injection 12] user agent injection foundation and Practice (based on burpsuite tool and sqli labs LESS18 target machine platform)

Review of AI hotspots this week: the Gan compression method consumes less than 1/9 of the computing power, and the open source generator turns your photos into hand drawn photos

I, a 27 year old female programmer, feel that life is meaningless, not counting the accumulation fund deposit of 430000
![[SQL injection 13] referer injection foundation and Practice (based on burpseuite tool and sqli labs less19 target platform)](/img/b5/a8c4bbaf868dd20b7dc9449d2a4378.jpg)
[SQL injection 13] referer injection foundation and Practice (based on burpseuite tool and sqli labs less19 target platform)

layer 3 switch
随机推荐
How to determine whether easycvr local streaming media is started successfully?
Clubhouse online supports replay function; Webobs live streaming tools are going to be popular |w
Ppt layout design how to make pages not messy
How to set up AI speech synthesis? What is the function of speech synthesis?
How do users of Fortress computers add servers? How much does it cost to add servers for fortress users?
Glusterfs version 4.1 selection and deployment
Tcapulusdb Jun · industry news collection
[tcapulusdb knowledge base] how to clean up tables in tcapulusdb table management?
How to make a ECS into a fortress machine how long does it take to build a fortress machine
Interviewer: let's talk about the snowflake algorithm. The more detailed, the better
[guide to cloud first] point north before tdsql elite challenge
Echo framework: implementing service end flow limiting Middleware
How does the education industry realize the TRTC interactive classroom apaas solution under the "double reduction policy"?
Analysis report on development trends and prospects of China's pyrolytic boron nitride (PBN) component industry 2022-2028
Tcapulusdb Jun · industry news collection
It's too difficult for me. Ali has had 7 rounds of interviews (5 years of experience and won the offer of P7 post)
Query report of each mic quality inspection result on SAP QM inspection lot?
Clean system cache and free memory under Linux
Disruptor note 2: disruptor class analysis
Five things programmers need to consider when developing with low code – thenewstack