Java练习题1(有答案)

2019-08-31 09:26

第 1题 ________ is an object-oriented programming language. 1、 Java 2、 C++ 3、 C 4、 Ada 5、 Pascal 答案 1 2

第 2题 ________ is Architecture-Neutral. 1、 Java 2、 C++ 3、 C 4、 Ada

5、 Pascal 答案 1

第 3题 ________ is a technical definition of the language that includes the syntax and semantics of the Java programming language. 1、 Java language specification 2、 Java API 3、 Java JDK

4、 Java IDE 答案 1

第 4题 ________ consists of a set of separate programs for developing and testing Java programs, each of which is invoked from a command line.

1、 Java language specification 2、 Java API 3、 Java JDK 4、 Java IDE 答案 3

第 5题 ________ provides an integrated development environment (IDE) for rapidly developing Java programs. Editing, compiling, building, debugging, and online help are integrated in one graphical user interface. 1、 Java language specification 2、 Java API

3、 Java JDK 4、 Java IDE 答案 4 第 6题 The main method header is written as: 1、 public static void main(string[] args) 2、 public static void Main(String[] args) 3、 public static void main(String[] args)

4、 public static main(String[] args) 5、 public void main(String[] args) 答案 3 第 7题 Which of the following statements is correct? 1、 Every line in a program must end with a semicolon.

2、 Every statement in a program must end with a semicolon. 3、 Every comment line must end with a semicolon; 4、 Every method must end with a semicolon; 5、 Every class must end with a semicolon; 答案 2

第 8题 Which of the following statements is correct to display Welcome to Java on the console?

1、 System.out.println( Welcome to Java ); 2、 System.out.println(\ 3、 System.println( Welcome to Java ); 4、 System.out.print( Welcome to Java ); 5、 System.out.print(\答案 2 5

第 9题 Which JDK command is correct to run a Java application in ByteCode.class? 1、 java ByteCode 2、 java ByteCode.class 3、 javac ByteCode.java

4、 javac ByteCode 5、 JAVAC ByteCode 答案 1 第 10题 Suppose you define a Java class as follows:

public class Test { }

In order to compile this program, the source code should be stored in a file named

1、 Test.class 2、 Test.doc 3、 Test.txt 4、 Test.java

5、 Any name with extension .java 答案 4 第 11题 The extension name of a Java bytecode file is 1、 .java 2、 .obj 3、 .class

4、 .exe 答案 3 第 12题 Which of the following lines is not a Java comment? 1、 /** comments */ 2、 // comments 3、 -- comments

4、 /* comments */

5、 ** comments ** 答案 3 5 第 13题 Which of the following are the reserved words? 1、 public 2、 static

3、 void 4、 class 答案 1 2 3 4 第 14题 To use JOptionPane in your program, you may import it using: 1、 import javax.swing.JOptionPane; 2、 import javax.swing.*; 3、 import javax.*;

4、 import javax.*.JOptionPane; 答案 1 2

第 15题 Which of the following are correct names for variables according to Java naming conventions? 1、 radius 2、 Radius 3、 RADIUS

4、 findArea 5、 FindArea 答案 1 4 第 16题 Which of the following are correct ways to declare variables? 1、 int length; int width;

2、 int length, width;

3、 int length; width; 4、 int length, int width; 答案 1 2 第 17题 ____________ is the Java assignment operator. 1、 == 2、 := 3、 =

4、 =: 答案 3 第 18题 Which of the following assignment statements is incorrect. 1、 i = j = k = 1; 2、 i = 1; j = 1; k = 1;

3、 i = 1 = j = 1 = k = 1; 4、 i == j == k == 1; 答案 3 4 第 19题 Which of the following is a constant, according to Java naming conventions? 1、 MAX_VALUE 2、 Test 3、 read

4、 ReadInt 5、 COUNT 答案 1 5 第 20题 To declare an int variable number with initial value 2, you write 1、 int number = 2L; 2、 int number = 2l;

3、 int number = 2; 4、 int number = 2.0; 答案 3 第 21题 Which of the following expressions will yield 0.5? 1、 1 / 2 2、 1.0 / 2

3、 (double) (1 / 2)

4、 (double) 1 / 2 5、 1 / 2.0 答案 2 4 5 第 22题 Which of the following expression results in a value 1? 1、 2 % 1 2、 15 % 4

3、 25 % 5 4、 37 % 6 答案 4 第 23题 -25 % 5 is _____ 1、 1 2、 2

3、 3

4、 4 5、 0 答案 5 第 24题 -24 % -5 is _____ 1、 3 2、 -3 3、 4

4、 -4 5、 0 答案 4 第 25题(Note: Java is case-sensitive) 1、 number += sum;

2、 number = sum + number; 3、 sum = Number + sum; 4、 sum += number; 5、 sum = sum + number; 答案 4 5

To add number to sum, you write


Java练习题1(有答案).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:2017-2018学年度第一学期小学教研工作计划及打算

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: