91com在线观看_五级片网站_久99视频_快播91_91免费版看片_www.91视频com

当前位置:高考升学网 > 招聘笔试题 > 正文

北京神舟航天软件笔试题和面试题答案(三)

更新:2023-09-17 17:09:58 高考升学网

  public class Test {

  public static void changeStr(String str){

  str="welcome";

  }

  public static void main(String[] args) {

  String str="1234";

  changeStr(str);

  System.out.println(str);

  }

  }

  2、写出下面程序的运行结果(5分)

  class Foo{

  public static void main(String args[]){

  int x=4,j=0;

  switch(x){

  case 1:j++;

  case 2:j++;

  case 3:j++;

  case 4:j++;

  case 5:j++;

  default:j++;

  }

  System.out.println(j);

  }

  }

  (四) 代码查错(10分)

  1、指出下面程序的运行错误(4分)

  public class OutClass{

  private int varInOuterClass = 0;

  public OutClass(){

  }

  public void callOutter(){

  int varInOuterMethod = 0;

  class InnerClass{

  private int varInInnerClass = 0;

  public InnerClass(){

  }

  public void print(){

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

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

  System.out.println("varInInnerClass" + varInOuterMethod);

  }

  }

  InnerClass inner = new InnerClass();

  inner.print();

  }

  public static void main(String[] args){

  OutClass out = new OutClass();

  out.callOutter();

  }

  }

  2、指出下面程序的运行错误(3分)

  public class Something {

  public static void main(String[] args) {

  Something s = new Something();

  System.out.println("s.doSomething() returns " + doSomething());

  }

  public String doSomething() {

  return "Do something ...";

  }

  }

  (五) 编程题(10分)

  算法设计能力测试(10分)

  1、编写一个类,该类封装了一元二次方程共有的属性和功能,即该类有刻画方程系数的3个成员变量以及计算实根的方法。

  方程:求根方法为 要求:该类的所有对象共享常数项。

  下面给出了您在程序中可能会使用到的功能类,及其部分接口的API文档,在程序中可以进行使用,

java.lang.Math
static float signum(float f)
Returns the signum function of the argument; zero if the argument is zero, 1.0f if the argument is greater than zero, -1.0f if the argument is less than zero.
static double sin(double a)
Returns the trigonometric sine of an angle.
static double sinh(double x)
Returns the hyperbolic sine of a double value.
static double sqrt(double a)
Returns the correctly rounded positive square root of a double value.
static double tan(double a)
Returns the trigonometric tangent of an angle.
static double tanh(double x)
Returns the hyperbolic tangent of a double value.
static double toDegrees(double angrad)
Converts an angle measured in radians to an approximately equivalent angle measured in degrees.
static double toRadians(double angdeg)
Converts an angle measured in degrees to an approximately equivalent angle measured in radians.
  参考答案

  (一)不定项选择

  1, C 2, A D 3, A D 4, B 5, E 6, A C D 7, A E 8, A B 9, A B C D

  10, A B C 11, C 12, C D 13, C 14, C 15, C 16, B 17, D, 18, A B D

  19, D, 20, C D 21,B C 22, B C 23, A C E 24, A C D

  (五)编程题

  public class Equation {

  public float a;

  public float b;

  public float c;

  public double[] d;

  public Equation(float a, float b, float c) {

  this.a = a;

  this.b = b;

  this.c = c;

  this.d = new double;

  }

  boolean getRealRoot() {

  float temp = b b - 4 a c;

  if (temp < 0)

  return false;

  else {

  this.d[0] = (-b + Math.sqrt(temp)) / (2 a);

  this.d = (-b - Math.sqrt(temp)) / (2 a);

  return true;

  }

  }

  public static void main(String[] arg) {

  Equation e1 = new Equation(1, 2, 1);

  if (e1.getRealRoot()) {

  System.out.print(e1.d[0]);

  System.out.print(";");

  System.out.println(e1.d);

  } else {

  System.out.print("no real root");

  }

  }

  }

最新图文

2020年河北新闻网两学一做

时间:2023-09-18 07:0:24

2020年河北新闻网两学一做

时间:2023-09-15 11:0:59

两学一做学习教育知

时间:2023-09-21 06:0:30

2020年开展两学一做学习教

时间:2023-09-19 21:0:30
主站蜘蛛池模板: 久久国产精品亚洲一区二区 | 日韩第一区| a4yy欧美一区二区三区 | 国内精品久久久久久影院网站小说 | 国产精品日韩欧美 | 91嫩草视频在线观看 | 美女做爰视频在线观看免费 | 草草久 | 日韩美三级 | 国产揄拍国产精品人妻蜜 | 永久天堂网 av手机版 | 日日狠狠久久8888av | 国产a毛片 | 亚洲国产成人精品区 | 激性欧美激情在线 | 一区二区视频免费看 | 理论片87福利理论电影 | a亚洲va韩国va欧美va久久 | 久久婷婷香蕉热狠狠综合 | 亚洲欧美日韩精品在线 | 亚洲欧美在线精品一区二区 | 欧美激情一区二区三区 | 久久中文字幕无码一区二区 | 黄大色黄美女精品大毛片 | 高清在线观看自拍视频 | 黄色毛片免费网站 | 一区二区三区欧美日韩国产 | 18禁超污无遮挡无码免费游戏 | 午夜影院性生活 | 久久激情免费视频 | 欧美又长又硬又爽免费视频 | 高清亚洲精品酒店一区 | 夜夜夜高潮夜夜爽夜夜爰爰 | 国产后式a一视频 | 亚洲综合丁香 | 狠狠摸狠狠澡 | 成人国内精品视频在线观看 | 毛片毛片 | 国产精品 视频一区 二区三区 | 中文字幕人成不卡一区 | 宅男午夜视频在线观看 |