当前位置:网站首页>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 .
边栏推荐
- A marriage app_ T signature analysis
- Why do cloud desktops use rack servers? What are the functions of cloud desktop?
- [technical grass planting] how to batch check your server status? Cloud probe panel setup tutorial
- LeetCode 120. Triangle minimum path sum
- How to use the speech synthesis assistant? Does speech synthesis cost money?
- What is data analysis? Analysis is not storytelling... - Cassie kozyrkov
- Thoroughly explain the details of the simple factory that you haven't paid attention to
- [tcapulusdb knowledge base] how does tcapulusdb add a business cluster cluster?
- Thorough and thorough analysis of factory method mode
- How to query the cloud desktop server address? What are the advantages of using cloud desktop?
猜你喜欢

layer 3 switch
![[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)

Stm32g474 infrared receiving based on irtim peripherals

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

BIM model example

It's too difficult for me. Ali has had 7 rounds of interviews (5 years of experience and won the offer of P7 post)
![[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)

I, a 27 year old female programmer, feel that life is meaningless, not counting the accumulation fund deposit of 430000
随机推荐
Echo framework: implementing service end flow limiting Middleware
Analysis report on market development trends and innovation strategies of China's iron and steel industry 2022-2028
The core battlefield of China US AI arms race: trillion level pre training model
Tcapulusdb Jun · industry news collection
Go language core 36 lecture (go language practice and application I) -- learning notes
[actual combat] how to realize people nearby through PostGIS
Junior network security engineers master these penetration methods and steadily improve their technology to become leaders!
Xmlmap port practice - X12 to CSV
November 15, 2021: add four numbers II. Here are four integer arrays nums1, num
Global and Chinese dealox industry development status and demand trend forecast report 2022-2028
8、 Pipeline pipeline construction project
Embedded hardware development tutorial -- Xilinx vivado HLS case (3)
Railway patrol system - Railway Intelligent Patrol communication system
LeetCode 120. Triangle minimum path sum
Tcapulusdb Jun · industry news collection
[dry goods] configure failover active/acitve in transparent mode on Cisco ASA firewall
Line/kotlin jdsl: kotlin DSL for JPA criteria API
Practical case - Tencent security hosting service MSS helped "zero accident" during the period of digital Guangdong re insurance!
Echo framework: add tracing Middleware
Tencent cloud Weibo was selected into the analysis report on the status quo of China's low code platform market in 2021 by Forrester, an international authoritative research institution