Big Brother: Talking about questions about in 2018 and about China in 2018
Talking about the interview questions for November 2018
I. Single-choice questions
1. Java is re-designed from the () language.
A. Ada B .C ++ C. Pasacal D. BASIC answer: B
2. Which of the following statements is true ()
A. After the Java program is compiled, the machine code is generated.
B. After the Java program is compiled, byte code is generated.
C. After the Java program is compiled, the DLL
D. All of the above are incorrect. Answer: B.
3. Which of the following statements are true ()
A. constructor in class cannot be omitted
B. the constructor must have the same name as the class, but the method cannot have the same name as the class.
C. constructor is executed when an object is new.
D. A class can only define one constructor. Answer: C
4. The package that provides Java database access capabilities is ()
A. java. SQL B. java. awt C. java. lang D. java. swing
5. Which of the following operators is valid ()
A. & B. <> C. if D.: = answer:
6. Execute the following program code:
A = 0; c = 0;
Do {
-- C;
A = A-1;
} While (a> 0 );
The value of C is ()
A.0 B .1 C.-1 D. endless loop answer: C
7. Which of the following statements is true ()
A. abstract modifiers can be used to modify fields, methods, and classes.
B. The body part of the abstract method must be wrapped in a pair of braces {}
C. Declare the abstract method. Braces are optional.
D. Do not write braces for declaring abstract methods. Answer: D
8. Which of the following statements is true ()
A. Formal parameters can be considered as local variable
B. Formal parameters can be modified by field Modifiers
C. Formal parameters are actually transmitted parameters when a method is called
D. The form parameter cannot be an object. Answer:
9. Which of the following statements is true ()
A. the instance method can directly call the superclass instance method.
B. The instance method can directly call the superclass class method.
C. The instance method can directly call the instance methods of other classes.
D. The instance method can directly call the class method of this class. Answer: D
Ii. multiple choice questions
1. Java program types ()
A. Class B. Applet C. Application D. Servlet
2. Which of the following statements are true ()
A. environment variables can be specified during source code compilation
B. The environment variables that can be specified during program compilation do not include the class path
C. javac can compile several Java source files at a time.
D. javac.exe specifies the directory to which the compilation result is stored. Answer: BCD
3. Which of the following identifiers is invalid ()
A. new B. $ Usdollars C.1234 D. car. taxi answer: ACD
4. Which of the following statements are false ()
A. array is an object.
B. arrays belong to a native class
C. int number = [] = {31,23, 33,43, 35,63}
D. The size of the array can be changed at will. Answer: BCD
5. interfaces that cannot be modified are ()
A. private B. public C. protected D. static answer: ACD
6. Which of the following statements are true ()
A. call by value does not change the actual parameter value.
B. call by reference can change the reference address of the actual parameter.
C. call by reference cannot change the reference address of the actual Parameter
D. call by reference can change the actual parameter content. Answer: ACD
7. Which of the following statements are false ()
A. Use this in class methods to call class methods of this class.
B. You can call this class method directly when calling this class method in class methods.
C. Only class methods in this class can be called.
D. The instance method cannot be called in class methods. Answer: ACD
8. Which of the following statements are false ()
A. Java object-oriented language allows separate processes and functions to exist
B. Java object-oriented language allows separate methods to exist
C. Methods in Java belong to members of the class (member)
D. Methods in the Java language must belong to a certain class (object). The same method and process or function is called.
9. Which of the following statements are false ()
A. The main () method is required for java class files that can be successfully run by java.exe.
B. J2SDK is a Java API
C. Appletviewer.exe you can use the jar option to run the. jar file.
D. the java class file that can be successfully run by Appletviewer must have the main () method. Answer: BCD
Iii. Answer questions
1. The name of the starting class in the Java program must be the same as the name of the file where the class is stored. () Answer: Correct
2. Unicode represents a word in 16 bits. () Answer: Correct
3. Data Types in the native class can be converted at will. () Answer: incorrect
1. Given the following JAVA program snippet: class A {public A () {system. out. println ("A") ;}} class B extends A {public B () {System. out. println ("B");} public static void main (String [] args) {B B B = new B () ;}} the above program will (). (select one)
A. Compilation fails.
B. After compilation, the output is a B.
C. After compilation, the output is: B
D. After compilation, the output is:
2. A java program has the following code: Datalnputstream din = new DataInputstream (new BufferedInputstream (new FileInputstream ("employee. dat "); assume that. the dat file contains only the following characters: abcdefg. Then: System. out. println (din) print () on the screen. (select one)
A,
B, B
C, 97
D, 98
3. Given java code snippets, such as int I = 0, j =-1, switch (I) {case 0, 1: j = 1, case 2: j = 2 ;} system. out. print ("j =" + j); compile and run it. The correct one is (). (Select one)
A. Program compilation Error
B. j = 1
C, j = 2
D, j = 0
4. Which of the following statements about constructors in Java is true (). (Select one)
A. The class must have an explicit constructor.
B. Its return type is void.
C. It has the same name as the class, but it cannot contain any parameters.
D. None of the above
5. In JAVA programming, the following () is correct when the components in the Swing package process events. (Select one)
A. Components in the Swing package also use the event Authorization Model to process events.
B. The event types generated by components in the Swing package also contain a J letter, such as JmouseEvent.
C. Components in the Swing package can also adopt the event transfer processing mechanism.
D. The event adapter corresponding to the components of the Swing package also contains J letters, such as JmouseAdapter.
6. Public class EqTest {public static void main (String args []) {EqTest e = new EqTest ();} EqTest () {String s = "Java "; string s2 = "java"; // place the test code {System. out. println ("Equal");} else {System. out. println ("not equal") ;}} in the above Java code comment row position, put () test code can output "equal" results. (Select one)
A. if (s = s2)
B. if (s. equals (s2 ))
C. if (s. equalsIgnoreCase (s2 ))
D. if (s. noCaseMatch (s2 ))
7. In the class description, data specified as private can be accessed by the following. (Select one)
A. Any function in the program
B. member functions of other classes
C. member functions in the class
D. member functions in the derived class
8. In JAVA programming, the following () command is used to execute java class files. (Select one)
A. javac
B. java
C. appletviewer
D. All the options above are incorrect.
9. In Java, the following method can be used to correctly create a Swing label component () (select two items)
A. ImageIcon icon = new ImageIcon (
B. ImageIcon icon = new ImageIcon (
C. ImageIcon icon = new ImageIcon (
D. JLabel label = new JLabel (SwingConstants. LEFT );
10. Analyze the following trythis () method written in Java: public void trythis () {try {System. out. print ("a"); problem ();} catch (RuntimeException e) {System. out. print ("B");} catch (Exception e) {System. out. print ("c");} finally {System. out. print ("d");} System. out. print ("e");} when this method is called, if the problem () method raises a RuntimeException class exception, the output result is (). (Select one)
A. abcde
B. abd
C. abde
D. abe
11. public class MyClass1 {public static void main (String argv []) {}_____ class MyInner {}} can be placed with the () modifier in the above java code. (Select three items)
A. public
B. private
C. static
D. friend
12. public class test3 {public static void main (String args []) {for {int I = 0; I <3; I ++} {for {int j = 3; j> 0; j --} {If (I = j) continue; System. out. print} n ("I =" + I + "j =" + j) }}} after the JAVA code above is compiled and run, among the following options ,() will appear in the output result (select three items)
A, I = 0 j = 3
B, I = 0 j = 0
C, I = 2 j = 2
D, I = 0 j = 2
E, I = 1 j = 2 13. The following Java code segment embodies the concept. (Select one )..... public void aMethod (String s ){....} public void aMethod (int I ){.........} public void aMethod (int I, float f ){.....}.....
A. Multi-Inheritance
B. Heavy Load
C. Rewrite
D. Polymorphism
14. In java, the following is the basis for processing all classes for output operations: () (select one)
A. DataOutput
B. OutputStream
C. BufferedOutputStream
D. IOStream
15. In jave, the Worker class is a subclass of the Person class. The Worker constructor has a "super ()" Statement (). (Select one)
A, a) call the super () method defined in Worker class
B, B) call the super () method defined in the Person class
C. c) call the Person-like constructor.
D. d. Syntax Error
16. Which of the following statements about the final keyword in Java is true (). (Select two items)
A. If the variable is modified, once the value is assigned, the same constant will be used.
B. If the class is modified, the class can only be inherited by one subclass.
C. If the modifier is used, the method cannot be overwritten in the subclass.
D. If the method is modified, the class of the method cannot be inherited.
17. In Java, the following options indicate the "a" value (). (select one)
A, 'A'
B. ""
C. new Character ()
D, \ 000a
18. Given java code snippets, such as Integer a = new Integer (3), Integer B = new Integer (3), and System. out. println (a = B); after running, this code is output (). (Select one)
A, true
B. false
C, 0
D, 1
19. Read a user-input value in the Java program and create a custom exception. If the input value is greater than 10, an exception is explicitly thrown using the throw statement, the exception output is "something's wrong! ", The statement is (). (Select one)
A. if (I> 10) throw Exception ("something's wrong !");
B. if (I> 10) throw Exception e ("something's wrong !");
C. if (I> 10) throw new Exception ("something's wrong !");
D. if (I> 10) throw new Exception e ("something's wrong !");
20, 42. two java programs are given, as follows: Text. the java compilation result is (). (select one) pubilc interface Face {int count = 40;} pubilc class Text implements Face {private static int counter; pubilc static void main (String [] args) {System. out. println (++ counter );}}
A, 40
B, 41
C, 0
D, 1
21, 39. given a Java program code, the output result is () after the compilation is run (). (select one) pubilc class Test {int count = 9; pubilc void count1 () {int count = 10; SYstem. out. println ("count1" + count);} pubilc void count2 () {SYstem. out. println ("count2" + count);} pubilc static void main (String args []) {Test t = new Twst (); t. count1 (); t. count2 ();}}
A, count1 = 9 count2 = 9
B. count1 = 10 count2 = 9
C, count1 = 10 count2 = 10
D, count1 = 9 count2 = 10
22, 37. the given java code is as follows: to use this code to compile successfully, you can enter () in the horizontal line (). (select two items) pubilc int count (char c, int I, double d) {return ______;}
A, c * I
B, c * (int) d
C, (int) c * d
D, I * d
23. In JAVA programming, the Java compiler converts the Java program (). (Select one)
A. bytecode
B. executable code
C. machine code
D. All the options above are incorrect.
24. In J2EE, the following elements are sorted by the set class (). (Select one)
A. shortlist
B. Stack
C. Hashtable
D. TreeSet
25, 9) analyze the following Java program: public class yy {public static void main (String [] ards) throws Exception {try {throw new Exception ();} catch (Exception e) {System. out. println ("Caught in main ()");} System. out. println ("nothing") ;}} the output result is (). (Select one)
A. Caught in main () nothing
B. Caught in main ()
C. nothing
D. No output
26. Compile and run the following Java code snippet: char c = 'a'; switch (c) {case 'A': System. out. println ("a"); default: System. out. println ("default");} the output result is (). (Select one)
A. The Code cannot be compiled because the switch statement does not have A legal expression.
B. a default
C.
D. default
27. In Java, after the following statement is executed, the value of c is (). (Select one) String s = "Jessica"; char c = s. charAt (6 );
A. null www.87717.com
B ,''
C, 'C'
D. 'A'
28. In J2EE, which of the following code has a compilation error is (). (Select one)
A. File f = new File ("/", "autoexec. bat ");
B. DataInputStream din = new DataInputStream (new FileInputStream ("autoexec. bat "));
C. InputStreamReader in = new InputStreamReader (System. in );
D. OutputStreamWriter out = new OutputStreamWriter (System. in );
29. 38. In adaptive wing programming, you can use () listeners to obtain the option value of the JComboBox object selected each time. (select two items)
A. ActionListener
B. ltemListener
C. KeyListener
D. SelectionListener
30. Which of the following statements about packages in Java is true (). (Select two items)
A. The package Declaration must be the first code of the source file.
B. The package Declaration must be followed by the import Statement.
C. Only public classes can be placed in the package.
D. You can place classes in multiple source files in the same package.
31. In Java, you should use the () keyword to make the class accessible only to the class in the package that defines the class. (Select one)
A. No keywords are required.
B. private
C. final
D. protected
32. The class class1 of pack1 contains the member method: protected void method_1 (){...}, Private void method_2 (){...}, Public void method_3 (){...} And void method_4 (){...}, In pack2, class2 is a subclass of class1. You can call method () in class2 (). (Select two items)
A. method_1
B. method_2
C. method_3
D. method_4
33. In the Java language, James defined the class My_Class in his package mypackage, and the class My_Class also exists in the sub-package mysubpackage of mypackage. James uses. import mypackage: To introduce the package and execute the statement My_Class NewClass = New My_Class (). (Select one)
A. Create A class mypackage. My_Class object
B. Create an object of the class mypackage. Mysubpackage. My_Class.
C. This statement is incorrect.
D. Create an object of the mypackage. My_Class class and an object of the mypackage. Mysubpackage. My_Class class.
34. 41. in JavaSwing programming, the code snippets for a given java program main method are as follows: JFrame jf = new JFrame (); jf. getContentpane (). setLayout (null); jf. setSize (200,200); jf. setVisible (true); // to display the following components on the interface, enter () in Area (). (select one)
A. JTextArea text = text JTextArea (100,100); text. setBounds (150,100,); jf. getContentpane (). add (text );
B. JTextField text = text JTextField (100,100); JScrollpane text = new JScrollpane (text); jf. setBounds (150,100,); jf. getContentpane (). add (jp );
C. JTextArea text = new JTextArea (150,100); JScrollpane jp = new JScrollpane (text); jp. setBounds (,); jf. getContentpane (). add (jp );
D. JTextArea text = new JTextArea (100,100); JScrollpane jp = new JScrollpane (text); jp. setBounds (150,100,); jf. getContentpane (). add (jp );
35. In JAVA, your buttons must implement the following functions: When you press the mouse, the mouse is displayed as "pressed"; when the button is released, the displayed "Mouse released" is displayed ". You must define the MouseListener () method. (Select two items)
A. mouseClicked
B. mouseEntered
C. mouseExited
D. mousePressed
E. mouseReleaseed
36. In JAVA, the listener interface () should be implemented to identify the time when the user closes the window (). (Select one)
A. MouseListener
B. ActionListener
C. WindowListener
D. All above are required.
37. In Java, which of the following statements is true when a variable of a class is declared as protected (). (Select two items)
A. only members of the same class can access it.
B. Any other class in different packages can access it.
C. Any other class in the same package can access it.
D. sub-classes in different packages can access this variable.
38. In the Java event processing model, when you press the mouse button, process () events. (Select one)
A. mouseReleased
B. mouseExited
C. mousePressed
D. mouseDown
39. String s1 = new String ("Hello"); String s2 = new String ("there"); String s3 = new String ("0 "); the above are some declarations of the JAVA program. Which of the following options can be compiled is (). (Select one)
A, a) s3 = s1 + s2
B, B) s3 = s1 & s2
C, c) s3 = s1 | s2
D, d) s3 = s1 & s2
40. In Java, calling the Math. random () method may return (). (Select one)
A, 132.34
B, 0.342
C. 29.34E10
D, 1.0009
41. In Java, the default layout manager of Panel is (). (Select one)
A. BorderLayout
B. FlowLayout
C. GridLayout
D. GridBagLayout
42. public class MyClass1 {public static void main (String argv []) {}______ class MyInner {}} can be placed with the () Modifier on the horizontal line of the above Java code. (Select two items)
A. public
B. private
C. implements
D. friend
43. Which of the following statements is true in java (). (Select two items)
A. char c = 'a ';
B. char c = "";
C, char c = 97;
D. char c = new Character ('A ');
44. Unlike traditional process programming, the main idea of object-oriented methods is (). (Select two items)
A. reflect users' actual needs
B. Abstract everything in the real world into entities or objects
C. Dividing the real world into a procedural implementation
D. Organize software into a collection of objects and combine data structures and Behaviors
45. In Java, the following methods () may be the constructor of the Orange class. (Select 3 items)
A, Orange (){...}
B. Orange (...) {...}
C. Public void Orange (){...}
D. Public Orange (){...}
E. Public Orange Constuctor (){...}
46. 45. in Java, the () excuse is located at the top layer of the Collection framework. (select one)
A. Map
B. Collection
C. Set
D. List
47. A java program fragment is given as follows: int I = 1; int j = I ++; if (I> ++ j) & (I ++ = j) I + = j; System. out. println (I); after the program runs, the output of I is (). (Select one)
A, 1
B, 2
C, 3
D, 4
48. In Java, suppose we have a class that implements the ActionListener interface. In the following method, () can register this class for a Button class. (Select one)
A. addListener ()
B. addActionListener ()
C. addButtonListener ()
D. setListener ()
49. 44. In the layout manager of JAVA, which of the following statements is false? (). (select one)
A. FlowLayout arrange components from left to right in the top to bottom Mode
B. BorderLayout uses "East". "West". "South". "North", "center" to specify the component location.
C. GridLayout allows you to create a grid layout. The size of each group in the grid layout can be adjusted as needed.
D. You can use the setLayout method of the container to specify the layout management for the container.
50. Study the following Java code: public class testException {public static void main (String args []) {int n [] = {0, 1, 2, 3, 4 }; int sum = 0; try {for (int I = 1; I <6; I ++) sum = sum + n [I]; System. out. println ("sum =" + sum);} catch (ArrayIndexOutOfBoundsExpception e) {System. out. println ("array out of bounds");} finally {System. out. println ("program ended") ;}} the output result is (). (Select one)
Array A and 10 out-of-bounds program ended
Procedures B and 10 are completed
C. The array out-of-bounds program ends.
D. Program termination
[Java base camp] 1. What does it mean if a class is declared as final in java?
A: final is the final meaning. final can be used to define variables, methods, and classes but has different meanings. Classes declared as final cannot be inherited.
2. Can the constructor of the parent class overwrite the quilt class )?
A: The constructor of the parent class cannot overwrite the quilt class, because the class names of the parent class and subclass cannot be the same.
3. Tell the difference between String and StringBuffer.
A: The object defined by the String class is used to store "fixed length" strings.
The StringBuffer class defines an object that is used to store "variable length" strings.
4. If there are two classes A and B (note that they are not interfaces) and you want to use the functions of these two classes at the same time, how do you compile the C class?
A: Because classes A and B are not interfaces, they cannot be directly inherited. However, they can be defined as parent and child classes, then Class C can implement the functions of Class A and Class B. If A is the parent class of B and B is the parent class of C, C can implement the functions of A and B.
5. Combine Java video Lesson5 (multithreading) to analyze the differences between sleep () and wait () methods.
A: Sleeping refers to the sleep () method used to suspend the thread temporarily. After sleep, the thread enters the ready state.
Waiting: If the wait () method is called, the thread is in the waiting state. Used when two or more threads run concurrently.
6. Let's talk about your understanding of abstract classes and interfaces.
A: the purpose of defining an abstract class is to provide a general form that can be shared by its subclass. The subclass can expand the abstract class according to its own needs. The abstract class cannot be instantiated. The abstract method does not have a function body. The abstract method must be provided in the subclass. specific implementation. He uses extends to inherit.
Interface: an interface allows a class to inherit from Several Interfaces. A Java program can only inherit one class at a time, but can implement several interfaces. The interface cannot have any specific method, APIS can also be used to define a group of constants that can be used by classes. The implementation method is interface.