重囗另类BBWSeⅹHD,av狼论坛,精品一卡2卡三卡4卡乱码理论,体育生gv老师浪小辉3p警察

浙大網新中研軟件開發工程師筆試題

時間:2024-10-06 01:49:15 資料大全 我要投稿
  • 相關推薦

浙大網新中研軟件開發工程師筆試題

  選擇題

浙大網新中研軟件開發工程師筆試題

  1: Consider the class hierarchy shown below:

  ——————————————————————–

  class FourWheeler implements DrivingUtilities

  class Car extends FourWheeler

  class Truck extends FourWheeler

  class Bus extends FourWheeler

  class Crane extends FourWheeler

  ———————————————————————-

  Consider the following code below:

  1.DrivingUtilities du;

  2.FourWheeler fw;

  3.Truck myTruck = new Truck();

  4.du = (DrivingUtilities)myTruck;

  5.fw = new Crane();

  6.fw = du;

  Which of the statements below are true?

  Choices:

  A.Line 4 will not compile because an interface cannot refer to an object.

  B.The code will compile and run.

  C.The code will not compile without an explicit cast at line 6, because going down the hierarchy without casting is not allowed.

  D.The code will compile if we put an explicit cast at line 6 but will throw an exception at runtime.

  2:A class design requires that a member variable should be accessible only by same package, which modifer word should be used?

  A.protected

  B.public

  C.no modifer

  D.private

  3:

  What is the result when you compile and run the following code?

  public class ThrowsDemo

  {

  static void throwMethod()

  {

  System.out.println(“Inside throwMethod.”);

  throw new IllegalAccessException(“demo”);

  }

  public static void main(String args[])

  {

  try

  {

  throwMethod();

  }

  catch (IllegalAccessException e)

  {

  System.out.println(“Caught ” + e);

  }

  }

  }

  Choices:

  What is the result when you compile and run the following code?

  public class ThrowsDemo

  {

  static void throwMethod()

  {

  System.out.println(“Inside throwMethod.”);

  throw new IllegalAccessException(“demo”);

  }

  public static void main(String args[])

  {

  try

  {

  throwMethod();

  }

  catch (IllegalAccessException e)

  {

  System.out.println(“Caught ” + e);

  }

  }

  }

  Choices:

  A.Compilation error

  B.Runtime error

  C.Compile successfully, nothing is printed.

  D.Inside throwMethod. followed by caught:java.lang.IllegalAccessExcption: demo

  4:

  In the following code, which is the earliest statement, where the object originally held in e, may be garbage collected:

  1.public class Test {

  2. public static void main (String args []) {

  3. Employee e = new Employee(“Bob”, 48);

  4. e.calculatePay();

  5. System.out.println(e.printDetails());

  6. e = null;

  7. e = new Employee(“Denise”, 36);

  8. e.calculatePay();

  9. System.out.println(e.printDetails());

  10. }

  11.}

  Only One:

  In the following code, which is the earliest statement, where the object originally held in e, may be garbage collected:

  1.public class Test {

  2. public static void main (String args []) {

  3. Employee e = new Employee(“Bob”, 48);

  4. e.calculatePay();

  5. System.out.println(e.printDetails());

  6. e = null;

  7. e = new Employee(“Denise”, 36);

  8. e.calculatePay();

  9. System.out.println(e.printDetails());

  10. }

  11.}

  Only One:

  A.Line 10

  B.Line 11

  C.Line 7

  D.Line 8

  5:

  What will be the result of executing the following code?

  public static void main(String args[])

  {

  char digit = ‘a’;

  for (int i = 0; i < 10; i++)

  {

  switch (digit)

  {

  case ‘x’ :

  {

  int j = 0;

  System.out.println(j);

  }

  default :

  {

  int j = 100;

  System.out.println(j);

  }

  }

  }

  int i = j;

  System.out.println(i);

  }

  Choices:

  What will be the result of executing the following code?

  public static void main(String args[])

  {

  char digit = ‘a’;

  for (int i = 0; i < 10; i++)

  {

  switch (digit)

  {

  case ‘x’ :

  {

  int j = 0;

  System.out.println(j);

  }

  default :

  {

  int j = 100;

  System.out.println(j);

  }

  }

  }

  int i = j;

  System.out.println(i);

  }

  Choices:

  A.100 will be printed 11 times.

  B.The code will not compile because the variable i cannot be declared twice within the main() method.

  C.The code will not compile because the variable j cannot be declared twice within the switch statement.

  D.None of these.

【浙大網新中研軟件開發工程師筆試題】相關文章:

一套軟件開發工程師筆試題09-30

筆美國國家儀器試題目09-23

中糧上海筆經08-08

銀行軟件開發筆試題07-25

騰訊軟件開發類筆試題07-28

中金CICC筆試題10-24

中鼎財富(北京)軟件開發有限公司 操盤分析師筆試題10-12

機械工程師筆試題07-17

中糧集團筆試題分享07-08

某公司Java工程師筆試題09-20

主站蜘蛛池模板: 余庆县| 乌鲁木齐县| 泾源县| 通江县| 镇安县| 重庆市| 安平县| 石狮市| 江陵县| 青州市| 樟树市| 法库县| 葵青区| 陕西省| 澜沧| 阿尔山市| 瓦房店市| 政和县| 曲周县| 图木舒克市| 长阳| 裕民县| 镇康县| 峨眉山市| 榕江县| 三台县| 衡阳县| 辉县市| 云和县| 玛纳斯县| 西昌市| 湘潭市| 武山县| 格尔木市| 白银市| 怀远县| 鄢陵县| 四会市| 牟定县| 徐汇区| 孝义市|