[Java] School Online Java Programming (Autumn 2020) Homework Answers-1.1 Introduction to Java and Object-Oriented Programming

1.1 Introduction to Java and object-oriented programming

 Multiple choice questions (1 point)

1 The order for solving practical problems using computer programs is:

(1) Solve by machine

(2) Express the problem in computer language

(3) Abstract actual problems

Answer: B (3) (2) (1)

 

2 The development history of programming is in the order of development:

(1) Assembly language (2) Machine language (3) High-level language (4) Object-oriented high-level language

Answer: C(2)(1)(3)(4)

 

 

3 Regard objective things as objects with ____ and ____, and find out the common state and behavior of the same type of objects through abstraction to form ____.

3. The main idea of ​​object-oriented is:

Answer: A state, behavior, class

 

4 The benefits of object-oriented technology to software development are:

(1) A designed class can be partially or completely reused in subsequent development

(2) Each class can be tested and maintained as an independent unit, and a large amount of code comes from a mature and reliable class library, so the newly added code when developing a new program is significantly reduced, making the program more reliable

(3) It is helpful to improve the user's control of class modification and data, making development more convenient.

Answer: B (1) (2)

 

 

5 The basic characteristics of object-oriented programs are:

(1) Abstraction and encapsulation (2) Inheritance (3) Polymorphism

Answer: A(1)(2)(3)

 

6 The characteristics of the Java language are:

(1) Object-oriented (2) Security (3) Operating platform independence (4) Multithreading (5) Memory management

D(1)(2)(3)(4)(5)

 

7 The difference between Java language and C and C++ is:

(1) Pointers are not supported (2) Memory management can be performed manually (3) The code generated by the Java compiler is platform-dependent (4) The memory is automatically managed (5) The bytecode generated by the Java compiler, as long as it is installed The Java operating system can execute programs on different processors

C(1)(4)(5)

 

 

8 Regarding the execution process of the Java program, which of the following options is correct

(1) Write .java program (2) Interpreter interprets and executes .java file (3) Compiler compiles .java file into .class file (4) Interpreter interprets and executes .class file

B(1)->(3)->(4)

 

9 The main advantages of Java are ()

A

Direct memory operation, powerful

B

Compile once, run everywhere

C

Pure object-oriented language

D

You can quickly develop the user interface by dragging and dropping

 

10 The following statement about the security of JAVA code is wrong ()

A

The bytecode verifier loads all classes needed for query execution

B

Interpreter executes code at runtime

C

At runtime, the bytecode is loaded, verified, and then executed in the interpreter

D

Class loader increases security by separating classes in the native file system and classes imported from the network

 

11 When compiling JAVA source program files, corresponding bytecode files will be generated. The extension of these bytecode files is ()

A java

B class

C html

Exe

 

12 The following statement is correct ()

A

The name of the source file of the JAVA program is the same as the name of the main class, and the suffix can be .java or .txt

B

The compilation command of JDK is java

C

After a JAVA source program is compiled, several bytecode files may be generated

D

After compiling the bytecode file under the DOS command line, you only need to enter the program name to run the program

 

13 The return type of the main() method of the execution entry of the Java application is ()

A

int

B

void

C

boolean

D

staic

 

14 The class definition of a Java program is as follows:

public class MyClass{}

Then the file name of the java source file should be

A

myclass.java

B

MyClass.java

C

MYCLASS.java

D

MyClass.class

 

Let the code of HelloWord be:

class HelloWord{

public void main(String a[]){

System.out.println("hello world");

}

}

 

15 Which statement is correct:

A

HelloWord.java cannot be compiled because the declaration of the main method is incorrect

B

HelloWord.java can be compiled, but an exception occurs when running the program, and HelloWorld will not be printed

C

HelloWord.java can be compiled, but it cannot run because the file has no public class

D

HelloWorld.java can be compiled and run normally, the result is hello world

 

Guess you like

Origin blog.csdn.net/weixin_44566432/article/details/108568035