- 1、本文档共43页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
面向对象编程基础习题与答案
面向对象编程基础习题及答案
Choice Questions (1pt for each question).
To add a to b and store result in b, you write (Note: Java is case-sensitive)
A. b += a;
B. a = b + a;
C. b = A + b;
D. a += b;
To declare a constant PI, you write
A. final static PI = 3.14159;
B. final float PI = 3.14159;
C. static double PI = 3.14159;
D. final double PI = 3.14159;
To improve readability and maintainability, you should declare _________ instead of using literal values such as 3.14159.
A. variables
B. methods
C. constants
D. classes
To declare an int variable x with initial value 200, you write
A. int x = 200L;
B. int x = 200l;
C. int x = 200;
D. int x = 200.0;
To assign a double variable d to an int variable x, you write
A. x = (long)d
B. x = (int)d;
C. x = d;
D. x = (float)d;
In Java, the word true is ________.
A. a Java keyword
B. a Boolean literal
C. same as value 1
D. same as value 0
Which of the Boolean expressions below has incorrect syntax?
A. (true) (3 4)
B. !(x 0) (x 0)
C. (x 0) || (x 0)
D. (x != 0) || (x = 0)
Which of the following is the correct expression that evaluates to true if the number x is between 1 and 100 or the number is negative?
A. 1 x 100 x 0
B. ((x 100) (x 1)) || (x 0)
C. ((x 100) (x 1)) (x 0)
D. (1 x 100) || (x 0)
Which of the following is the correct expression of character a?
A. a
B. a
C. \000a
D. None of the above.
Which of the following statement prints smith\exam1\test.txt?
A. System.out.println(smith\exam1\test.txt);
B. System.out.println(smith\\exam1\\test.txt);
C. System.out.println(smith\exam1\test.txt);
D. System.out.println(smith\exam1\test.txt);
Suppose i is an int type variable. Which of the following statements display the character whose Unicode is stored in variable i?
A. System.out.println(i);
B. System.out.println((char)i);
C. System.out.println((int)i);
D. System.out.println(i + );
The Unicode of a is 97. What is the Unicode for c?
A. 96
B. 97
C. 98
D. 99
Which of the following is a constant, according to Java naming
文档评论(0)