《java基础知识练习题1答案》由会员分享,可在线阅读,更多相关《java基础知识练习题1答案(5页珍藏版)》请在金锄头文库上搜索。
1、一、 选择题1、 下列变量定义错误的是。A) int a; B) double b=4.5; C) boolean b=true; D)float f=9.8;2、 下列数据类型的精度由高到低的顺序是:a)float,double,int,longb)double,float,int,bytec)byte,long,double,floatd)double,int,float,long3、 6+5%3+2的值是_A)2 B)1 C) 9 D)104、 下面的逻辑表达式中合法的是_A)(7+8)&(9-5) B)(9*5)|(9*7) C)96&8 j ) i-; else j-;A) 15 B
2、) 16 C) 7 D) 817、设有定义 float x=3.5f, y=4.6f, z=5.7f;则以下的表达式中,值为true的是( )。 A) x y | x z B) x != y C) z ( y + x ) D) x y & ! ( x z )18、设有定义 int i=123; long j=456; 下面赋值不正确的语句是( )。A) j=i; B) j=(long)i; C) i=(int)j; D) i=j;19、若以下变量均已正确定义并赋值,下面符合Java语言语法的语句是( )。A) b = a!=7 ; B) a = 7 + b + c=9;C) i=12.3* %
3、 4; D) a = a + 7 = c + b;二、填空题:1、下面代码执行完后的输出是_b is: false _-。int x=3;int y=4;boolean b=true;System.out.println(b is:+(b=(yy&zy的结果是_false_。4、 写出定义双精度浮点型常量PI,值为3.1415926的语句:_ final double PI=3.1415926_。5、 表达式1/2*3的计算结果是_0_。6、 执行以下程序段后:a = _6_, b = _18_ 。 int a = 5, b;b = +a * 3;7、若a,b为int型变量且已分别赋值为2,6
4、。表达式(a+)+(+b) +a*b的值是_30_ 。other staff of the Centre. During the war, Zhu was transferred back to Jiangxi, and Director of the new Office in Jingdezhen, Jiangxi Committee Secretary. Starting in 1939 served as recorder of the West North Organization, Secretary of the Special CommitteeAfter the victory of the long March, he has been the Northwest Office of the Federation of State enterprises Minister, Shenmu fugu SAR missions, Director of Ningxia County party Committee Secretary and recorder of the County party Committee Secretary, Ministers and