Java 错题整理 chapter 04

2021/11/26 17:10:57

本文主要是介绍Java 错题整理 chapter 04,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

4.

The statement System.out.printf("%3.1f", 1234.56) outputs ___________.

 回答错误

单选题 (1 分) 0 分

  1.  A.

    123.5

  2.  B.

    1234.56

  3.  C.

    123.4

  4.  D.

    1234.6

  5.  E.

    1234.5

注意四舍五入

6.

What is Math.round(3.6)?

单选题 (1 分) 1 分

  1.  A.

    3.0

  2.  B.

    3

  3.  C.

    4.0

  4.  D.

    4

四舍五入,注意

-1.5得到的是-1

-1.6得到-2

1.5得到2

1.4得到1

  1. 8.

    Math.floor(5.5) evaluates to _____.

     回答错误

    单选题 (1 分) 0 分

    1.  A.

      6.0

    2.  B.

      5.0

    3.  C.

      5

    4.  D.

      6

向下取整

5.5得到5.0

-5.5得到-6.0

12.

A Java character is stored in __________.

 回答错误

单选题 (1 分) 0 分

  1.  A.

    one byte

  2.  B.

    three bytes

  3.  C.

    four bytes

  4.  D.

    two bytes

20.

What is Math.rint(3.6)?

单选题 (1 分) 1 分

  1.  A.

    4.0

  2.  B.

    3

  3.  C.

    5.0

  4.  D.

    3.0

 

27.

Assume that the ASCII code for character c is 99. What is the printout of the following code?

System.out.println("a" + 'c');

 回答错误

单选题 (1 分) 0 分

  1.  A.

    196

  2.  B.

    9799

  3.  C.

    a99

  4.  D.

    ac

41.

Which of the following method returns the sine of 90 degree?

 回答错误

单选题 (1 分) 0 分

  1.  A.

    Math.sin(Math.PI)

  2.  B.

    Math.sin(Math.toRadian(90))

  3.  C.

    Math.sine(90)

  4.  D.

    Math.sin(90)

  5.  E.

    Math.sin(PI)

 

Java Math.toRadians() 方法用于将角度转换为弧度

50.

What is "Welcome" + 1 + 1*2?

 回答错误

单选题 (1 分) 0 分

  1.  A.

    Welcome11*2

  2.  B.

    Welcome3

  3.  C.

    Welcome12

  4.  D.

    Welcome4

54.

Suppose Character x = new Character('a'), __________________ returns true.

 回答错误

多选题 (3 分) 0 分

  1.  A.

    x.equals(new Character('a'))

  2.  B.

    x.compareToIgnoreCase('A')

  3.  C.

    x.equalsIgnoreCase('A')

  4.  D.

    x.equals('a')

  5.  E.

    x.equals("a")

58.

Which of the following are valid specifiers for the printf statement?

多选题 (3 分) 3 分

  1.  A.

    %6d

  2.  B.

    %10.2e

  3.  C.

    %8.2d

  4.  D.

    %10b

  5.  E.

    %4c

67.

Suppose i is an int type variable. Which of the following statements display the character whose Unicode is stored in variable i?

单选题 (1 分) 1 分

  1.  A.

    System.out.println((int)i);

  2.  B.

    System.out.println(i + " ");

  3.  C.

    System.out.println((char)i);

  4.  D.

    System.out.println(i);



这篇关于Java 错题整理 chapter 04的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程